22
22
FORCE_COLOR : 1
23
23
24
24
jobs :
25
- check_source :
25
+ build-context :
26
26
name : Change detection
27
27
# To use boolean outputs from this job, parse them as JSON.
28
28
# Here's some examples:
29
29
#
30
- # if: fromJSON(needs.check_source .outputs.run-docs)
30
+ # if: fromJSON(needs.build-context .outputs.run-docs)
31
31
#
32
32
# ${{
33
- # fromJSON(needs.check_source .outputs.run_tests )
33
+ # fromJSON(needs.build-context .outputs.run-tests )
34
34
# && 'truthy-branch'
35
35
# || 'falsy-branch'
36
36
# }}
37
37
#
38
- uses : ./.github/workflows/reusable-change-detection .yml
38
+ uses : ./.github/workflows/reusable-context .yml
39
39
40
40
check-docs :
41
41
name : Docs
42
- needs : check_source
43
- if : fromJSON(needs.check_source .outputs.run-docs)
42
+ needs : build-context
43
+ if : fromJSON(needs.build-context .outputs.run-docs)
44
44
uses : ./.github/workflows/reusable-docs.yml
45
45
46
46
check_autoconf_regen :
51
51
container :
52
52
image : ghcr.io/python/autoconf:2025.01.02.12581854023
53
53
timeout-minutes : 60
54
- needs : check_source
55
- if : needs.check_source .outputs.run_tests == 'true'
54
+ needs : build-context
55
+ if : needs.build-context .outputs.run-tests == 'true'
56
56
steps :
57
57
- name : Install Git
58
58
run : |
94
94
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
95
95
runs-on : ubuntu-24.04
96
96
timeout-minutes : 60
97
- needs : check_source
98
- if : needs.check_source .outputs.run_tests == 'true'
97
+ needs : build-context
98
+ if : needs.build-context .outputs.run-tests == 'true'
99
99
steps :
100
100
- uses : actions/checkout@v4
101
101
with :
@@ -110,7 +110,7 @@ jobs:
110
110
with :
111
111
path : config.cache
112
112
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python
113
- key : ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source .outputs.config_hash }}-${{ env.pythonLocation }}
113
+ key : ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context .outputs.config-hash }}-${{ env.pythonLocation }}
114
114
- name : Install Dependencies
115
115
run : sudo ./.github/workflows/posix-deps-apt.sh
116
116
- name : Add ccache to PATH
@@ -153,8 +153,8 @@ jobs:
153
153
name : >-
154
154
Windows
155
155
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
156
- needs : check_source
157
- if : fromJSON(needs.check_source .outputs.run_tests )
156
+ needs : build-context
157
+ if : fromJSON(needs.build-context .outputs.run-tests )
158
158
strategy :
159
159
fail-fast : false
160
160
matrix :
@@ -184,8 +184,8 @@ jobs:
184
184
build_windows_msi :
185
185
name : >- # ${{ '' } is a hack to nest jobs under the same sidebar category
186
186
Windows MSI${{ '' }}
187
- needs : check_source
188
- if : fromJSON(needs.check_source .outputs.run-win -msi)
187
+ needs : build-context
188
+ if : fromJSON(needs.build-context .outputs.run-windows -msi)
189
189
strategy :
190
190
matrix :
191
191
arch :
@@ -200,8 +200,8 @@ jobs:
200
200
name : >-
201
201
macOS
202
202
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
203
- needs : check_source
204
- if : needs.check_source .outputs.run_tests == 'true'
203
+ needs : build-context
204
+ if : needs.build-context .outputs.run-tests == 'true'
205
205
strategy :
206
206
fail-fast : false
207
207
matrix :
@@ -226,7 +226,7 @@ jobs:
226
226
free-threading : true
227
227
uses : ./.github/workflows/reusable-macos.yml
228
228
with :
229
- config_hash : ${{ needs.check_source .outputs.config_hash }}
229
+ config_hash : ${{ needs.build-context .outputs.config-hash }}
230
230
free-threading : ${{ matrix.free-threading }}
231
231
os : ${{ matrix.os }}
232
232
@@ -235,8 +235,8 @@ jobs:
235
235
Ubuntu
236
236
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
237
237
${{ fromJSON(matrix.bolt) && '(bolt)' || '' }}
238
- needs : check_source
239
- if : needs.check_source .outputs.run_tests == 'true'
238
+ needs : build-context
239
+ if : needs.build-context .outputs.run-tests == 'true'
240
240
strategy :
241
241
matrix :
242
242
bolt :
@@ -257,7 +257,7 @@ jobs:
257
257
bolt : true
258
258
uses : ./.github/workflows/reusable-ubuntu.yml
259
259
with :
260
- config_hash : ${{ needs.check_source .outputs.config_hash }}
260
+ config_hash : ${{ needs.build-context .outputs.config-hash }}
261
261
bolt-optimizations : ${{ matrix.bolt }}
262
262
free-threading : ${{ matrix.free-threading }}
263
263
os : ${{ matrix.os }}
@@ -266,8 +266,8 @@ jobs:
266
266
name : ' Ubuntu SSL tests with OpenSSL'
267
267
runs-on : ${{ matrix.os }}
268
268
timeout-minutes : 60
269
- needs : check_source
270
- if : needs.check_source .outputs.run_tests == 'true'
269
+ needs : build-context
270
+ if : needs.build-context .outputs.run-tests == 'true'
271
271
strategy :
272
272
fail-fast : false
273
273
matrix :
@@ -289,7 +289,7 @@ jobs:
289
289
uses : actions/cache@v4
290
290
with :
291
291
path : config.cache
292
- key : ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source .outputs.config_hash }}
292
+ key : ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context .outputs.config-hash }}
293
293
- name : Register gcc problem matcher
294
294
run : echo "::add-matcher::.github/problem-matchers/gcc.json"
295
295
- name : Install Dependencies
@@ -326,18 +326,18 @@ jobs:
326
326
327
327
build_wasi :
328
328
name : ' WASI'
329
- needs : check_source
330
- if : needs.check_source .outputs.run_tests == 'true'
329
+ needs : build-context
330
+ if : needs.build-context .outputs.run-tests == 'true'
331
331
uses : ./.github/workflows/reusable-wasi.yml
332
332
with :
333
- config_hash : ${{ needs.check_source .outputs.config_hash }}
333
+ config_hash : ${{ needs.build-context .outputs.config-hash }}
334
334
335
335
test_hypothesis :
336
336
name : " Hypothesis tests on Ubuntu"
337
337
runs-on : ubuntu-24.04
338
338
timeout-minutes : 60
339
- needs : check_source
340
- if : needs.check_source .outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
339
+ needs : build-context
340
+ if : needs.build-context .outputs.run-tests == 'true'
341
341
env :
342
342
OPENSSL_VER : 3.0.15
343
343
PYTHONSTRICTEXTENSIONBUILD : 1
@@ -384,7 +384,7 @@ jobs:
384
384
uses : actions/cache@v4
385
385
with :
386
386
path : ${{ env.CPYTHON_BUILDDIR }}/config.cache
387
- key : ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source .outputs.config_hash }}
387
+ key : ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context .outputs.config-hash }}
388
388
- name : Configure CPython out-of-tree
389
389
working-directory : ${{ env.CPYTHON_BUILDDIR }}
390
390
run : |
@@ -452,8 +452,8 @@ jobs:
452
452
name : ' Address sanitizer'
453
453
runs-on : ${{ matrix.os }}
454
454
timeout-minutes : 60
455
- needs : check_source
456
- if : needs.check_source .outputs.run_tests == 'true'
455
+ needs : build-context
456
+ if : needs.build-context .outputs.run-tests == 'true'
457
457
strategy :
458
458
matrix :
459
459
os : [ubuntu-24.04]
@@ -471,7 +471,7 @@ jobs:
471
471
uses : actions/cache@v4
472
472
with :
473
473
path : config.cache
474
- key : ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source .outputs.config_hash }}
474
+ key : ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context .outputs.config-hash }}
475
475
- name : Register gcc problem matcher
476
476
run : echo "::add-matcher::.github/problem-matchers/gcc.json"
477
477
- name : Install Dependencies
@@ -512,34 +512,67 @@ jobs:
512
512
run : xvfb-run make ci
513
513
514
514
build_tsan :
515
- name : ' Thread sanitizer'
516
- needs : check_source
517
- if : needs.check_source.outputs.run_tests == 'true'
515
+ name : >-
516
+ Thread sanitizer
517
+ ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
518
+ needs : build-context
519
+ if : needs.build-context.outputs.run-tests == 'true'
520
+ strategy :
521
+ matrix :
522
+ free-threading :
523
+ - false
524
+ - true
518
525
uses : ./.github/workflows/reusable-tsan.yml
519
526
with :
520
- config_hash : ${{ needs.check_source.outputs.config_hash }}
521
- options : ./configure --config-cache --with-thread-sanitizer --with-pydebug
522
- suppressions_path : Tools/tsan/supressions.txt
523
- tsan_logs_artifact_name : tsan-logs-default
527
+ config_hash : ${{ needs.build-context.outputs.config-hash }}
528
+ free-threading : ${{ matrix.free-threading }}
524
529
525
- build_tsan_free_threading :
526
- name : ' Thread sanitizer (free-threading)'
527
- needs : check_source
528
- if : needs.check_source.outputs.run_tests == 'true'
529
- uses : ./.github/workflows/reusable-tsan.yml
530
- with :
531
- config_hash : ${{ needs.check_source.outputs.config_hash }}
532
- options : ./configure --config-cache --disable-gil --with-thread-sanitizer --with-pydebug
533
- suppressions_path : Tools/tsan/suppressions_free_threading.txt
534
- tsan_logs_artifact_name : tsan-logs-free-threading
530
+ cross-build-linux :
531
+ name : Cross build Linux
532
+ runs-on : ubuntu-latest
533
+ needs : build-context
534
+ if : needs.build-context.outputs.run-tests == 'true'
535
+ steps :
536
+ - uses : actions/checkout@v4
537
+ with :
538
+ persist-credentials : false
539
+ - name : Runner image version
540
+ run : echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
541
+ - name : Restore config.cache
542
+ uses : actions/cache@v4
543
+ with :
544
+ path : config.cache
545
+ key : ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context.outputs.config-hash }}
546
+ - name : Register gcc problem matcher
547
+ run : echo "::add-matcher::.github/problem-matchers/gcc.json"
548
+ - name : Set build dir
549
+ run :
550
+ # an absolute path outside of the working directoy
551
+ echo "BUILD_DIR=$(realpath ${{ github.workspace }}/../build)" >> "$GITHUB_ENV"
552
+ - name : Install Dependencies
553
+ run : sudo ./.github/workflows/posix-deps-apt.sh
554
+ - name : Configure host build
555
+ run : ./configure --prefix="$BUILD_DIR/host-python"
556
+ - name : Install host Python
557
+ run : make -j8 install
558
+ - name : Run test subset with host build
559
+ run : |
560
+ "$BUILD_DIR/host-python/bin/python3" -m test test_sysconfig test_site test_embed
561
+ - name : Configure cross build
562
+ run : ./configure --prefix="$BUILD_DIR/cross-python" --with-build-python="$BUILD_DIR/host-python/bin/python3"
563
+ - name : Install cross Python
564
+ run : make -j8 install
565
+ - name : Run test subset with host build
566
+ run : |
567
+ "$BUILD_DIR/cross-python/bin/python3" -m test test_sysconfig test_site test_embed
535
568
536
569
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
537
570
cifuzz :
538
571
name : CIFuzz
539
572
runs-on : ubuntu-latest
540
573
timeout-minutes : 60
541
- needs : check_source
542
- if : needs.check_source .outputs.run_cifuzz == 'true'
574
+ needs : build-context
575
+ if : needs.build-context .outputs.run-ci-fuzz == 'true'
543
576
permissions :
544
577
security-events : write
545
578
strategy :
@@ -578,7 +611,7 @@ jobs:
578
611
if : always()
579
612
580
613
needs :
581
- - check_source # Transitive dependency, needed to access `run_tests ` value
614
+ - build-context # Transitive dependency, needed to access `run-tests ` value
582
615
- check-docs
583
616
- check_autoconf_regen
584
617
- check_generated_files
@@ -591,7 +624,6 @@ jobs:
591
624
- test_hypothesis
592
625
- build_asan
593
626
- build_tsan
594
- - build_tsan_free_threading
595
627
- cifuzz
596
628
597
629
runs-on : ubuntu-latest
@@ -607,14 +639,14 @@ jobs:
607
639
test_hypothesis,
608
640
allowed-skips : >-
609
641
${{
610
- !fromJSON(needs.check_source .outputs.run-docs)
642
+ !fromJSON(needs.build-context .outputs.run-docs)
611
643
&& '
612
644
check-docs,
613
645
'
614
646
|| ''
615
647
}}
616
648
${{
617
- needs.check_source .outputs.run_tests != 'true'
649
+ needs.build-context .outputs.run-tests != 'true'
618
650
&& '
619
651
check_autoconf_regen,
620
652
check_generated_files,
@@ -625,22 +657,15 @@ jobs:
625
657
build_windows,
626
658
build_asan,
627
659
build_tsan,
628
- build_tsan_free_threading ,
660
+ test_hypothesis ,
629
661
'
630
662
|| ''
631
663
}}
632
664
${{
633
- !fromJSON(needs.check_source .outputs.run_cifuzz )
665
+ !fromJSON(needs.build-context .outputs.run-ci-fuzz )
634
666
&& '
635
667
cifuzz,
636
668
'
637
669
|| ''
638
670
}}
639
- ${{
640
- !fromJSON(needs.check_source.outputs.run_hypothesis)
641
- && '
642
- test_hypothesis,
643
- '
644
- || ''
645
- }}
646
671
jobs : ${{ toJSON(needs) }}
0 commit comments