33
33
check_source :
34
34
name : ' Check for source changes'
35
35
runs-on : ubuntu-latest
36
+ timeout-minutes : 10
36
37
outputs :
37
38
run_tests : ${{ steps.check.outputs.run_tests }}
39
+ run_hypothesis : ${{ steps.check.outputs.run_hypothesis }}
38
40
steps :
39
41
- uses : actions/checkout@v3
40
42
- name : Check for source changes
60
62
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
61
63
fi
62
64
65
+ # Check if we should run hypothesis tests
66
+ GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
67
+ echo $GIT_BRANCH
68
+ if $(echo "$GIT_BRANCH" | grep -q -w '3\.\(8\|9\|10\|11\)'); then
69
+ echo "Branch too old for hypothesis tests"
70
+ echo "run_hypothesis=false" >> $GITHUB_OUTPUT
71
+ else
72
+ echo "Run hypothesis tests"
73
+ echo "run_hypothesis=true" >> $GITHUB_OUTPUT
74
+ fi
75
+
63
76
check_generated_files :
64
77
name : ' Check if generated files are up to date'
65
78
runs-on : ubuntu-latest
79
+ timeout-minutes : 60
66
80
needs : check_source
67
81
if : needs.check_source.outputs.run_tests == 'true'
68
82
steps :
@@ -111,10 +125,14 @@ jobs:
111
125
run : make smelly
112
126
- name : Check limited ABI symbols
113
127
run : make check-limited-abi
128
+ - name : Check for unsupported C global variables
129
+ if : github.event_name == 'pull_request' # $GITHUB_EVENT_NAME
130
+ run : make check-c-globals
114
131
115
132
build_win32 :
116
133
name : ' Windows (x86)'
117
134
runs-on : windows-latest
135
+ timeout-minutes : 60
118
136
needs : check_source
119
137
if : needs.check_source.outputs.run_tests == 'true'
120
138
env :
@@ -123,7 +141,6 @@ jobs:
123
141
- uses : actions/checkout@v3
124
142
- name : Build CPython
125
143
run : .\PCbuild\build.bat -e -d -p Win32
126
- timeout-minutes : 30
127
144
- name : Display build info
128
145
run : .\python.bat -m test.pythoninfo
129
146
- name : Tests
@@ -132,6 +149,7 @@ jobs:
132
149
build_win_amd64 :
133
150
name : ' Windows (x64)'
134
151
runs-on : windows-latest
152
+ timeout-minutes : 60
135
153
needs : check_source
136
154
if : needs.check_source.outputs.run_tests == 'true'
137
155
env :
@@ -142,7 +160,6 @@ jobs:
142
160
run : echo "::add-matcher::.github/problem-matchers/msvc.json"
143
161
- name : Build CPython
144
162
run : .\PCbuild\build.bat -e -d -p x64
145
- timeout-minutes : 30
146
163
- name : Display build info
147
164
run : .\python.bat -m test.pythoninfo
148
165
- name : Tests
@@ -151,6 +168,7 @@ jobs:
151
168
build_macos :
152
169
name : ' macOS'
153
170
runs-on : macos-latest
171
+ timeout-minutes : 60
154
172
needs : check_source
155
173
if : needs.check_source.outputs.run_tests == 'true'
156
174
env :
@@ -181,6 +199,7 @@ jobs:
181
199
build_ubuntu :
182
200
name : ' Ubuntu'
183
201
runs-on : ubuntu-20.04
202
+ timeout-minutes : 60
184
203
needs : check_source
185
204
if : needs.check_source.outputs.run_tests == 'true'
186
205
env :
@@ -238,6 +257,7 @@ jobs:
238
257
build_ubuntu_ssltests :
239
258
name : ' Ubuntu SSL tests with OpenSSL'
240
259
runs-on : ubuntu-20.04
260
+ timeout-minutes : 60
241
261
needs : check_source
242
262
if : needs.check_source.outputs.run_tests == 'true'
243
263
strategy :
@@ -283,10 +303,97 @@ jobs:
283
303
- name : SSL tests
284
304
run : ./python Lib/test/ssltests.py
285
305
306
+ test_hypothesis :
307
+ name : " Hypothesis Tests on Ubuntu"
308
+ runs-on : ubuntu-20.04
309
+ timeout-minutes : 60
310
+ needs : check_source
311
+ if : needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
312
+ env :
313
+ OPENSSL_VER : 1.1.1t
314
+ PYTHONSTRICTEXTENSIONBUILD : 1
315
+ steps :
316
+ - uses : actions/checkout@v3
317
+ - name : Register gcc problem matcher
318
+ run : echo "::add-matcher::.github/problem-matchers/gcc.json"
319
+ - name : Install Dependencies
320
+ run : sudo ./.github/workflows/posix-deps-apt.sh
321
+ - name : Configure OpenSSL env vars
322
+ run : |
323
+ echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
324
+ echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
325
+ echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
326
+ - name : ' Restore OpenSSL build'
327
+ id : cache-openssl
328
+ uses : actions/cache@v3
329
+ with :
330
+ path : ./multissl/openssl/${{ env.OPENSSL_VER }}
331
+ key : ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
332
+ - name : Install OpenSSL
333
+ if : steps.cache-openssl.outputs.cache-hit != 'true'
334
+ run : python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
335
+ - name : Add ccache to PATH
336
+ run : |
337
+ echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
338
+ - name : Configure ccache action
339
+ uses : hendrikmuhs/ccache-action@v1.2
340
+ - name : Setup directory envs for out-of-tree builds
341
+ run : |
342
+ echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
343
+ echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
344
+ - name : Create directories for read-only out-of-tree builds
345
+ run : mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
346
+ - name : Bind mount sources read-only
347
+ run : sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
348
+ - name : Configure CPython out-of-tree
349
+ working-directory : ${{ env.CPYTHON_BUILDDIR }}
350
+ run : ../cpython-ro-srcdir/configure --with-pydebug --with-openssl=$OPENSSL_DIR
351
+ - name : Build CPython out-of-tree
352
+ working-directory : ${{ env.CPYTHON_BUILDDIR }}
353
+ run : make -j4
354
+ - name : Display build info
355
+ working-directory : ${{ env.CPYTHON_BUILDDIR }}
356
+ run : make pythoninfo
357
+ - name : Remount sources writable for tests
358
+ # some tests write to srcdir, lack of pyc files slows down testing
359
+ run : sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
360
+ - name : Setup directory envs for out-of-tree builds
361
+ run : |
362
+ echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
363
+ - name : " Create hypothesis venv"
364
+ working-directory : ${{ env.CPYTHON_BUILDDIR }}
365
+ run : |
366
+ VENV_LOC=$(realpath -m .)/hypovenv
367
+ VENV_PYTHON=$VENV_LOC/bin/python
368
+ echo "HYPOVENV=${VENV_LOC}" >> $GITHUB_ENV
369
+ echo "VENV_PYTHON=${VENV_PYTHON}" >> $GITHUB_ENV
370
+ ./python -m venv $VENV_LOC && $VENV_PYTHON -m pip install -U hypothesis
371
+ - name : " Run tests"
372
+ working-directory : ${{ env.CPYTHON_BUILDDIR }}
373
+ run : |
374
+ # Most of the excluded tests are slow test suites with no property tests
375
+ #
376
+ # (GH-104097) test_sysconfig is skipped because it has tests that are
377
+ # failing when executed from inside a virtual environment.
378
+ ${{ env.VENV_PYTHON }} -m test \
379
+ -W \
380
+ -o \
381
+ -j4 \
382
+ -x test_asyncio \
383
+ -x test_multiprocessing_fork \
384
+ -x test_multiprocessing_forkserver \
385
+ -x test_multiprocessing_spawn \
386
+ -x test_concurrent_futures \
387
+ -x test_socket \
388
+ -x test_subprocess \
389
+ -x test_signal \
390
+ -x test_sysconfig
391
+
286
392
287
393
build_asan :
288
394
name : ' Address sanitizer'
289
395
runs-on : ubuntu-20.04
396
+ timeout-minutes : 60
290
397
needs : check_source
291
398
if : needs.check_source.outputs.run_tests == 'true'
292
399
env :
@@ -299,6 +406,10 @@ jobs:
299
406
run : echo "::add-matcher::.github/problem-matchers/gcc.json"
300
407
- name : Install Dependencies
301
408
run : sudo ./.github/workflows/posix-deps-apt.sh
409
+ - name : Set up GCC-10 for ASAN
410
+ uses : egor-tensin/setup-gcc@v1
411
+ with :
412
+ version : 10
302
413
- name : Configure OpenSSL env vars
303
414
run : |
304
415
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
0 commit comments