Skip to content

Merge pull request #187 from jakevdp:test-fix #235

Merge pull request #187 from jakevdp:test-fix

Merge pull request #187 from jakevdp:test-fix #235

Workflow file for this run

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-12, windows-2019]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # ratchet:actions/checkout@v4
with:
submodules: true
# Used to host cibuildwheel
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # ratchet:actions/setup-python@v5
with:
python-version: "3.9"
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # ratchet: docker/setup-qemu-action@v3
with:
platforms: all
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.20.0
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_MACOS: universal2
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* cp313*
CIBW_FREE_THREADED_SUPPORT: True
CIBW_PRERELEASE_PYTHONS: True
CIBW_SKIP: "*musllinux* *i686* *win32* *t-win*"
CIBW_TEST_REQUIRES: absl-py pytest pytest-xdist
CIBW_TEST_COMMAND: pytest -n auto {project}
CIBW_BUILD_VERBOSITY: 1
- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # ratchet: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
overwrite: true
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # ratchet:actions/checkout@v4
with:
submodules: true
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # ratchet: actions/upload-artifact@v4
with:
path: dist/*.tar.gz
overwrite: true
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@fa0a91b85d4f404e444e00e005971372dc801d16 # ratchet:actions/download-artifact@v4
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@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # ratchet:pypa/gh-action-pypi-publish@v1.9
with:
password: ${{ secrets.PYPI_API_TOKEN }}