Skip to content

Commit 832787a

Browse files
[3.13] pythongh-142278: Add granular change detection for platforms in CI (pythonGH-142350)
(cherry picked from commit 9e3d7cd) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent 2b0ccce commit 832787a

File tree

2 files changed

+44
-36
lines changed

2 files changed

+44
-36
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ jobs:
241241
macOS
242242
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
243243
needs: build-context
244-
if: needs.build-context.outputs.run-tests == 'true'
244+
if: needs.build-context.outputs.run-macos == 'true'
245245
strategy:
246246
fail-fast: false
247247
matrix:
@@ -266,7 +266,7 @@ jobs:
266266
Ubuntu
267267
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
268268
needs: build-context
269-
if: needs.build-context.outputs.run-tests == 'true'
269+
if: needs.build-context.outputs.run-ubuntu == 'true'
270270
strategy:
271271
fail-fast: false
272272
matrix:
@@ -282,7 +282,7 @@ jobs:
282282
runs-on: ${{ matrix.os }}
283283
timeout-minutes: 60
284284
needs: build-context
285-
if: needs.build-context.outputs.run-tests == 'true'
285+
if: needs.build-context.outputs.run-ubuntu == 'true'
286286
strategy:
287287
fail-fast: false
288288
matrix:
@@ -335,7 +335,7 @@ jobs:
335335
build-android:
336336
name: Android (${{ matrix.arch }})
337337
needs: build-context
338-
if: needs.build-context.outputs.run-tests == 'true'
338+
if: needs.build-context.outputs.run-android == 'true'
339339
timeout-minutes: 60
340340
strategy:
341341
fail-fast: false
@@ -357,15 +357,15 @@ jobs:
357357
build-wasi:
358358
name: 'WASI'
359359
needs: build-context
360-
if: needs.build-context.outputs.run-tests == 'true'
360+
if: needs.build-context.outputs.run-wasi == 'true'
361361
uses: ./.github/workflows/reusable-wasi.yml
362362

363363
test-hypothesis:
364364
name: "Hypothesis tests on Ubuntu"
365365
runs-on: ubuntu-24.04
366366
timeout-minutes: 60
367367
needs: build-context
368-
if: needs.build-context.outputs.run-tests == 'true'
368+
if: needs.build-context.outputs.run-ubuntu == 'true'
369369
env:
370370
OPENSSL_VER: 3.0.18
371371
PYTHONSTRICTEXTENSIONBUILD: 1
@@ -471,7 +471,7 @@ jobs:
471471
runs-on: ${{ matrix.os }}
472472
timeout-minutes: 60
473473
needs: build-context
474-
if: needs.build-context.outputs.run-tests == 'true'
474+
if: needs.build-context.outputs.run-ubuntu == 'true'
475475
strategy:
476476
fail-fast: false
477477
matrix:
@@ -524,7 +524,7 @@ jobs:
524524
# ${{ '' } is a hack to nest jobs under the same sidebar category.
525525
name: Sanitizers${{ '' }} # zizmor: ignore[obfuscation]
526526
needs: build-context
527-
if: needs.build-context.outputs.run-tests == 'true'
527+
if: needs.build-context.outputs.run-ubuntu == 'true'
528528
strategy:
529529
fail-fast: false
530530
matrix:
@@ -612,41 +612,29 @@ jobs:
612612
test-hypothesis,
613613
cifuzz,
614614
allowed-skips: >-
615+
${{ !fromJSON(needs.build-context.outputs.run-docs) && 'check-docs,' || '' }}
615616
${{
616-
!fromJSON(needs.build-context.outputs.run-docs)
617+
needs.build-context.outputs.run-tests != 'true'
617618
&& '
618-
check-docs,
619+
check-autoconf-regen,
620+
check-generated-files,
619621
'
620622
|| ''
621623
}}
624+
${{ !fromJSON(needs.build-context.outputs.run-windows-tests) && 'build-windows,' || '' }}
625+
${{ !fromJSON(needs.build-context.outputs.run-ci-fuzz) && 'cifuzz,' || '' }}
626+
${{ !fromJSON(needs.build-context.outputs.run-macos) && 'build-macos,' || '' }}
622627
${{
623-
needs.build-context.outputs.run-tests != 'true'
628+
!fromJSON(needs.build-context.outputs.run-ubuntu)
624629
&& '
625-
check-autoconf-regen,
626-
check-generated-files,
627-
build-macos,
628630
build-ubuntu,
629631
build-ubuntu-ssltests,
630-
build-android,
631-
build-wasi,
632632
test-hypothesis,
633633
build-asan,
634634
build-san,
635635
'
636636
|| ''
637637
}}
638-
${{
639-
!fromJSON(needs.build-context.outputs.run-windows-tests)
640-
&& '
641-
build-windows,
642-
'
643-
|| ''
644-
}}
645-
${{
646-
!fromJSON(needs.build-context.outputs.run-ci-fuzz)
647-
&& '
648-
cifuzz,
649-
'
650-
|| ''
651-
}}
638+
${{ !fromJSON(needs.build-context.outputs.run-android) && 'build-android,' || '' }}
639+
${{ !fromJSON(needs.build-context.outputs.run-wasi) && 'build-wasi,' || '' }}
652640
jobs: ${{ toJSON(needs) }}

