@@ -27,11 +27,31 @@ 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_tests : ${{ steps.check.outputs.run_tests || false }}
52+ run_hypothesis : ${{ steps.check.outputs.run_hypothesis || false }}
53+ run_cifuzz : ${{ steps.check.outputs.run_cifuzz || false }}
54+ config_hash : ${{ steps.config_hash.outputs.hash }} # str
3555 steps :
3656 - uses : actions/checkout@v4
3757 - name : Check for source changes
@@ -179,18 +199,24 @@ jobs:
179199 run : make check-c-globals
180200
181201 build_windows :
182- name : ' Windows'
202+ name : >-
203+ Windows
204+ ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
183205 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)'
189- needs : check_source
190- if : needs.check_source.outputs.run_tests == 'true'
206+ if : fromJSON(needs.check_source.outputs.run_tests)
207+ strategy :
208+ matrix :
209+ arch :
210+ - Win32
211+ - x64
212+ - arm64
213+ free-threading :
214+ - false
215+ - true
191216 uses : ./.github/workflows/reusable-windows.yml
192217 with :
193- free-threading : true
218+ arch : ${{ matrix.arch }}
219+ free-threading : ${{ matrix.free-threading }}
194220
195221 build_macos :
196222 name : ' macOS'
@@ -216,31 +242,20 @@ jobs:
216242 os-matrix : ' ["ghcr.io/cirruslabs/macos-runner:sonoma", "macos-14"]'
217243
218244 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)'
245+ name : >-
246+ Ubuntu
247+ ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
233248 needs : check_source
234249 if : needs.check_source.outputs.run_tests == 'true'
250+ strategy :
251+ matrix :
252+ free-threading :
253+ - false
254+ - true
235255 uses : ./.github/workflows/reusable-ubuntu.yml
236256 with :
237257 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
258+ free-threading : ${{ matrix.free-threading }}
244259
245260 build_ubuntu_ssltests :
246261 name : ' Ubuntu SSL tests with OpenSSL'
@@ -393,7 +408,7 @@ jobs:
393408 path : ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/
394409 key : hypothesis-database-${{ github.head_ref || github.run_id }}
395410 restore-keys : |
396- - hypothesis-database-
411+ hypothesis-database-
397412 - name : " Run tests"
398413 working-directory : ${{ env.CPYTHON_BUILDDIR }}
399414 run : |
@@ -552,11 +567,9 @@ jobs:
552567 - build_macos
553568 - build_macos_free_threading
554569 - build_ubuntu
555- - build_ubuntu_free_threading
556570 - build_ubuntu_ssltests
557571 - build_wasi
558572 - build_windows
559- - build_windows_free_threading
560573 - test_hypothesis
561574 - build_asan
562575 - build_tsan
@@ -588,11 +601,9 @@ jobs:
588601 build_macos,
589602 build_macos_free_threading,
590603 build_ubuntu,
591- build_ubuntu_free_threading,
592604 build_ubuntu_ssltests,
593605 build_wasi,
594606 build_windows,
595- build_windows_free_threading,
596607 build_asan,
597608 build_tsan,
598609 build_tsan_free_threading,
0 commit comments