Build Python 3.12 wheels. #113
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 | |
on: | |
workflow_dispatch: {} # allows triggering this workflow manually | |
push: | |
branches: # trigger on commits to main branch | |
- main | |
pull_request: # trigger on pull requests affecting relevant files | |
branches: | |
- main | |
paths: | |
- '**workflows/wheels.yml' | |
- 'pyproject.toml' | |
release: # trigger on published release | |
types: | |
- published | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, macOS-11, windows-2019] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
# Used to host cibuildwheel | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel==2.15.0 | |
- name: Build wheels | |
run: python -m cibuildwheel --output-dir wheelhouse | |
env: | |
CIBW_ARCHS_LINUX: auto aarch64 | |
CIBW_ARCHS_MACOS: universal2 | |
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-* | |
CIBW_SKIP: "*musllinux* *i686* *win32*" | |
CIBW_TEST_REQUIRES: absl-py pytest pytest-xdist | |
CIBW_TEST_COMMAND: pytest -n auto {project} | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
upload_pypi: | |
name: Release & Upload to PyPI | |
needs: [build_sdist, build_wheels] | |
runs-on: ubuntu-latest | |
# Only publish release to PyPI when a github release is created. | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
# unpacks default artifact into dist/ | |
# if `name: artifact` is omitted, the action will create extra parent dir | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@v1.5.0 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |