|
| 1 | +--- |
1 | 2 | name: Build and upload to PyPI |
2 | 3 |
|
3 | 4 | concurrency: |
|
18 | 19 | - reopened |
19 | 20 | - labeled |
20 | 21 |
|
| 22 | +permissions: |
| 23 | + contents: read |
| 24 | + |
21 | 25 | jobs: |
22 | 26 | build_sdist: |
23 | | - if: | |
| 27 | + if: >- |
24 | 28 | github.event_name == 'release' || |
25 | 29 | (github.event_name == 'pull_request' && ( |
26 | 30 | ( |
@@ -67,62 +71,47 @@ jobs: |
67 | 71 | path: dist/*.tar.gz |
68 | 72 | if-no-files-found: error |
69 | 73 |
|
70 | | - generate-wheels-matrix: |
71 | | - name: Generate wheels matrix |
72 | | - needs: [build_sdist] |
73 | | - runs-on: ubuntu-latest |
74 | | - outputs: |
75 | | - include: ${{ steps.set-matrix.outputs.include }} |
76 | | - steps: |
77 | | - - uses: actions/checkout@v4 |
78 | | - - name: Install cibuildwheel |
79 | | - run: pipx install cibuildwheel==2.16.2 |
80 | | - - id: set-matrix |
81 | | - run: | |
82 | | - MATRIX=$( |
83 | | - { |
84 | | - cibuildwheel --print-build-identifiers --platform linux \ |
85 | | - | jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \ |
86 | | - && cibuildwheel --print-build-identifiers --platform macos \ |
87 | | - | jq -nRc '{"only": inputs, "os": "macos-latest"}' \ |
88 | | - && cibuildwheel --print-build-identifiers --platform windows \ |
89 | | - | jq -nRc '{"only": inputs, "os": "windows-2019"}' |
90 | | - } | jq -sc |
91 | | - ) |
92 | | - echo "include=$MATRIX" >> $GITHUB_OUTPUT |
93 | | - env: |
94 | | - CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*" |
95 | | - # Skip 32 bit builds and musllinux due to lack of numpy wheels |
96 | | - CIBW_SKIP: "*-win32 *_i686 *-musllinux*" |
97 | | - CIBW_ARCHS_MACOS: x86_64 arm64 |
98 | | - |
99 | 74 | build_wheels: |
100 | | - name: Build ${{ matrix.os }} ${{ matrix.only }} |
101 | | - needs: [generate-wheels-matrix, build_sdist] |
| 75 | + needs: build_sdist |
| 76 | + name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }} |
| 77 | + runs-on: ${{ matrix.os }} |
102 | 78 | strategy: |
103 | 79 | matrix: |
104 | | - include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }} |
105 | | - runs-on: ${{ matrix.os }} |
| 80 | + include: |
| 81 | + - os: ubuntu-latest |
| 82 | + cibw_archs: "x86_64" |
| 83 | + - os: windows-2019 |
| 84 | + cibw_archs: "auto64" |
| 85 | + - os: macos-latest |
| 86 | + cibw_archs: "x86_64" |
| 87 | + - os: macos-latest |
| 88 | + cibw_archs: "arm64" |
106 | 89 | defaults: |
107 | 90 | run: |
108 | 91 | shell: bash |
109 | | - steps: |
110 | 92 |
|
| 93 | + steps: |
111 | 94 | - name: Download sdist |
112 | 95 | uses: actions/download-artifact@v4 |
113 | 96 | with: |
114 | 97 | name: cibw-sdist |
115 | 98 | path: dist |
116 | 99 |
|
117 | | - - uses: pypa/cibuildwheel@f1859528322d7b29d4493ee241a167807661dfb4 # v2.21.2 |
| 100 | + - name: Build wheels for CPython |
| 101 | + uses: pypa/cibuildwheel@f1859528322d7b29d4493ee241a167807661dfb4 # v2.21.2 |
118 | 102 | with: |
119 | | - only: ${{ matrix.only }} |
120 | 103 | package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} |
| 104 | + env: |
| 105 | + CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*" |
| 106 | + # Skip 32 bit builds and musllinux due to lack of numpy wheels |
| 107 | + CIBW_SKIP: "*-win32 *_i686 *-musllinux*" |
| 108 | + CIBW_ARCHS: ${{ matrix.cibw_archs }} |
121 | 109 |
|
122 | 110 | - uses: actions/upload-artifact@v4 |
123 | 111 | with: |
124 | | - name: cibw-wheels-${{ matrix.os }}-${{ matrix.only }} |
| 112 | + name: cibw-wheels-${{ matrix.os }}-${{ matrix.cibw_archs }} |
125 | 113 | path: ./wheelhouse/*.whl |
| 114 | + if-no-files-found: error |
126 | 115 |
|
127 | 116 | publish: |
128 | 117 | name: Publish to PyPI |
|
0 commit comments