@@ -27,11 +27,32 @@ jobs:
2727 runs-on : ubuntu-latest
2828 timeout-minutes : 10
2929 outputs :
30+ # Some of the referenced steps set outputs conditionally and there may be
31+ # cases when referencing them evaluates to empty strings. It is nice to
32+ # work with proper booleans so they have to be evaluated through JSON
33+ # conversion in the expressions. However, empty strings used like that
34+ # may trigger all sorts of undefined and hard-to-debug behaviors in
35+ # GitHub Actions CI/CD. To help with this, all of the outputs set here
36+ # that are meant to be used as boolean flags (and not arbitrary strings),
37+ # MUST have fallbacks with default values set. A common pattern would be
38+ # to add ` || false` to all such expressions here, in the output
39+ # definitions. They can then later be safely used through the following
40+ # idiom in job conditionals and other expressions. Here's some examples:
41+ #
42+ # if: fromJSON(needs.check_source.outputs.run-docs)
43+ #
44+ # ${{
45+ # fromJSON(needs.check_source.outputs.run_tests)
46+ # && 'truthy-branch'
47+ # || 'falsy-branch'
48+ # }}
49+ #
3050 run-docs : ${{ steps.docs-changes.outputs.run-docs || false }}
31- run_tests : ${{ steps.check.outputs.run_tests }}
32- run_hypothesis : ${{ steps.check.outputs.run_hypothesis }}
33- run_cifuzz : ${{ steps.check.outputs.run_cifuzz }}
34- config_hash : ${{ steps.config_hash.outputs.hash }}
51+ run-win-msi : ${{ steps.win-msi-changes.outputs.run-win-msi || false }}
52+ run_tests : ${{ steps.check.outputs.run_tests || false }}
53+ run_hypothesis : ${{ steps.check.outputs.run_hypothesis || false }}
54+ run_cifuzz : ${{ steps.check.outputs.run_cifuzz || false }}
55+ config_hash : ${{ steps.config_hash.outputs.hash }} # str
3556 steps :
3657 - uses : actions/checkout@v4
3758 - name : Check for source changes
@@ -103,6 +124,20 @@ jobs:
103124 id : docs-changes
104125 run : |
105126 echo "run-docs=true" >> "${GITHUB_OUTPUT}"
127+ - name : Get a list of the MSI installer-related files
128+ id : changed-win-msi-files
129+ 130+ with :
131+ filter : |
132+ Tools/msi/**
133+ .github/workflows/reusable-windows-msi.yml
134+ format : csv # works for paths with spaces
135+ - name : Check for changes in MSI installer-related files
136+ if : >-
137+ steps.changed-win-msi-files.outputs.added_modified_renamed != ''
138+ id : win-msi-changes
139+ run : |
140+ echo "run-win-msi=true" >> "${GITHUB_OUTPUT}"
106141
107142 check-docs :
108143 name : Docs
@@ -179,68 +214,89 @@ jobs:
179214 run : make check-c-globals
180215
181216 build_windows :
182- name : ' Windows'
183- needs : check_source
184- if : needs.check_source.outputs.run_tests == 'true'
185- uses : ./.github/workflows/reusable-windows.yml
186-
187- build_windows_free_threading :
188- name : ' Windows (free-threading)'
217+ name : >-
218+ Windows
219+ ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
189220 needs : check_source
190- if : needs.check_source.outputs.run_tests == 'true'
221+ if : fromJSON(needs.check_source.outputs.run_tests)
222+ strategy :
223+ matrix :
224+ arch :
225+ - Win32
226+ - x64
227+ - arm64
228+ free-threading :
229+ - false
230+ - true
191231 uses : ./.github/workflows/reusable-windows.yml
192232 with :
193- free-threading : true
233+ arch : ${{ matrix.arch }}
234+ free-threading : ${{ matrix.free-threading }}
194235
195- build_macos :
196- name : ' macOS'
236+ build_windows_msi :
237+ name : >- # ${{ '' } is a hack to nest jobs under the same sidebar category
238+ Windows MSI${{ '' }}
197239 needs : check_source
198- if : needs.check_source.outputs.run_tests == 'true'
199- uses : ./.github/workflows/reusable-macos.yml
240+ if : fromJSON(needs.check_source.outputs.run-win-msi)
241+ strategy :
242+ matrix :
243+ arch :
244+ - x86
245+ - x64
246+ - arm64
247+ uses : ./.github/workflows/reusable-windows-msi.yml
200248 with :
201- config_hash : ${{ needs.check_source.outputs.config_hash }}
202- # Cirrus and macos-14 are M1, macos-13 is default GHA Intel.
203- # Cirrus used for upstream, macos-14 for forks.
204- os-matrix : ' ["ghcr.io/cirruslabs/macos-runner:sonoma", "macos-14", "macos-13"]'
249+ arch : ${{ matrix.arch }}
205250
206- build_macos_free_threading :
207- name : ' macOS (free-threading)'
251+ build_macos :
252+ name : >-
253+ macOS
254+ ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
208255 needs : check_source
209256 if : needs.check_source.outputs.run_tests == 'true'
257+ strategy :
258+ fail-fast : false
259+ matrix :
260+ # Cirrus and macos-14 are M1, macos-13 is default GHA Intel.
261+ # macOS 13 only runs tests against the GIL-enabled CPython.
262+ # Cirrus used for upstream, macos-14 for forks.
263+ os :
264+ - ghcr.io/cirruslabs/macos-runner:sonoma
265+ - macos-14
266+ - macos-13
267+ is-fork : # only used for the exclusion trick
268+ - ${{ github.repository_owner != 'python' }}
269+ free-threading :
270+ - false
271+ - true
272+ exclude :
273+ - os : ghcr.io/cirruslabs/macos-runner:sonoma
274+ is-fork : true
275+ - os : macos-14
276+ is-fork : false
277+ - os : macos-13
278+ free-threading : true
210279 uses : ./.github/workflows/reusable-macos.yml
211280 with :
212281 config_hash : ${{ needs.check_source.outputs.config_hash }}
213- free-threading : true
214- # Cirrus and macos-14 are M1.
215- # Cirrus used for upstream, macos-14 for forks.
216- os-matrix : ' ["ghcr.io/cirruslabs/macos-runner:sonoma", "macos-14"]'
282+ free-threading : ${{ matrix.free-threading }}
283+ os : ${{ matrix.os }}
217284
218285 build_ubuntu :
219- name : ' Ubuntu'
220- needs : check_source
221- if : needs.check_source.outputs.run_tests == 'true'
222- uses : ./.github/workflows/reusable-ubuntu.yml
223- with :
224- config_hash : ${{ needs.check_source.outputs.config_hash }}
225- options : |
226- ../cpython-ro-srcdir/configure \
227- --config-cache \
228- --with-pydebug \
229- --with-openssl=$OPENSSL_DIR
230-
231- build_ubuntu_free_threading :
232- name : ' Ubuntu (free-threading)'
286+ name : >-
287+ Ubuntu
288+ ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
233289 needs : check_source
234290 if : needs.check_source.outputs.run_tests == 'true'
291+ strategy :
292+ matrix :
293+ free-threading :
294+ - false
295+ - true
235296 uses : ./.github/workflows/reusable-ubuntu.yml
236297 with :
237298 config_hash : ${{ needs.check_source.outputs.config_hash }}
238- options : |
239- ../cpython-ro-srcdir/configure \
240- --config-cache \
241- --with-pydebug \
242- --with-openssl=$OPENSSL_DIR \
243- --disable-gil
299+ free-threading : ${{ matrix.free-threading }}
244300
245301 build_ubuntu_ssltests :
246302 name : ' Ubuntu SSL tests with OpenSSL'
@@ -292,7 +348,7 @@ jobs:
292348 with :
293349 save : false
294350 - name : Configure CPython
295- run : ./configure -- config-cache --with-pydebug --with-openssl=$OPENSSL_DIR
351+ run : ./configure CFLAGS="-fdiagnostics-format=json" -- config-cache --enable-slower-safety --with-pydebug --with-openssl=$OPENSSL_DIR
296352 - name : Build CPython
297353 run : make -j4
298354 - name : Display build info
@@ -365,6 +421,7 @@ jobs:
365421 ../cpython-ro-srcdir/configure \
366422 --config-cache \
367423 --with-pydebug \
424+ --enable-slower-safety \
368425 --with-openssl=$OPENSSL_DIR
369426 - name : Build CPython out-of-tree
370427 working-directory : ${{ env.CPYTHON_BUILDDIR }}
@@ -393,7 +450,7 @@ jobs:
393450 path : ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/
394451 key : hypothesis-database-${{ github.head_ref || github.run_id }}
395452 restore-keys : |
396- - hypothesis-database-
453+ hypothesis-database-
397454 - name : " Run tests"
398455 working-directory : ${{ env.CPYTHON_BUILDDIR }}
399456 run : |
@@ -550,13 +607,11 @@ jobs:
550607 - check-docs
551608 - check_generated_files
552609 - build_macos
553- - build_macos_free_threading
554610 - build_ubuntu
555- - build_ubuntu_free_threading
556611 - build_ubuntu_ssltests
557612 - build_wasi
558613 - build_windows
559- - build_windows_free_threading
614+ - build_windows_msi
560615 - test_hypothesis
561616 - build_asan
562617 - build_tsan
@@ -571,6 +626,7 @@ jobs:
571626 with :
572627 allowed-failures : >-
573628 build_ubuntu_ssltests,
629+ build_windows_msi,
574630 cifuzz,
575631 test_hypothesis,
576632 allowed-skips : >-
@@ -586,13 +642,10 @@ jobs:
586642 && '
587643 check_generated_files,
588644 build_macos,
589- build_macos_free_threading,
590645 build_ubuntu,
591- build_ubuntu_free_threading,
592646 build_ubuntu_ssltests,
593647 build_wasi,
594648 build_windows,
595- build_windows_free_threading,
596649 build_asan,
597650 build_tsan,
598651 build_tsan_free_threading,
0 commit comments