8
8
push :
9
9
branches :
10
10
- ' main'
11
+ - ' 3.12'
11
12
- ' 3.11'
12
13
- ' 3.10'
13
14
- ' 3.9'
16
17
pull_request :
17
18
branches :
18
19
- ' main'
20
+ - ' 3.12'
19
21
- ' 3.11'
20
22
- ' 3.10'
21
23
- ' 3.9'
33
35
check_source :
34
36
name : ' Check for source changes'
35
37
runs-on : ubuntu-latest
38
+ timeout-minutes : 10
36
39
outputs :
37
40
run_tests : ${{ steps.check.outputs.run_tests }}
41
+ run_hypothesis : ${{ steps.check.outputs.run_hypothesis }}
38
42
steps :
39
43
- uses : actions/checkout@v3
40
44
- name : Check for source changes
60
64
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
61
65
fi
62
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
+
63
78
check_generated_files :
64
79
name : ' Check if generated files are up to date'
65
80
runs-on : ubuntu-latest
81
+ timeout-minutes : 60
66
82
needs : check_source
67
83
if : needs.check_source.outputs.run_tests == 'true'
68
84
steps :
@@ -118,6 +134,7 @@ jobs:
118
134
build_win32 :
119
135
name : ' Windows (x86)'
120
136
runs-on : windows-latest
137
+ timeout-minutes : 60
121
138
needs : check_source
122
139
if : needs.check_source.outputs.run_tests == 'true'
123
140
env :
@@ -126,7 +143,6 @@ jobs:
126
143
- uses : actions/checkout@v3
127
144
- name : Build CPython
128
145
run : .\PCbuild\build.bat -e -d -p Win32
129
- timeout-minutes : 30
130
146
- name : Display build info
131
147
run : .\python.bat -m test.pythoninfo
132
148
- name : Tests
@@ -135,6 +151,7 @@ jobs:
135
151
build_win_amd64 :
136
152
name : ' Windows (x64)'
137
153
runs-on : windows-latest
154
+ timeout-minutes : 60
138
155
needs : check_source
139
156
if : needs.check_source.outputs.run_tests == 'true'
140
157
env :
@@ -145,7 +162,6 @@ jobs:
145
162
run : echo "::add-matcher::.github/problem-matchers/msvc.json"
146
163
- name : Build CPython
147
164
run : .\PCbuild\build.bat -e -d -p x64
148
- timeout-minutes : 30
149
165
- name : Display build info
150
166
run : .\python.bat -m test.pythoninfo
151
167
- name : Tests
@@ -154,6 +170,7 @@ jobs:
154
170
build_macos :
155
171
name : ' macOS'
156
172
runs-on : macos-latest
173
+ timeout-minutes : 60
157
174
needs : check_source
158
175
if : needs.check_source.outputs.run_tests == 'true'
159
176
env :
@@ -184,6 +201,7 @@ jobs:
184
201
build_ubuntu :
185
202
name : ' Ubuntu'
186
203
runs-on : ubuntu-20.04
204
+ timeout-minutes : 60
187
205
needs : check_source
188
206
if : needs.check_source.outputs.run_tests == 'true'
189
207
env :
@@ -241,6 +259,7 @@ jobs:
241
259
build_ubuntu_ssltests :
242
260
name : ' Ubuntu SSL tests with OpenSSL'
243
261
runs-on : ubuntu-20.04
262
+ timeout-minutes : 60
244
263
needs : check_source
245
264
if : needs.check_source.outputs.run_tests == 'true'
246
265
strategy :
@@ -286,10 +305,110 @@ jobs:
286
305
- name : SSL tests
287
306
run : ./python Lib/test/ssltests.py
288
307
308
+ test_hypothesis :
309
+ name : " Hypothesis Tests on Ubuntu"
310
+ runs-on : ubuntu-20.04
311
+ timeout-minutes : 60
312
+ needs : check_source
313
+ if : needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
314
+ env :
315
+ OPENSSL_VER : 1.1.1t
316
+ PYTHONSTRICTEXTENSIONBUILD : 1
317
+ steps :
318
+ - uses : actions/checkout@v3
319
+ - name : Register gcc problem matcher
320
+ run : echo "::add-matcher::.github/problem-matchers/gcc.json"
321
+ - name : Install Dependencies
322
+ run : sudo ./.github/workflows/posix-deps-apt.sh
323
+ - name : Configure OpenSSL env vars
324
+ run : |
325
+ echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
326
+ echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
327
+ echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
328
+ - name : ' Restore OpenSSL build'
329
+ id : cache-openssl
330
+ uses : actions/cache@v3
331
+ with :
332
+ path : ./multissl/openssl/${{ env.OPENSSL_VER }}
333
+ key : ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
334
+ - name : Install OpenSSL
335
+ if : steps.cache-openssl.outputs.cache-hit != 'true'
336
+ run : python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
337
+ - name : Add ccache to PATH
338
+ run : |
339
+ echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
340
+ - name : Configure ccache action
341
+ uses :
hendrikmuhs/[email protected]
342
+ - name : Setup directory envs for out-of-tree builds
343
+ run : |
344
+ echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
345
+ echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
346
+ - name : Create directories for read-only out-of-tree builds
347
+ run : mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
348
+ - name : Bind mount sources read-only
349
+ run : sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
350
+ - name : Configure CPython out-of-tree
351
+ working-directory : ${{ env.CPYTHON_BUILDDIR }}
352
+ run : ../cpython-ro-srcdir/configure --with-pydebug --with-openssl=$OPENSSL_DIR
353
+ - name : Build CPython out-of-tree
354
+ working-directory : ${{ env.CPYTHON_BUILDDIR }}
355
+ run : make -j4
356
+ - name : Display build info
357
+ working-directory : ${{ env.CPYTHON_BUILDDIR }}
358
+ run : make pythoninfo
359
+ - name : Remount sources writable for tests
360
+ # some tests write to srcdir, lack of pyc files slows down testing
361
+ run : sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
362
+ - name : Setup directory envs for out-of-tree builds
363
+ run : |
364
+ echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
365
+ - name : " Create hypothesis venv"
366
+ working-directory : ${{ env.CPYTHON_BUILDDIR }}
367
+ run : |
368
+ VENV_LOC=$(realpath -m .)/hypovenv
369
+ VENV_PYTHON=$VENV_LOC/bin/python
370
+ echo "HYPOVENV=${VENV_LOC}" >> $GITHUB_ENV
371
+ echo "VENV_PYTHON=${VENV_PYTHON}" >> $GITHUB_ENV
372
+ ./python -m venv $VENV_LOC && $VENV_PYTHON -m pip install -U hypothesis
373
+ - name : ' Restore Hypothesis database'
374
+ id : cache-hypothesis-database
375
+ uses : actions/cache@v3
376
+ with :
377
+ path : ./hypothesis
378
+ key : hypothesis-database-${{ github.head_ref || github.run_id }}
379
+ restore-keys : |
380
+ - hypothesis-database-
381
+ - name : " Run tests"
382
+ working-directory : ${{ env.CPYTHON_BUILDDIR }}
383
+ run : |
384
+ # Most of the excluded tests are slow test suites with no property tests
385
+ #
386
+ # (GH-104097) test_sysconfig is skipped because it has tests that are
387
+ # failing when executed from inside a virtual environment.
388
+ ${{ env.VENV_PYTHON }} -m test \
389
+ -W \
390
+ -o \
391
+ -j4 \
392
+ -x test_asyncio \
393
+ -x test_multiprocessing_fork \
394
+ -x test_multiprocessing_forkserver \
395
+ -x test_multiprocessing_spawn \
396
+ -x test_concurrent_futures \
397
+ -x test_socket \
398
+ -x test_subprocess \
399
+ -x test_signal \
400
+ -x test_sysconfig
401
+ - uses : actions/upload-artifact@v3
402
+ if : always()
403
+ with :
404
+ name : hypothesis-example-db
405
+ path : .hypothesis/examples/
406
+
289
407
290
408
build_asan :
291
409
name : ' Address sanitizer'
292
410
runs-on : ubuntu-20.04
411
+ timeout-minutes : 60
293
412
needs : check_source
294
413
if : needs.check_source.outputs.run_tests == 'true'
295
414
env :
@@ -302,6 +421,10 @@ jobs:
302
421
run : echo "::add-matcher::.github/problem-matchers/gcc.json"
303
422
- name : Install Dependencies
304
423
run : sudo ./.github/workflows/posix-deps-apt.sh
424
+ - name : Set up GCC-10 for ASAN
425
+ uses : egor-tensin/setup-gcc@v1
426
+ with :
427
+ version : 10
305
428
- name : Configure OpenSSL env vars
306
429
run : |
307
430
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
0 commit comments