Skip to content

Commit 5c354ca

Browse files
AA-Turnerhugovkwebknjaz
committed
[3.13] Convert change detection to a Python script (pythonGH-129627)
(cherry picked from commit 7d9a22f) Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
1 parent 38dfe01 commit 5c354ca

File tree

4 files changed

+330
-209
lines changed

4 files changed

+330
-209
lines changed

.github/workflows/build.yml

Lines changed: 47 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,32 @@ env:
2222
FORCE_COLOR: 1
2323

2424
jobs:
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_abi:
4747
name: 'Check if the ABI has changed'
4848
runs-on: ubuntu-22.04 # 24.04 causes spurious errors
49-
needs: check_source
50-
if: needs.check_source.outputs.run_tests == 'true'
49+
needs: build-context
50+
if: needs.build-context.outputs.run-tests == 'true'
5151
steps:
5252
- uses: actions/checkout@v4
5353
with:
@@ -96,8 +96,8 @@ jobs:
9696
container:
9797
image: ghcr.io/python/autoconf:2024.10.16.11360930377
9898
timeout-minutes: 60
99-
needs: check_source
100-
if: needs.check_source.outputs.run_tests == 'true'
99+
needs: build-context
100+
if: needs.build-context.outputs.run-tests == 'true'
101101
steps:
102102
- name: Install Git
103103
run: |
@@ -137,8 +137,8 @@ jobs:
137137
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
138138
runs-on: ubuntu-24.04
139139
timeout-minutes: 60
140-
needs: check_source
141-
if: needs.check_source.outputs.run_tests == 'true'
140+
needs: build-context
141+
if: needs.build-context.outputs.run-tests == 'true'
142142
steps:
143143
- uses: actions/checkout@v4
144144
with:
@@ -153,7 +153,7 @@ jobs:
153153
with:
154154
path: config.cache
155155
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python
156-
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.check_source.outputs.config_hash }}-${{ env.pythonLocation }}
156+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}-${{ env.pythonLocation }}
157157
- name: Install dependencies
158158
run: sudo ./.github/workflows/posix-deps-apt.sh
159159
- name: Add ccache to PATH
@@ -196,8 +196,8 @@ jobs:
196196
name: >-
197197
Windows
198198
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
199-
needs: check_source
200-
if: fromJSON(needs.check_source.outputs.run_tests)
199+
needs: build-context
200+
if: fromJSON(needs.build-context.outputs.run-tests)
201201
strategy:
202202
fail-fast: false
203203
matrix:
@@ -227,8 +227,8 @@ jobs:
227227
build_windows_msi:
228228
name: >- # ${{ '' } is a hack to nest jobs under the same sidebar category
229229
Windows MSI${{ '' }}
230-
needs: check_source
231-
if: fromJSON(needs.check_source.outputs.run-win-msi)
230+
needs: build-context
231+
if: fromJSON(needs.build-context.outputs.run-windows-msi)
232232
strategy:
233233
matrix:
234234
arch:
@@ -243,8 +243,8 @@ jobs:
243243
name: >-
244244
macOS
245245
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
246-
needs: check_source
247-
if: needs.check_source.outputs.run_tests == 'true'
246+
needs: build-context
247+
if: needs.build-context.outputs.run-tests == 'true'
248248
strategy:
249249
fail-fast: false
250250
matrix:
@@ -269,32 +269,34 @@ jobs:
269269
free-threading: true
270270
uses: ./.github/workflows/reusable-macos.yml
271271
with:
272-
config_hash: ${{ needs.check_source.outputs.config_hash }}
272+
config_hash: ${{ needs.build-context.outputs.config-hash }}
273273
free-threading: ${{ matrix.free-threading }}
274274
os: ${{ matrix.os }}
275275

276276
build_ubuntu:
277277
name: >-
278278
Ubuntu
279279
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
280-
needs: check_source
281-
if: needs.check_source.outputs.run_tests == 'true'
280+
${{ fromJSON(matrix.bolt) && '(bolt)' || '' }}
281+
needs: build-context
282+
if: needs.build-context.outputs.run-tests == 'true'
282283
strategy:
283284
matrix:
284285
free-threading:
285286
- false
286287
- true
287288
uses: ./.github/workflows/reusable-ubuntu.yml
288289
with:
289-
config_hash: ${{ needs.check_source.outputs.config_hash }}
290+
config_hash: ${{ needs.build-context.outputs.config-hash }}
291+
bolt-optimizations: ${{ matrix.bolt }}
290292
free-threading: ${{ matrix.free-threading }}
291293

292294
build_ubuntu_ssltests:
293295
name: 'Ubuntu SSL tests with OpenSSL'
294296
runs-on: ${{ matrix.os }}
295297
timeout-minutes: 60
296-
needs: check_source
297-
if: needs.check_source.outputs.run_tests == 'true'
298+
needs: build-context
299+
if: needs.build-context.outputs.run-tests == 'true'
298300
strategy:
299301
fail-fast: false
300302
matrix:
@@ -315,7 +317,7 @@ jobs:
315317
uses: actions/cache@v4
316318
with:
317319
path: config.cache
318-
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.check_source.outputs.config_hash }}
320+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
319321
- name: Register gcc problem matcher
320322
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
321323
- name: Install dependencies
@@ -352,18 +354,18 @@ jobs:
352354

