2222  FORCE_COLOR : 1 
2323
2424jobs :
25-   check_source :
25+   build-context :
2626    name : Change detection 
2727    #  To use boolean outputs from this job, parse them as JSON.
2828    #  Here's some examples:
2929    # 
30-     #    if: fromJSON(needs.check_source .outputs.run-docs)
30+     #    if: fromJSON(needs.build-context .outputs.run-docs)
3131    # 
3232    #    ${{
33-     #         fromJSON(needs.check_source .outputs.run_tests )
33+     #         fromJSON(needs.build-context .outputs.run-tests )
3434    #         && 'truthy-branch'
3535    #         || 'falsy-branch'
3636    #    }}
3737    # 
38-     uses : ./.github/workflows/reusable-change-detection .yml 
38+     uses : ./.github/workflows/reusable-context .yml 
3939
4040  check-docs :
4141    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) 
4444    uses : ./.github/workflows/reusable-docs.yml 
4545
4646  check_autoconf_regen :
5151    container :
5252      image : ghcr.io/python/autoconf:2025.01.02.12581854023 
5353    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' 
5656    steps :
5757      - name : Install Git 
5858        run : | 
9494    #  reproducible: to get the same tools versions (autoconf, aclocal, ...)
9595    runs-on : ubuntu-24.04 
9696    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' 
9999    steps :
100100      - uses : actions/checkout@v4 
101101        with :
@@ -110,7 +110,7 @@ jobs:
110110        with :
111111          path : config.cache 
112112          #  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 }} 
114114      - name : Install Dependencies 
115115        run : sudo ./.github/workflows/posix-deps-apt.sh 
116116      - name : Add ccache to PATH 
@@ -153,8 +153,8 @@ jobs:
153153    name : >- 
154154      Windows 
155155      ${{ 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 ) 
158158    strategy :
159159      fail-fast : false 
160160      matrix :
@@ -184,8 +184,8 @@ jobs:
184184  build_windows_msi :
185185    name : >-  #  ${{ '' } is a hack to nest jobs under the same sidebar category 
186186      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) 
189189    strategy :
190190      matrix :
191191        arch :
@@ -200,8 +200,8 @@ jobs:
200200    name : >- 
201201      macOS 
202202      ${{ 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' 
205205    strategy :
206206      fail-fast : false 
207207      matrix :
@@ -226,7 +226,7 @@ jobs:
226226          free-threading : true 
227227    uses : ./.github/workflows/reusable-macos.yml 
228228    with :
229-       config_hash : ${{ needs.check_source .outputs.config_hash  }} 
229+       config_hash : ${{ needs.build-context .outputs.config-hash  }} 
230230      free-threading : ${{ matrix.free-threading }} 
231231      os : ${{ matrix.os }} 
232232
@@ -235,8 +235,8 @@ jobs:
235235      Ubuntu 
236236      ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} 
237237      ${{ 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' 
240240    strategy :
241241      matrix :
242242        bolt :
@@ -247,17 +247,17 @@ jobs:
247247        - true 
248248        os :
249249        - ubuntu-24.04 
250-         - ubuntu-24 .04-arm 
250+         - ubuntu-22 .04-arm 
251251        exclude :
252252        #  Do not test BOLT with free-threading, to conserve resources
253253        - bolt : true 
254254          free-threading : true 
255255        #  BOLT currently crashes during instrumentation on aarch64
256-         - os : ubuntu-24 .04-arm 
256+         - os : ubuntu-22 .04-arm 
257257          bolt : true 
258258    uses : ./.github/workflows/reusable-ubuntu.yml 
259259    with :
260-       config_hash : ${{ needs.check_source .outputs.config_hash  }} 
260+       config_hash : ${{ needs.build-context .outputs.config-hash  }} 
261261      bolt-optimizations : ${{ matrix.bolt }} 
262262      free-threading : ${{ matrix.free-threading }} 
263263      os : ${{ matrix.os }} 
@@ -266,8 +266,8 @@ jobs:
266266    name : ' Ubuntu SSL tests with OpenSSL' 
267267    runs-on : ${{ matrix.os }} 
268268    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' 
271271    strategy :
272272      fail-fast : false 
273273      matrix :
@@ -289,7 +289,7 @@ jobs:
289289      uses : actions/cache@v4 
290290      with :
291291        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  }} 
293293    - name : Register gcc problem matcher 
294294      run : echo "::add-matcher::.github/problem-matchers/gcc.json" 
295295    - name : Install Dependencies 
@@ -326,18 +326,18 @@ jobs:
326326
327327  build_wasi :
328328    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' 
331331    uses : ./.github/workflows/reusable-wasi.yml 
332332    with :
333-       config_hash : ${{ needs.check_source .outputs.config_hash  }} 
333+       config_hash : ${{ needs.build-context .outputs.config-hash  }} 
334334
335335  test_hypothesis :
336336    name : " Hypothesis tests on Ubuntu" 
337337    runs-on : ubuntu-24.04 
338338    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' 
341341    env :
342342      OPENSSL_VER : 3.0.15 
343343      PYTHONSTRICTEXTENSIONBUILD : 1 
@@ -384,7 +384,7 @@ jobs:
384384      uses : actions/cache@v4 
385385      with :
386386        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  }} 
388388    - name : Configure CPython out-of-tree 
389389      working-directory : ${{ env.CPYTHON_BUILDDIR }} 
390390      run : | 
@@ -452,8 +452,8 @@ jobs:
452452    name : ' Address sanitizer' 
453453    runs-on : ${{ matrix.os }} 
454454    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' 
457457    strategy :
458458      matrix :
459459        os : [ubuntu-24.04] 
@@ -471,7 +471,7 @@ jobs:
471471      uses : actions/cache@v4 
472472      with :
473473        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  }} 
475475    - name : Register gcc problem matcher 
476476      run : echo "::add-matcher::.github/problem-matchers/gcc.json" 
477477    - name : Install Dependencies 
@@ -512,34 +512,67 @@ jobs:
512512      run : xvfb-run make ci 
513513
514514  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 
518525    uses : ./.github/workflows/reusable-tsan.yml 
519526    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 }} 
524529
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 
535568
536569#  CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
537570  cifuzz :
538571    name : CIFuzz 
539572    runs-on : ubuntu-latest 
540573    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' 
543576    permissions :
544577      security-events : write 
545578    strategy :
@@ -578,7 +611,7 @@ jobs:
578611    if : always() 
579612
580613    needs :
581-     - check_source   #  Transitive dependency, needed to access `run_tests ` value
614+     - build-context   #  Transitive dependency, needed to access `run-tests ` value
582615    - check-docs 
583616    - check_autoconf_regen 
584617    - check_generated_files 
@@ -591,7 +624,6 @@ jobs:
591624    - test_hypothesis 
592625    - build_asan 
593626    - build_tsan 
594-     - build_tsan_free_threading 
595627    - cifuzz 
596628
597629    runs-on : ubuntu-latest 
@@ -607,14 +639,14 @@ jobs:
607639          test_hypothesis, 
608640allowed-skips : >- 
609641          ${{ 
610-             !fromJSON(needs.check_source .outputs.run-docs) 
642+             !fromJSON(needs.build-context .outputs.run-docs) 
611643            && ' 
612644            check-docs, 
613645            ' 
614646            || '' 
615647          }} 
616648          ${{ 
617-             needs.check_source .outputs.run_tests  != 'true' 
649+             needs.build-context .outputs.run-tests  != 'true' 
618650            && ' 
619651            check_autoconf_regen, 
620652            check_generated_files, 
@@ -625,22 +657,15 @@ jobs:
625657            build_windows, 
626658            build_asan, 
627659            build_tsan, 
628-             build_tsan_free_threading , 
660+             test_hypothesis , 
629661            ' 
630662            || '' 
631663          }} 
632664          ${{ 
633-             !fromJSON(needs.check_source .outputs.run_cifuzz ) 
665+             !fromJSON(needs.build-context .outputs.run-ci-fuzz ) 
634666            && ' 
635667            cifuzz, 
636668            ' 
637669            || '' 
638670          }} 
639-           ${{ 
640-             !fromJSON(needs.check_source.outputs.run_hypothesis) 
641-             && ' 
642-             test_hypothesis, 
643-             ' 
644-             || '' 
645-           }} 
646671jobs : ${{ toJSON(needs) }} 
0 commit comments