1
1
name : Tests
2
2
3
- # gh-84728: "paths-ignore" is not used to skip documentation-only PRs, because
4
- # it prevents to mark a job as mandatory. A PR cannot be merged if a job is
5
- # mandatory but not scheduled because of "paths-ignore".
6
3
on :
7
4
workflow_dispatch :
8
5
push :
@@ -31,70 +28,19 @@ concurrency:
31
28
32
29
jobs :
33
30
check_source :
34
- name : ' Check for source changes'
35
- runs-on : ubuntu-latest
36
- timeout-minutes : 10
37
- outputs :
38
- run-docs : ${{ steps.docs-changes.outputs.run-docs || false }}
39
- run_tests : ${{ steps.check.outputs.run_tests }}
40
- run_hypothesis : ${{ steps.check.outputs.run_hypothesis }}
41
- config_hash : ${{ steps.config_hash.outputs.hash }}
42
- steps :
43
- - uses : actions/checkout@v4
44
- - name : Check for source changes
45
- id : check
46
- run : |
47
- if [ -z "$GITHUB_BASE_REF" ]; then
48
- echo "run_tests=true" >> $GITHUB_OUTPUT
49
- else
50
- git fetch origin $GITHUB_BASE_REF --depth=1
51
- # git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more
52
- # reliable than git diff "origin/$GITHUB_BASE_REF.." (2 dots),
53
- # but it requires to download more commits (this job uses
54
- # "git fetch --depth=1").
55
- #
56
- # git diff "origin/$GITHUB_BASE_REF..." (3 dots) works with Git
57
- # 2.26, but Git 2.28 is stricter and fails with "no merge base".
58
- #
59
- # git diff "origin/$GITHUB_BASE_REF.." (2 dots) should be enough on
60
- # GitHub, since GitHub starts by merging origin/$GITHUB_BASE_REF
61
- # into the PR branch anyway.
62
- #
63
- # https://github.com/python/core-workflow/issues/373
64
- git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
65
- fi
66
-
67
- # Check if we should run hypothesis tests
68
- GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
69
- echo $GIT_BRANCH
70
- if $(echo "$GIT_BRANCH" | grep -q -w '3\.\(8\|9\|10\|11\)'); then
71
- echo "Branch too old for hypothesis tests"
72
- echo "run_hypothesis=false" >> $GITHUB_OUTPUT
73
- else
74
- echo "Run hypothesis tests"
75
- echo "run_hypothesis=true" >> $GITHUB_OUTPUT
76
- fi
77
- - name : Compute hash for config cache key
78
- id : config_hash
79
- run : |
80
- echo "hash=${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}" >> $GITHUB_OUTPUT
81
- - name : Get a list of the changed documentation-related files
82
- if : github.event_name == 'pull_request'
83
- id : changed-docs-files
84
-
85
- with :
86
- filter : |
87
- Doc/**
88
- Misc/**
89
- .github/workflows/reusable-docs.yml
90
- format : csv # works for paths with spaces
91
- - name : Check for docs changes
92
- if : >-
93
- github.event_name == 'pull_request'
94
- && steps.changed-docs-files.outputs.added_modified_renamed != ''
95
- id : docs-changes
96
- run : |
97
- echo "run-docs=true" >> "${GITHUB_OUTPUT}"
31
+ name : Change detection
32
+ # To use boolean outputs from this job, parse them as JSON.
33
+ # Here's some examples:
34
+ #
35
+ # if: fromJSON(needs.check_source.outputs.run-docs)
36
+ #
37
+ # ${{
38
+ # fromJSON(needs.check_source.outputs.run_tests)
39
+ # && 'truthy-branch'
40
+ # || 'falsy-branch'
41
+ # }}
42
+ #
43
+ uses : ./.github/workflows/reusable-change-detection.yml
98
44
99
45
check-docs :
100
46
name : Docs
@@ -145,6 +91,50 @@ jobs:
145
91
name : abi-data
146
92
path : ./Doc/data/*.abi
147
93
94
+ check_autoconf_regen :
95
+ name : ' Check if Autoconf files are up to date'
96
+ # Don't use ubuntu-latest but a specific version to make the job
97
+ # reproducible: to get the same tools versions (autoconf, aclocal, ...)
98
+ runs-on : ubuntu-24.04
99
+ container :
100
+ image : ghcr.io/python/autoconf:2024.10.16.11360930377
101
+ timeout-minutes : 60
102
+ needs : check_source
103
+ if : needs.check_source.outputs.run_tests == 'true'
104
+ steps :
105
+ - name : Install Git
106
+ run : |
107
+ apt update && apt install git -yq
108
+ git config --global --add safe.directory "$GITHUB_WORKSPACE"
109
+ - uses : actions/checkout@v4
110
+ with :
111
+ fetch-depth : 1
112
+ - name : Runner image version
113
+ run : echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
114
+ - name : Check Autoconf and aclocal versions
115
+ run : |
116
+ grep "Generated by GNU Autoconf 2.71" configure
117
+ grep "aclocal 1.16.5" aclocal.m4
118
+ grep -q "runstatedir" configure
119
+ grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
120
+ - name : Regenerate autoconf files
121
+ # Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
122
+ run : autoreconf -ivf -Werror
123
+ - name : Check for changes
124
+ run : |
125
+ git add -u
126
+ changes=$(git status --porcelain)
127
+ # Check for changes in regenerated files
128
+ if test -n "$changes"; then
129
+ echo "Generated files not up to date."
130
+ echo "Perhaps you forgot to run make regen-configure ;)"
131
+ echo "configure files must be regenerated with a specific version of autoconf."
132
+ echo "$changes"
133
+ echo ""
134
+ git diff --staged || true
135
+ exit 1
136
+ fi
137
+
148
138
check_generated_files :
149
139
name : ' Check if generated files are up to date'
150
140
# Don't use ubuntu-latest but a specific version to make the job
@@ -173,19 +163,10 @@ jobs:
173
163
uses :
hendrikmuhs/[email protected]
174
164
with :
175
165
save : false
176
- - name : Check Autoconf and aclocal versions
177
- run : |
178
- grep "Generated by GNU Autoconf 2.71" configure
179
- grep "aclocal 1.16.5" aclocal.m4
180
- grep -q "runstatedir" configure
181
- grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
182
166
- name : Configure CPython
183
167
run : |
184
168
# Build Python with the libpython dynamic library
185
169
./configure --config-cache --with-pydebug --enable-shared
186
- - name : Regenerate autoconf files
187
- # Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
188
- run : autoreconf -ivf -Werror
189
170
- name : Build CPython
190
171
run : |
191
172
# Deepfreeze will usually cause global objects to be added or removed,
@@ -216,45 +197,101 @@ jobs:
216
197
run : make check-c-globals
217
198
218
199
build_windows :
219
- name : ' Windows'
200
+ name : >-
201
+ Windows
202
+ ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
220
203
needs : check_source
221
- if : needs.check_source.outputs.run_tests == 'true'
204
+ if : fromJSON(needs.check_source.outputs.run_tests)
205
+ strategy :
206
+ matrix :
207
+ arch :
208
+ - Win32
209
+ - x64
210
+ - arm64
211
+ free-threading :
212
+ - false
213
+ # - true
222
214
uses : ./.github/workflows/reusable-windows.yml
215
+ with :
216
+ arch : ${{ matrix.arch }}
217
+ free-threading : ${{ matrix.free-threading }}
218
+
219
+ build_windows_msi :
220
+ name : >- # ${{ '' } is a hack to nest jobs under the same sidebar category
221
+ Windows MSI${{ '' }}
222
+ needs : check_source
223
+ if : fromJSON(needs.check_source.outputs.run-win-msi)
224
+ strategy :
225
+ matrix :
226
+ arch :
227
+ - x86
228
+ - x64
229
+ - arm64
230
+ uses : ./.github/workflows/reusable-windows-msi.yml
231
+ with :
232
+ arch : ${{ matrix.arch }}
223
233
224
234
build_macos :
225
- name : ' macOS'
235
+ name : >-
236
+ macOS
237
+ ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
226
238
needs : check_source
227
239
if : needs.check_source.outputs.run_tests == 'true'
240
+ strategy :
241
+ fail-fast : false
242
+ matrix :
243
+ # Cirrus and macos-14 are M1, macos-13 is default GHA Intel.
244
+ # macOS 13 only runs tests against the GIL-enabled CPython.
245
+ # Cirrus used for upstream, macos-14 for forks.
246
+ os :
247
+ - ghcr.io/cirruslabs/macos-runner:sonoma
248
+ - macos-14
249
+ - macos-13
250
+ is-fork : # only used for the exclusion trick
251
+ - ${{ github.repository_owner != 'python' }}
252
+ free-threading :
253
+ - false
254
+ # - true
255
+ exclude :
256
+ - os : ghcr.io/cirruslabs/macos-runner:sonoma
257
+ is-fork : true
258
+ - os : macos-14
259
+ is-fork : false
260
+ - os : macos-13
261
+ free-threading : true
228
262
uses : ./.github/workflows/reusable-macos.yml
229
263
with :
230
264
config_hash : ${{ needs.check_source.outputs.config_hash }}
231
- # Cirrus and macos-14 are M1, macos-13 is default GHA Intel.
232
- # Cirrus used for upstream, macos-14 for forks.
233
- os-matrix : ' ["ghcr.io/cirruslabs/macos-runner:sonoma", "macos-14", "macos-13"]'
265
+ free-threading : ${{ matrix.free-threading }}
266
+ os : ${{ matrix.os }}
234
267
235
268
build_ubuntu :
236
- name : ' Ubuntu'
269
+ name : >-
270
+ Ubuntu
271
+ ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
237
272
needs : check_source
238
273
if : needs.check_source.outputs.run_tests == 'true'
274
+ strategy :
275
+ matrix :
276
+ free-threading :
277
+ - false
278
+ # - true
239
279
uses : ./.github/workflows/reusable-ubuntu.yml
240
280
with :
241
281
config_hash : ${{ needs.check_source.outputs.config_hash }}
242
- options : |
243
- ../cpython-ro-srcdir/configure \
244
- --config-cache \
245
- --with-pydebug \
246
- --with-openssl=$OPENSSL_DIR
282
+ free-threading : ${{ matrix.free-threading }}
247
283
248
284
build_ubuntu_ssltests :
249
285
name : ' Ubuntu SSL tests with OpenSSL'
250
- runs-on : ubuntu-22.04
286
+ runs-on : ${{ matrix.os }}
251
287
timeout-minutes : 60
252
288
needs : check_source
253
289
if : needs.check_source.outputs.run_tests == 'true'
254
290
strategy :
255
291
fail-fast : false
256
292
matrix :
257
- openssl_ver : [1.1.1w, 3.0.13, 3.1.5, 3.2.1]
293
+ os : [ubuntu-22.04]
294
+ openssl_ver : [3.0.15, 3.1.7, 3.2.3, 3.3.2]
258
295
env :
259
296
OPENSSL_VER : ${{ matrix.openssl_ver }}
260
297
MULTISSL_DIR : ${{ github.workspace }}/multissl
@@ -283,7 +320,7 @@ jobs:
283
320
uses : actions/cache@v4
284
321
with :
285
322
path : ./multissl/openssl/${{ env.OPENSSL_VER }}
286
- key : ${{ runner .os }}-multissl-openssl-${{ env.OPENSSL_VER }}
323
+ key : ${{ matrix .os }}-multissl-openssl-${{ env.OPENSSL_VER }}
287
324
- name : Install OpenSSL
288
325
if : steps.cache-openssl.outputs.cache-hit != 'true'
289
326
run : python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
@@ -310,7 +347,7 @@ jobs:
310
347
needs : check_source
311
348
if : needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
312
349
env :
313
- OPENSSL_VER : 3.0.13
350
+ OPENSSL_VER : 3.0.15
314
351
PYTHONSTRICTEXTENSIONBUILD : 1
315
352
steps :
316
353
- uses : actions/checkout@v4
@@ -388,7 +425,7 @@ jobs:
388
425
path : ./hypothesis
389
426
key : hypothesis-database-${{ github.head_ref || github.run_id }}
390
427
restore-keys : |
391
- - hypothesis-database-
428
+ hypothesis-database-
392
429
- name : " Run tests"
393
430
working-directory : ${{ env.CPYTHON_BUILDDIR }}
394
431
run : |
@@ -423,7 +460,7 @@ jobs:
423
460
needs : check_source
424
461
if : needs.check_source.outputs.run_tests == 'true'
425
462
env :
426
- OPENSSL_VER : 3.0.13
463
+ OPENSSL_VER : 3.0.15
427
464
PYTHONSTRICTEXTENSIONBUILD : 1
428
465
ASAN_OPTIONS : detect_leaks=0:allocator_may_return_null=1:handle_segv=0
429
466
steps :
@@ -453,7 +490,7 @@ jobs:
453
490
uses : actions/cache@v4
454
491
with :
455
492
path : ./multissl/openssl/${{ env.OPENSSL_VER }}
456
- key : ${{ runner .os }}-multissl-openssl-${{ env.OPENSSL_VER }}
493
+ key : ${{ matrix .os }}-multissl-openssl-${{ env.OPENSSL_VER }}
457
494
- name : Install OpenSSL
458
495
if : steps.cache-openssl.outputs.cache-hit != 'true'
459
496
run : python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
@@ -495,6 +532,7 @@ jobs:
495
532
- build_ubuntu
496
533
- build_ubuntu_ssltests
497
534
- build_windows
535
+ - build_windows_msi
498
536
- test_hypothesis
499
537
- build_asan
500
538
- build_tsan
@@ -508,6 +546,7 @@ jobs:
508
546
allowed-failures : >-
509
547
build_macos,
510
548
build_ubuntu_ssltests,
549
+ build_windows_msi,
511
550
test_hypothesis,
512
551
allowed-skips : >-
513
552
${{
0 commit comments