Skip to content

Build wheels

Build wheels #132

Workflow file for this run

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-12, macos-13]
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: 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/