| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
name: Build and upload wheels |
| 9 |
|
| 10 |
on: |
| 11 |
workflow_dispatch: |
| 12 |
push: |
| 13 |
branches: |
| 14 |
- master |
| 15 |
release: |
| 16 |
types: |
| 17 |
- released |
| 18 |
- prereleased |
| 19 |
|
| 20 |
jobs: |
| 21 |
|
| 22 |
build_sdist: |
| 23 |
name: Build source distribution |
| 24 |
runs-on: ubuntu-latest |
| 25 |
steps: |
| 26 |
- uses: actions/checkout@v6 |
| 27 |
|
| 28 |
- name: Build sdist |
| 29 |
run: pipx run build --sdist |
| 30 |
|
| 31 |
- uses: actions/upload-artifact@v7 |
| 32 |
with: |
| 33 |
path: dist/*.tar.gz |
| 34 |
name: cibw-sdist |
| 35 |
|
| 36 |
build_wheels: |
| 37 |
name: Build wheels on ${{ matrix.os }} |
| 38 |
runs-on: ${{ matrix.os }} |
| 39 |
strategy: |
| 40 |
fail-fast: false |
| 41 |
matrix: |
| 42 |
|
| 43 |
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest, macos-15-intel] |
| 44 |
|
| 45 |
steps: |
| 46 |
- uses: actions/checkout@v6 |
| 47 |
- name: Set up QEMU |
| 48 |
if: runner.os == 'Linux' && runner.arch == 'X64' |
| 49 |
uses: docker/setup-qemu-action@v3 |
| 50 |
with: |
| 51 |
platforms: all |
| 52 |
- name: Build wheels |
| 53 |
uses: pypa/[email protected] |
| 54 |
env: |
| 55 |
CIBW_TEST_REQUIRES: hypothesis pytest |
| 56 |
CIBW_TEST_COMMAND: "pytest {project}/test.py -v && python {project}/cydoctest.py -v" |
| 57 |
CIBW_SKIP: "cp38-*" |
| 58 |
CIBW_ARCHS_LINUX: ${{ runner.arch == 'X64' && 'auto' || 'auto armv7l' }} |
| 59 |
CIBW_ARCHS_MACOS: ${{ runner.arch == 'X64' && 'auto' || 'auto universal2' }} |
| 60 |
CIBW_ARCHS_WINDOWS: "auto ARM64" |
| 61 |
CIBW_BUILD_FRONTEND: "build" |
| 62 |
MACOSX_DEPLOYMENT_TARGET: "14.0" |
| 63 |
|
| 64 |
- uses: actions/upload-artifact@v7 |
| 65 |
with: |
| 66 |
path: ./wheelhouse/*.whl |
| 67 |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
| 68 |
|
| 69 |
upload_pypi: |
| 70 |
needs: [build_wheels, build_sdist] |
| 71 |
runs-on: ubuntu-latest |
| 72 |
steps: |
| 73 |
- uses: actions/download-artifact@v8 |
| 74 |
with: |
| 75 |
pattern: cibw-* |
| 76 |
path: dist |
| 77 |
merge-multiple: true |
| 78 |
|
| 79 |
- uses: pypa/[email protected] |
| 80 |
|
| 81 |
if: github.event_name == 'release' && github.event.action == 'released' |
| 82 |
with: |
| 83 |
user: __token__ |
| 84 |
password: ${{ secrets.PYPI_API_TOKEN }} |
| 85 |
|
| 86 |
- uses: pypa/[email protected] |
| 87 |
|
| 88 |
if: github.event_name == 'release' && github.event.action == 'prereleased' |
| 89 |
with: |
| 90 |
user: __token__ |
| 91 |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
| 92 |
repository_url: https://test.pypi.org/legacy/ |