88 push :
99 branches :
1010 - ' main'
11+ - ' 3.12'
1112 - ' 3.11'
1213 - ' 3.10'
1314 - ' 3.9'
1617 pull_request :
1718 branches :
1819 - ' main'
20+ - ' 3.12'
1921 - ' 3.11'
2022 - ' 3.10'
2123 - ' 3.9'
3335 check_source :
3436 name : ' Check for source changes'
3537 runs-on : ubuntu-latest
38+ timeout-minutes : 10
3639 outputs :
3740 run_tests : ${{ steps.check.outputs.run_tests }}
41+ run_hypothesis : ${{ steps.check.outputs.run_hypothesis }}
3842 steps :
3943 - uses : actions/checkout@v3
4044 - name : Check for source changes
6064 git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
6165 fi
6266
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+
6378 check_generated_files :
6479 name : ' Check if generated files are up to date'
6580 runs-on : ubuntu-latest
81+ timeout-minutes : 60
6682 needs : check_source
6783 if : needs.check_source.outputs.run_tests == 'true'
6884 steps :
@@ -118,6 +134,7 @@ jobs:
118134 build_win32 :
119135 name : ' Windows (x86)'
120136 runs-on : windows-latest
137+ timeout-minutes : 60
121138 needs : check_source
122139 if : needs.check_source.outputs.run_tests == 'true'
123140 env :
@@ -126,7 +143,6 @@ jobs:
126143 - uses : actions/checkout@v3
127144 - name : Build CPython
128145 run : .\PCbuild\build.bat -e -d -p Win32
129- timeout-minutes : 30
130146 - name : Display build info
131147 run : .\python.bat -m test.pythoninfo
132148 - name : Tests
@@ -135,6 +151,7 @@ jobs:
135151 build_win_amd64 :
136152 name : ' Windows (x64)'
137153 runs-on : windows-latest
154+ timeout-minutes : 60
138155 needs : check_source
139156 if : needs.check_source.outputs.run_tests == 'true'
140157 env :
@@ -145,7 +162,6 @@ jobs:
145162 run : echo "::add-matcher::.github/problem-matchers/msvc.json"
146163 - name : Build CPython
147164 run : .\PCbuild\build.bat -e -d -p x64
148- timeout-minutes : 30
149165 - name : Display build info
150166 run : .\python.bat -m test.pythoninfo
151167 - name : Tests
@@ -154,6 +170,7 @@ jobs:
154170 build_macos :
155171 name : ' macOS'
156172 runs-on : macos-latest
173+ timeout-minutes : 60
157174 needs : check_source
158175 if : needs.check_source.outputs.run_tests == 'true'
159176 env :
@@ -184,6 +201,7 @@ jobs:
184201 build_ubuntu :
185202 name : ' Ubuntu'
186203 runs-on : ubuntu-20.04
204+ timeout-minutes : 60
187205 needs : check_source
188206 if : needs.check_source.outputs.run_tests == 'true'
189207 env :
@@ -241,6 +259,7 @@ jobs:
241259 build_ubuntu_ssltests :
242260 name : ' Ubuntu SSL tests with OpenSSL'
243261 runs-on : ubuntu-20.04
262+ timeout-minutes : 60
244263 needs : check_source
245264 if : needs.check_source.outputs.run_tests == 'true'
246265 strategy :
@@ -286,10 +305,110 @@ jobs:
286305 - name : SSL tests
287306 run : ./python Lib/test/ssltests.py
288307
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+
289407
290408 build_asan :
291409 name : ' Address sanitizer'
292410 runs-on : ubuntu-20.04
411+ timeout-minutes : 60
293412 needs : check_source
294413 if : needs.check_source.outputs.run_tests == 'true'
295414 env :
@@ -302,6 +421,10 @@ jobs:
302421 run : echo "::add-matcher::.github/problem-matchers/gcc.json"
303422 - name : Install Dependencies
304423 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
305428 - name : Configure OpenSSL env vars
306429 run : |
307430 echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
0 commit comments