Wheels #10
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: Wheels | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} | |
cancel-in-progress: true | |
# Publish when a (published) GitHub Release is created. | |
on: | |
push: | |
branches: | |
- master | |
- 'releases/**' | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- master | |
- 'releases/**' | |
release: | |
types: | |
- published | |
permissions: | |
contents: read | |
jobs: | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 | |
name: Install Python | |
with: | |
python-version: 3.x | |
- name: Build sdist | |
run: | | |
python -m pip install --upgrade pip setuptools | |
python -m pip install build | |
python -m build --sdist | |
- name: Check README rendering for PyPi | |
run: | | |
python -m pip install twine | |
twine check dist/* | |
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 | |
with: | |
path: dist/*.tar.gz | |
name: dist | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-latest] | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 | |
name: Install Python on Unix | |
with: | |
python-version: '3.12' | |
- name: Install cibuildwheel | |
run: | | |
python -m pip install cibuildwheel==2.22.0 | |
- name: Build ${{ matrix.build }} wheels | |
run: | | |
python -m cibuildwheel --output-dir wheelhouse | |
env: | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: pytest {package}/tests | |
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 | |
with: | |
path: | | |
./wheelhouse/*.whl | |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
twine_check: | |
needs: [ build_sdist, build_wheels ] | |
name: Twine check | |
runs-on: 'ubuntu-latest' | |
steps: | |
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
pattern: '*' | |
merge-multiple: true | |
path: wheelhouse | |
- name: List downloaded artifacts | |
run: ls -alR ./wheelhouse/ | |
- name: Install Python | |
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 | |
with: | |
python-version: '3.x' | |
- name: Install twine | |
run: | | |
python -m pip install --upgrade pip twine | |
- name: Check sdist and wheels | |
run: | | |
python -m twine check *.whl *.tar.gz | |
working-directory: wheelhouse | |
upload_pypi: | |
name: Upload release to PyPI | |
needs: twine_check | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
pattern: '*' | |
path: dist | |
merge-multiple: true | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |