|
| 1 | +name: Build wheels |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, master ] |
| 6 | + tags: [ "v*" ] # only build/publish on version tags |
| 7 | + pull_request: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build_wheels: |
| 11 | + name: Build wheels on ${{ matrix.os }} |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Set up Python |
| 23 | + uses: actions/setup-python@v5 |
| 24 | + with: |
| 25 | + python-version: "3.11" |
| 26 | + |
| 27 | + - name: Install cibuildwheel |
| 28 | + run: | |
| 29 | + python -m pip install --upgrade pip |
| 30 | + python -m pip install cibuildwheel |
| 31 | +
|
| 32 | + - name: Build wheels with cibuildwheel |
| 33 | + env: |
| 34 | + # Build CPython 3.10–3.13 |
| 35 | + CIBW_BUILD: "cp3{10,11,12,13}-*" |
| 36 | + |
| 37 | + # Skip musllinux (Alpine) and PyPy for now |
| 38 | + # muslinux uses libc and not glibc, which may cause compatibility issues |
| 39 | + # specially skip in CUDA projects. Nvidia does not provide CUDA support for Alpine. |
| 40 | + CIBW_SKIP: "pp* *-musllinux_*" |
| 41 | + |
| 42 | + # macOS: build both x86_64 and arm64 wheels |
| 43 | + CIBW_ARCHS_MACOS: "x86_64 arm64" |
| 44 | + |
| 45 | + # Test deps inside cibuildwheel’s test environment |
| 46 | + CIBW_TEST_REQUIRES: "pytest numpy" |
| 47 | + |
| 48 | + # Run tests against the installed wheel |
| 49 | + CIBW_TEST_COMMAND: "pytest -q {project}/tests" |
| 50 | + |
| 51 | + run: | |
| 52 | + cibuildwheel --output-dir wheelhouse |
| 53 | +
|
| 54 | + - name: List built wheels |
| 55 | + run: ls wheelhouse |
| 56 | + |
| 57 | + # Always upload as CI artifacts (handy for debugging / manual download). |
| 58 | + # This is NOT PyPI, it's just stored on GitHub Actions. |
| 59 | + - name: Upload wheels as artifact |
| 60 | + uses: actions/upload-artifact@v4 |
| 61 | + with: |
| 62 | + name: wheels-${{ matrix.os }} |
| 63 | + path: wheelhouse/*.whl |
0 commit comments