.github/workflows/reusable-context.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,51 @@ on: # yamllint disable-line rule:truthy
1717
# || 'falsy-branch'
1818
# }}
1919
#
20+
run-android:
21+
description: Whether to run the Android tests
22+
value: ${{ jobs.compute-changes.outputs.run-android }} # bool
23+
run-ci-fuzz:
24+
description: Whether to run the CIFuzz job
25+
value: ${{ jobs.compute-changes.outputs.run-ci-fuzz }} # bool
2026
run-docs:
2127
description: Whether to build the docs
2228
value: ${{ jobs.compute-changes.outputs.run-docs }} # bool
29+
run-ios:
30+
description: Whether to run the iOS tests
31+
value: ${{ jobs.compute-changes.outputs.run-ios }} # bool
32+
run-macos:
33+
description: Whether to run the macOS tests
34+
value: ${{ jobs.compute-changes.outputs.run-macos }} # bool
2335
run-tests:
2436
description: Whether to run the regular tests
2537
value: ${{ jobs.compute-changes.outputs.run-tests }} # bool
26-
run-windows-tests:
27-
description: Whether to run the Windows tests
28-
value: ${{ jobs.compute-changes.outputs.run-windows-tests }} # bool
38+
run-ubuntu:
39+
description: Whether to run the Ubuntu tests
40+
value: ${{ jobs.compute-changes.outputs.run-ubuntu }} # bool
41+
run-wasi:
42+
description: Whether to run the WASI tests
43+
value: ${{ jobs.compute-changes.outputs.run-wasi }} # bool
2944
run-windows-msi:
3045
description: Whether to run the MSI installer smoke tests
3146
value: ${{ jobs.compute-changes.outputs.run-windows-msi }} # bool
32-
run-ci-fuzz:
33-
description: Whether to run the CIFuzz job
34-
value: ${{ jobs.compute-changes.outputs.run-ci-fuzz }} # bool
47+
run-windows-tests:
48+
description: Whether to run the Windows tests
49+
value: ${{ jobs.compute-changes.outputs.run-windows-tests }} # bool
3550

3651
jobs:
3752
compute-changes:
3853
name: Create context from changed files
3954
runs-on: ubuntu-latest
4055
timeout-minutes: 10
4156
outputs:
57+
run-android: ${{ steps.changes.outputs.run-android }}
4258
run-ci-fuzz: ${{ steps.changes.outputs.run-ci-fuzz }}
4359
run-docs: ${{ steps.changes.outputs.run-docs }}
60+
run-ios: ${{ steps.changes.outputs.run-ios }}
61+
run-macos: ${{ steps.changes.outputs.run-macos }}
4462
run-tests: ${{ steps.changes.outputs.run-tests }}
63+
run-ubuntu: ${{ steps.changes.outputs.run-ubuntu }}
64+
run-wasi: ${{ steps.changes.outputs.run-wasi }}
4565
run-windows-msi: ${{ steps.changes.outputs.run-windows-msi }}
4666
run-windows-tests: ${{ steps.changes.outputs.run-windows-tests }}
4767
steps:

0 commit comments

Comments
 (0)