|
11 | 11 | workflow_dispatch: |
12 | 12 |
|
13 | 13 | env: |
14 | | - PYTHON_VER: "3.11" # Python to run test/cibuildwheel |
15 | | - CIBW_BUILD: > |
16 | | - cp310-* cp311-* cp312-* cp313-* cp313t-* cp314-* cp314t-* |
17 | | - pp310-* pp311-* |
18 | | - CIBW_ENABLE: cpython-freethreading pypy pypy-eol |
19 | | - CIBW_TEST_COMMAND: python -m unittest discover {project}/tests |
| 14 | + PY_COLORS: 1 |
20 | 15 |
|
21 | 16 | jobs: |
22 | | - test_cpython: |
23 | | - name: Test on ${{ matrix.platform }} ${{ matrix.architecture }} ${{ matrix.build_option }} |
24 | | - runs-on: ${{ matrix.platform }} |
25 | | - |
26 | | - strategy: |
27 | | - matrix: |
28 | | - platform: |
29 | | - - ubuntu-latest |
30 | | - - macos-latest |
31 | | - - windows-latest |
32 | | - build_option: |
33 | | - - "--warning-as-error" |
34 | | - - "--warning-as-error --multi-phase-init" |
35 | | - - "--warning-as-error --cffi" |
36 | | - architecture: |
37 | | - - x64 |
38 | | - include: |
39 | | - - platform: windows-latest |
40 | | - build_option: "--warning-as-error" |
41 | | - architecture: x86 |
42 | | - - platform: windows-latest |
43 | | - build_option: "--warning-as-error --multi-phase-init" |
44 | | - architecture: x86 |
45 | | - - platform: windows-latest |
46 | | - build_option: "--warning-as-error --cffi" |
47 | | - architecture: x86 |
48 | | - |
49 | | - steps: |
50 | | - - uses: actions/checkout@v4 |
51 | | - with: |
52 | | - submodules: true |
53 | | - |
54 | | - - uses: actions/setup-python@v5 |
55 | | - with: |
56 | | - python-version: ${{ env.PYTHON_VER }} |
57 | | - architecture: ${{ matrix.architecture }} |
58 | | - |
59 | | - - name: Run test |
60 | | - run: | |
61 | | - python -m pip install cffi |
62 | | - python -m pip install --config-settings="--build-option=${{ matrix.build_option }}" -vv . |
63 | | - python -m unittest discover tests |
64 | | -
|
65 | | - test_cpython_debug: |
66 | | - name: Test debug build on Ubuntu ${{ matrix.build_option }} |
67 | | - runs-on: ubuntu-latest |
68 | | - |
69 | | - strategy: |
70 | | - matrix: |
71 | | - build_option: |
72 | | - - "--warning-as-error --debug" |
73 | | - - "--warning-as-error --debug --multi-phase-init" |
74 | | - |
75 | | - steps: |
76 | | - - uses: actions/checkout@v4 |
77 | | - with: |
78 | | - submodules: true |
79 | | - |
80 | | - - name: Run test |
81 | | - run: | |
82 | | - sudo apt-get update |
83 | | - sudo apt-get install python3-dbg |
84 | | - python3-dbg -m pip install --config-settings="--build-option=${{ matrix.build_option }}" -vv . |
85 | | - python3-dbg -m unittest discover tests |
86 | | -
|
87 | | - test_pypy: |
88 | | - name: Test on ${{ matrix.py }} |
89 | | - runs-on: ubuntu-latest |
90 | | - |
91 | | - strategy: |
92 | | - matrix: |
93 | | - py: |
94 | | - - "pypy-3.10" |
95 | | - - "pypy-3.11" |
96 | | - |
97 | | - steps: |
98 | | - - uses: actions/checkout@v4 |
99 | | - with: |
100 | | - submodules: true |
101 | | - |
102 | | - - uses: actions/setup-python@v5 |
103 | | - with: |
104 | | - python-version: ${{ matrix.py }} |
105 | | - |
106 | | - - name: Build & test |
107 | | - run: | |
108 | | - sudo apt-get install -q -y zstd libzstd1 libzstd-dev |
109 | | - python -m pip install --config-settings="--build-option=--dynamic-link-zstd --warning-as-error" -v . |
110 | | - python -m unittest discover tests |
111 | | -
|
112 | | - build_sdist: |
113 | | - name: Build sdist |
114 | | - if: startsWith(github.ref, 'refs/tags') || startsWith(github.head_ref, 'release-') || github.event_name == 'workflow_dispatch' |
| 17 | + build: |
| 18 | + name: Build |
115 | 19 | runs-on: ubuntu-latest |
116 | | - |
117 | 20 | steps: |
118 | | - - uses: actions/checkout@v4 |
119 | | - with: |
120 | | - submodules: true |
121 | | - |
122 | | - - uses: actions/setup-python@v5 |
123 | | - with: |
124 | | - python-version: ${{ env.PYTHON_VER }} |
125 | | - |
126 | | - - name: Build sdist |
127 | | - run: | |
128 | | - python -m pip install -U build |
129 | | - python -m build --sdist |
130 | | -
|
| 21 | + - uses: actions/checkout@v6 |
| 22 | + with: |
| 23 | + # fetch all commits for version computation |
| 24 | + fetch-depth: 0 |
| 25 | + - name: Setup Python |
| 26 | + uses: actions/setup-python@v6 |
| 27 | + with: |
| 28 | + python-version: "3.14" |
| 29 | + - name: Install dependencies |
| 30 | + run: python -m pip install -U build |
| 31 | + - name: Build |
| 32 | + run: python -m build |
131 | 33 | - name: List distributions |
132 | 34 | run: ls -lR dist |
133 | | - |
134 | | - - name: Upload sdist |
135 | | - uses: actions/upload-artifact@v4 |
136 | | - with: |
137 | | - name: cibw-sdist |
138 | | - path: dist/*.tar.gz |
139 | | - |
140 | | - build_wheels: |
141 | | - name: Build wheels on ${{ matrix.platform }} |
142 | | - if: startsWith(github.ref, 'refs/tags') || startsWith(github.head_ref, 'release-') || github.event_name == 'workflow_dispatch' |
143 | | - runs-on: ${{ matrix.platform }} |
144 | | - |
145 | | - strategy: |
146 | | - matrix: |
147 | | - platform: |
148 | | - - ubuntu-latest |
149 | | - - macos-latest |
150 | | - - windows-latest |
151 | | - - windows-11-arm |
152 | | - |
153 | | - env: |
154 | | - CIBW_ARCHS_MACOS: "x86_64 arm64" |
155 | | - |
156 | | - steps: |
157 | | - - uses: actions/checkout@v4 |
158 | | - with: |
159 | | - submodules: true |
160 | | - |
161 | | - - uses: actions/setup-python@v5 |
162 | | - with: |
163 | | - python-version: ${{ env.PYTHON_VER }} |
164 | | - |
165 | | - - name: Build wheels |
166 | | - run: | |
167 | | - python -m pip install -U cibuildwheel |
168 | | - python -m cibuildwheel --output-dir wheelhouse |
169 | | -
|
170 | | - - name: List distributions |
171 | | - run: ls -lR wheelhouse |
172 | | - shell: bash |
173 | | - |
174 | | - - name: Upload wheels |
175 | | - uses: actions/upload-artifact@v4 |
| 35 | + - name: Save build artifacts |
| 36 | + uses: actions/upload-artifact@v5 |
176 | 37 | with: |
177 | | - name: cibw-wheels-${{ matrix.platform }} |
178 | | - path: wheelhouse/*.whl |
| 38 | + name: build |
| 39 | + path: dist |
| 40 | + - name: Install sdist |
| 41 | + run: python -m pip install dist/*.tar.gz |
| 42 | + - name: Test |
| 43 | + run: python -m unittest discover tests -v |
179 | 44 |
|
180 | | - build_arch_wheels: |
181 | | - name: Build wheels for ${{ matrix.arch }} (skip ${{ matrix.skip_image }}) |
182 | | - if: startsWith(github.ref, 'refs/tags') || startsWith(github.head_ref, 'release-') || github.event_name == 'workflow_dispatch' |
| 45 | + tests-py: |
| 46 | + name: Test | ${{ matrix.python }} |
183 | 47 | runs-on: ubuntu-latest |
184 | | - |
| 48 | + needs: |
| 49 | + - build |
185 | 50 | strategy: |
186 | 51 | matrix: |
187 | | - arch: |
188 | | - - aarch64 |
189 | | - - ppc64le |
190 | | - - s390x |
191 | | - # Building in QEMU is very slow, so parallelize the tasks. |
192 | | - skip_image: |
193 | | - - musllinux |
194 | | - - manylinux |
195 | | - |
196 | | - env: |
197 | | - CIBW_ARCHS: ${{ matrix.arch }} |
198 | | - CIBW_SKIP: "*${{ matrix.skip_image }}*" |
199 | | - |
| 52 | + python: |
| 53 | + - "3.10" |
| 54 | + - "3.11" |
| 55 | + - "3.12" |
| 56 | + - "3.13" |
| 57 | + - "3.14" |
| 58 | + - "pypy-3.10" |
| 59 | + - "pypy-3.11" |
200 | 60 | steps: |
201 | | - - uses: actions/checkout@v4 |
| 61 | + - uses: actions/checkout@v6 |
| 62 | + - name: Restore build artifacts |
| 63 | + uses: actions/download-artifact@v6 |
202 | 64 | with: |
203 | | - submodules: true |
204 | | - - uses: actions/setup-python@v5 |
205 | | - with: |
206 | | - python-version: ${{ env.PYTHON_VER }} |
207 | | - |
208 | | - - name: Set up QEMU |
209 | | - uses: docker/setup-qemu-action@v3 |
210 | | - |
211 | | - - name: Build wheels |
212 | | - run: | |
213 | | - python -m pip install -U cibuildwheel |
214 | | - python -m cibuildwheel --output-dir wheelhouse |
215 | | -
|
216 | | - - name: List distributions |
217 | | - run: ls -lR wheelhouse |
218 | | - |
219 | | - - name: Upload wheels |
220 | | - uses: actions/upload-artifact@v4 |
| 65 | + name: build |
| 66 | + path: dist |
| 67 | + - name: Setup Python ${{ matrix.python }} |
| 68 | + uses: actions/setup-python@v6 |
221 | 69 | with: |
222 | | - name: cibw-wheels-${{ matrix.arch }}-${{ matrix.skip_image }} |
223 | | - path: wheelhouse/*.whl |
| 70 | + python-version: ${{ matrix.python }} |
| 71 | + - name: Install wheel |
| 72 | + run: python -m pip install dist/*.whl |
| 73 | + - name: Test |
| 74 | + run: python -m unittest discover tests -v |
224 | 75 |
|
225 | | - upload_pypi: |
| 76 | + publish: |
226 | 77 | name: Publish to PyPI |
227 | 78 | if: startsWith(github.ref, 'refs/tags') |
228 | 79 | needs: |
229 | | - - build_sdist |
230 | | - - build_wheels |
231 | | - - build_arch_wheels |
| 80 | + - build |
| 81 | + - tests-py |
232 | 82 | runs-on: ubuntu-latest |
233 | 83 | environment: publish |
234 | 84 | permissions: |
235 | 85 | id-token: write # This permission is mandatory for trusted publishing |
236 | | - |
237 | 86 | steps: |
238 | | - - name: Download wheels |
239 | | - uses: actions/download-artifact@v4 |
| 87 | + - name: Restore build artifacts |
| 88 | + uses: actions/download-artifact@v6 |
240 | 89 | with: |
241 | | - pattern: cibw-* |
| 90 | + name: build |
242 | 91 | path: dist |
243 | | - merge-multiple: true |
244 | | - |
245 | 92 | - name: List distributions |
246 | 93 | run: ls -lR dist |
247 | | - |
248 | | - - name: Upload to PyPI |
| 94 | + - name: Publish to PyPI |
249 | 95 | uses: pypa/gh-action-pypi-publish@release/v1 |
250 | 96 | with: |
251 | | - skip-existing: true |
252 | 97 | verbose: true |
253 | 98 | print-hash: true |
0 commit comments