|
10 | 10 |
|
11 | 11 | jobs:
|
12 | 12 | build_sdist:
|
13 |
| - name: Build SDist |
14 | 13 | runs-on: ubuntu-latest
|
15 | 14 | steps:
|
16 |
| - - uses: actions/checkout@v4 |
17 |
| - with: |
18 |
| - submodules: true |
19 |
| - |
20 |
| - - name: Build SDist |
21 |
| - run: pipx run build --sdist |
22 |
| - |
23 |
| - - name: Check metadata |
24 |
| - run: pipx run twine check dist/* |
25 |
| - |
26 |
| - - uses: actions/upload-artifact@v4 |
27 |
| - with: |
28 |
| - name: dist-sdist |
29 |
| - path: dist/*.tar.gz |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + with: |
| 17 | + submodules: true |
| 18 | + - run: pipx run build --sdist |
| 19 | + - run: pipx run twine check dist/* || exit 1 # Ensure failure on twine check errors |
| 20 | + - uses: actions/upload-artifact@v4 |
| 21 | + with: |
| 22 | + name: dist-sdist |
| 23 | + path: dist/*.tar.gz |
30 | 24 |
|
31 | 25 | build_wheels:
|
32 |
| - name: Build ${{ matrix.cpversion }} wheels on ${{ matrix.os }} |
33 | 26 | runs-on: ${{ matrix.os }}
|
34 | 27 | strategy:
|
35 | 28 | fail-fast: false
|
36 | 29 | matrix:
|
37 |
| - os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-14] |
38 |
| - # cp313 seemed to produce the same wheel name as cp312. Skip unless |
39 |
| - # necessary. |
40 |
| - cpversion: [cp38, cp39, cp310, cp311, cp312] |
41 |
| - # github actions cp38 on macos-14 runners are cross compiling or |
42 |
| - # something and confusing the stub generation. Just skip it for now. |
43 |
| - # Maybe it'd be friendlier to disable the stub generation for this |
44 |
| - # combination. |
| 30 | + os: [ubuntu-24.04, ubuntu-24.04-arm, macos-14, macos-13, windows-latest] # Use specific versions for clarity |
| 31 | + arch: [x86_64, arm64] |
| 32 | + pybuilds: [cp38, cp39, cp310, cp311, cp312] # Define pybuilds at the top level |
45 | 33 | exclude:
|
46 |
| - - os: macos-14 |
47 |
| - cpversion: cp38 |
48 |
| - |
| 34 | + - os: ubuntu-24.04-arm # No need to specify arch, it's already implicit |
| 35 | + arch: x86_64 # Exclude x86_64 on ARM |
| 36 | + - os: macos-14 # Exclude macOS 14 (Sonoma) |
| 37 | + arch: x86_64 # Exclude x86_64 explicitly |
| 38 | + - os: macos-14 # Exclude cp38 |
| 39 | + pybuilds: cp38 |
| 40 | + - os: macos-13 # Exclude macOS 13 (Ventura) - arm64 |
| 41 | + arch: arm64 # Exclude arm64 on macOS 13 |
| 42 | + - os: macos-13 |
| 43 | + pybuilds: cp38 |
49 | 44 |
|
50 | 45 | steps:
|
51 | 46 | - uses: actions/checkout@v4
|
52 |
| - |
53 | 47 | - uses: actions/setup-python@v5
|
54 | 48 | with:
|
55 | 49 | python-version: '3.12'
|
56 |
| - |
57 |
| - - name: Install cibuildwheel |
58 |
| - run: python -m pip install cibuildwheel==2.22.0 |
59 |
| - |
60 |
| - - name: Build wheels |
61 |
| - # why do I need to specify this cpversion here? |
| 50 | + - run: pip install cibuildwheel==2.22.0 |
| 51 | + - run: python -m cibuildwheel --output-dir wheelhouse |
62 | 52 | env:
|
63 |
| - CIBW_ARCHS: "auto64" |
64 |
| - CIBW_BUILD: "${{ matrix.cpversion }}-*" |
65 |
| - # why isn't auto64 working? |
66 |
| - CIBW_SKIP: "cp*-manylinux_i686 cp*-musllinux* cp*-win32" |
67 |
| - run: python -m cibuildwheel --output-dir wheelhouse |
68 |
| - |
69 |
| - - uses: actions/upload-artifact@v4 |
| 53 | + CIBW_BUILD: "${{ matrix.pybuilds }}-*" # Use matrix.pybuilds and matrix.arch |
| 54 | + CIBW_ARCHS_MACOS: ${{ matrix.arch }} |
| 55 | + CIBW_SKIP: "cp*-manylinux_i686 cp*-musllinux* cp*-win32" |
| 56 | + - name: Upload Artifact |
| 57 | + uses: actions/upload-artifact@v4 |
| 58 | + continue-on-error: true # Important: Continue if upload fails |
70 | 59 | with:
|
71 |
| - name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
| 60 | + # Include pybuilds in the artifact name |
| 61 | + name: wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.pybuilds }} |
72 | 62 | path: ./wheelhouse/*.whl
|
| 63 | + if-no-files-found: error # Fail if no wheels are found |
| 64 | + compression-level: 6 |
| 65 | + overwrite: false |
| 66 | + include-hidden-files: false |
| 67 | + |
| 68 | + release_artifacts: |
| 69 | + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') |
| 70 | + needs: build_wheels |
| 71 | + runs-on: ubuntu-latest |
| 72 | + permissions: |
| 73 | + id-token: write |
| 74 | + contents: write |
| 75 | + steps: |
| 76 | + - uses: actions/download-artifact@v4 |
| 77 | + with: |
| 78 | + path: ./artifacts |
| 79 | + merge-multiple: true |
| 80 | + - run: ls -R ./artifacts |
| 81 | + - uses: ncipollo/release-action@v1 |
| 82 | + with: |
| 83 | + allowUpdates: true |
| 84 | + artifacts: "./artifacts/**/*" |
| 85 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 86 | + |
| 87 | + with: |
| 88 | + packages-dir: ./artifacts |
0 commit comments