Build wheels #139
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: Build wheels | |
# By default this action does not push to test or production PyPI. The wheels | |
# are available as an artifact that can be downloaded and tested locally. | |
on: | |
workflow_dispatch: | |
inputs: | |
basix_ref: | |
description: "Basix git ref to checkout" | |
default: "main" | |
type: string | |
test_pypi_publish: | |
description: "Publish to Test PyPi (true | false)" | |
default: false | |
type: boolean | |
pypi_publish: | |
description: "Publish to PyPi (true | false)" | |
default: false | |
type: boolean | |
workflow_call: | |
inputs: | |
basix_ref: | |
description: "Basix git ref to checkout" | |
default: "main" | |
type: string | |
test_pypi_publish: | |
description: "Publish to Test PyPi (true | false)" | |
default: false | |
type: boolean | |
pypi_publish: | |
description: "Publish to PyPi (true | false))" | |
default: false | |
type: boolean | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-13, macos-14, windows-2022] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.basix_ref }} | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: arm64 | |
- name: Export GitHub Actions cache environment variables | |
if: runner.os == 'Windows' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: Build wheels | |
uses: pypa/[email protected] | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-wheel-artifact | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.basix_ref }} | |
- name: Upgrade pip | |
run: python -m pip install --upgrade pip setuptools | |
- name: Install build | |
run: python -m pip install build | |
- name: Build sdist | |
run: python -m build --sdist . | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: src-artifact | |
path: dist/* | |
upload_pypi: | |
name: Upload to PyPI (optional) | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: '*-artifact' | |
path: dist/ | |
merge-multiple: true | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
if: ${{ github.event.inputs.pypi_publish == 'true' }} | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
repository-url: https://upload.pypi.org/legacy/ | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
if: ${{ github.event.inputs.test_pypi_publish == 'true' }} | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TEST_TOKEN }} | |
repository-url: https://test.pypi.org/legacy/ |