This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
Update actions to node 16. #172
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Wheel::MacOS::ARM | |
# **What it does**: Builds python wheels for MacOS (11) architecture ARM 64 and store it as artifacts. | |
# Python versions: 3.9, 3.10, 3.11. | |
# **Why we have it**: To build wheels for pennylane-lightning installation. | |
# **Who does it impact**: Wheels to be uploaded to PyPI. | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
release: | |
types: [published] | |
env: | |
ARCHS: 'arm64' | |
PYTHON3_MIN_VERSION: "9" | |
PYTHON3_MAX_VERSION: "11" | |
concurrency: | |
group: wheel_macos_arm64-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
mac-set-matrix-arm: | |
name: Set builder matrix | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout PennyLane-Lightning | |
uses: actions/checkout@v3 | |
- name: Python version | |
id: pyver | |
run: | | |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then | |
echo "python_version=$(python3 scripts/gen_pyver_matrix.py \ | |
--min-version=3.${{ env.PYTHON3_MIN_VERSION }} \ | |
--max-version=3.${{ env.PYTHON3_MAX_VERSION }})" >> $GITHUB_OUTPUT | |
else | |
echo "python_version=$(python3 scripts/gen_pyver_matrix.py \ | |
--min-version=3.${{ env.PYTHON3_MIN_VERSION }} \ | |
--max-version=3.${{ env.PYTHON3_MAX_VERSION }} --range)" >> $GITHUB_OUTPUT | |
fi | |
outputs: | |
python_version: ${{ steps.pyver.outputs.python_version }} | |
mac-wheels-arm64: | |
needs: [mac-set-matrix-arm] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-11] | |
arch: [arm64] | |
pl_backend: ["lightning_kokkos", "lightning_qubit"] | |
cibw_build: ${{fromJson(needs.mac-set-matrix-arm.outputs.python_version)}} | |
name: macos-latest::arm64 - ${{ matrix.pl_backend }} (Python ${{ fromJson('{ "cp39-*":"3.9","cp310-*":"3.10","cp311-*":"3.11" }')[matrix.cibw_build] }}) | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout PennyLane-Lightning | |
uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: '3.9' | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel~=2.11.0 | |
- name: Build wheels | |
env: | |
CIBW_BUILD: ${{ matrix.cibw_build }} | |
# MacOS specific build settings | |
CIBW_BEFORE_ALL_MACOS: | | |
brew uninstall --force oclint | |
# Python build settings | |
CIBW_BEFORE_BUILD: | | |
python -m pip install pybind11 ninja cmake~=3.24.0 setuptools | |
CIBW_ENVIRONMENT: | | |
CMAKE_ARGS="-DCMAKE_CXX_COMPILER_TARGET=arm64-apple-macos11 -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SYSTEM_PROCESSOR=ARM64 -DENABLE_OPENMP=OFF" \ | |
PL_BACKEND="${{ matrix.pl_backend }}" | |
# Testing of built wheels | |
CIBW_TEST_REQUIRES: pytest pytest-cov pytest-mock flaky | |
CIBW_BEFORE_TEST: python -m pip install git+https://github.com/PennyLaneAI/pennylane.git@master | |
CIBW_TEST_COMMAND: | | |
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"` | |
pl-device-test --device=${DEVICENAME} --skip-ops -x --tb=short --no-flaky-report | |
CIBW_BUILD_VERBOSITY: 3 | |
CIBW_ARCHS_MACOS: ${{ matrix.arch }} | |
run: | | |
python -m cibuildwheel --output-dir wheelhouse | |
- name: Validate wheels | |
run: | | |
python -m pip install twine | |
python -m twine check ./wheelhouse/*.whl | |
- uses: actions/upload-artifact@v3 | |
if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' }} | |
with: | |
name: ${{ runner.os }}-wheels-${{ matrix.pl_backend }}-${{ matrix.arch }}.zip | |
path: ./wheelhouse/*.whl | |
# Refine and uncomment before merging to pennylane-lightning repository | |
# upload-pypi: | |
# needs: mac-wheels-arm64 | |
# runs-on: ubuntu-latest | |
# if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master'}} | |
# steps: | |
# - uses: actions/download-artifact@v3 | |
# with: | |
# name: macOS-wheels-arm64.zip | |
# path: dist | |
# - name: Upload wheels to PyPI | |
# uses: pypa/gh-action-pypi-publish@release/v1 | |
# with: | |
# user: __token__ | |
# password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
# repository_url: https://test.pypi.org/legacy/ |