353355
build_wasi:
354356
name: 'WASI'
355-
needs: check_source
356-
if: needs.check_source.outputs.run_tests == 'true'
357+
needs: build-context
358+
if: needs.build-context.outputs.run-tests == 'true'
357359
uses: ./.github/workflows/reusable-wasi.yml
358360
with:
359-
config_hash: ${{ needs.check_source.outputs.config_hash }}
361+
config_hash: ${{ needs.build-context.outputs.config-hash }}
360362

361363
test_hypothesis:
362364
name: "Hypothesis tests on Ubuntu"
363365
runs-on: ubuntu-24.04
364366
timeout-minutes: 60
365-
needs: check_source
366-
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
367+
needs: build-context
368+
if: needs.build-context.outputs.run-tests == 'true'
367369
env:
368370
OPENSSL_VER: 3.0.15
369371
PYTHONSTRICTEXTENSIONBUILD: 1
@@ -410,7 +412,7 @@ jobs:
410412
uses: actions/cache@v4
411413
with:
412414
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
413-
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.check_source.outputs.config_hash }}
415+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
414416
- name: Configure CPython out-of-tree
415417
working-directory: ${{ env.CPYTHON_BUILDDIR }}
416418
run: |
@@ -477,8 +479,8 @@ jobs:
477479
name: 'Address sanitizer'
478480
runs-on: ${{ matrix.os }}
479481
timeout-minutes: 60
480-
needs: check_source
481-
if: needs.check_source.outputs.run_tests == 'true'
482+
needs: build-context
483+
if: needs.build-context.outputs.run-tests == 'true'
482484
strategy:
483485
matrix:
484486
os: [ubuntu-24.04]
@@ -496,7 +498,7 @@ jobs:
496498
uses: actions/cache@v4
497499
with:
498500
path: config.cache
499-
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.check_source.outputs.config_hash }}
501+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
500502
- name: Register gcc problem matcher
501503
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
502504
- name: Install dependencies
@@ -540,25 +542,25 @@ jobs:
540542
name: >-
541543
Thread sanitizer
542544
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
543-
needs: check_source
544-
if: needs.check_source.outputs.run_tests == 'true'
545+
needs: build-context
546+
if: needs.build-context.outputs.run-tests == 'true'
545547
strategy:
546548
matrix:
547549
free-threading:
548550
- false
549551
- true
550552
uses: ./.github/workflows/reusable-tsan.yml
551553
with:
552-
config_hash: ${{ needs.check_source.outputs.config_hash }}
554+
config_hash: ${{ needs.build-context.outputs.config-hash }}
553555
free-threading: ${{ matrix.free-threading }}
554556

555557
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
556558
cifuzz:
557559
name: CIFuzz
558560
runs-on: ubuntu-latest
559561
timeout-minutes: 60
560-
needs: check_source
561-
if: needs.check_source.outputs.run_cifuzz == 'true'
562+
needs: build-context
563+
if: needs.build-context.outputs.run-ci-fuzz == 'true'
562564
permissions:
563565
security-events: write
564566
strategy:
@@ -597,7 +599,7 @@ jobs:
597599
if: always()
598600

599601
needs:
600-
- check_source # Transitive dependency, needed to access `run_tests` value
602+
- build-context # Transitive dependency, needed to access `run-tests` value
601603
- check-docs
602604
- check_autoconf_regen
603605
- check_generated_files
@@ -625,14 +627,14 @@ jobs:
625627
test_hypothesis,
626628
allowed-skips: >-
627629
${{
628-
!fromJSON(needs.check_source.outputs.run-docs)
630+
!fromJSON(needs.build-context.outputs.run-docs)
629631
&& '
630632
check-docs,
631633
'
632634
|| ''
633635
}}
634636
${{
635-
needs.check_source.outputs.run_tests != 'true'
637+
needs.build-context.outputs.run-tests != 'true'
636638
&& '
637639
check_autoconf_regen,
638640
check_generated_files,
@@ -643,21 +645,15 @@ jobs:
643645
build_windows,
644646
build_asan,
645647
build_tsan,
648+
test_hypothesis,
646649
'
647650
|| ''
648651
}}
649652
${{
650-
!fromJSON(needs.check_source.outputs.run_cifuzz)
653+
!fromJSON(needs.build-context.outputs.run-ci-fuzz)
651654
&& '
652655
cifuzz,
653656
'
654657
|| ''
655658
}}
656-
${{
657-
!fromJSON(needs.check_source.outputs.run_hypothesis)
658-
&& '
659-
test_hypothesis,
660-
'
661-
|| ''
662-
}}
663659
jobs: ${{ toJSON(needs) }}

0 commit comments

Comments
 (0)