Skip to content

Add inputs and cron job for Docker builds #4149

Add inputs and cron job for Docker builds

Add inputs and cron job for Docker builds #4149

Workflow file for this run

name: Wheel::Any::None
# **What it does**: Builds a pure python wheel for Linux (ubuntu-latest) and store it as an artifact.
# Python version: 3.9.
# **Why we have it**: To test the wheel build in the python layer, with no compilation.
# **Who does it impact**: Wheels to be uploaded to PyPI.
on:
pull_request:
push:
branches:
- master
release:
types: [published]
concurrency:
group: wheel_noarch-${{ github.ref }}
cancel-in-progress: true
jobs:
build-pure-python-wheel:
strategy:
matrix:
os: [ubuntu-latest]
pl_backend: ["lightning_gpu", "lightning_kokkos", "lightning_qubit"]
timeout-minutes: 30
name: ${{ matrix.os }} - Pure Python wheels - ${{ matrix.pl_backend }} (Python 3.9)
runs-on: ${{ matrix.os }}
steps:
- name: Checkout PennyLane-Lightning
uses: actions/checkout@v3
with:
path: main
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Install CMake and ninja
run: |
python -m pip install --upgrade cmake ninja
- name: Build wheels
if: ${{ matrix.pl_backend == 'lightning_qubit'}}
run: |
python -m pip install --upgrade pip wheel
cd main
PL_BACKEND="${{ matrix.pl_backend }}" python setup.py bdist_wheel
env:
SKIP_COMPILATION: True
- name: Validate wheels
if: ${{ matrix.pl_backend == 'lightning_qubit'}}
run: |
python -m pip install twine
python -m twine check main/dist/*.whl
- uses: actions/upload-artifact@v3
if: ${{ matrix.pl_backend == 'lightning_qubit' && (github.event_name == 'release' || github.ref == 'refs/heads/master') }}
with:
name: pure-python-wheels-${{ matrix.pl_backend }}.zip
path: main/dist/*.whl
- name: Build source dist
if: ${{ matrix.pl_backend != 'lightning_qubit'}}
run: |
python -m pip install --upgrade pip wheel
cd main
PL_BACKEND="${{ matrix.pl_backend }}" python setup.py sdist
env:
SKIP_COMPILATION: True
- uses: actions/upload-artifact@v3
if: ${{ matrix.pl_backend != 'lightning_qubit' && (github.event_name == 'release' || github.ref == 'refs/heads/master') }}
with:
name: pure-source-dist-${{ matrix.pl_backend }}.tar.gz
path: main/dist/*.tar.gz
upload-pypi:
needs: build-pure-python-wheel
strategy:
matrix:
pl_backend: ["lightning_gpu", "lightning_kokkos", "lightning_qubit"]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
if: ${{ matrix.pl_backend == 'lightning_qubit' && github.event_name == 'release' }}
with:
name: pure-python-wheels-${{ matrix.pl_backend }}.zip
path: dist
- name: Upload wheels to PyPI
if: ${{ matrix.pl_backend == 'lightning_qubit' && github.event_name == 'release' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- uses: actions/download-artifact@v3
if: ${{ matrix.pl_backend != 'lightning_qubit' && github.event_name == 'release' }}
with:
name: pure-source-dist-${{ matrix.pl_backend }}.tar.gz
path: dist