Skip to content

Commit 1d0c718

Browse files
committed
pythongh-108223: Add nogil build test on Github Action
1 parent 642eb8d commit 1d0c718

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/build.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,68 @@ jobs:
388388
- name: SSL tests
389389
run: ./python Lib/test/ssltests.py
390390

391+
build_nogil:
392+
name: 'Build nogil(experimental)'
393+
runs-on: ubuntu-20.04
394+
timeout-minutes: 60
395+
needs: check_source
396+
if: needs.check_source.outputs.run_tests == 'true' && github.base_ref == 'main'
397+
env:
398+
OPENSSL_VER: 3.0.11
399+
PYTHONSTRICTEXTENSIONBUILD: 1
400+
steps:
401+
- uses: actions/checkout@v4
402+
- name: Register gcc problem matcher
403+
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
404+
- name: Install Dependencies
405+
run: sudo ./.github/workflows/posix-deps-apt.sh
406+
- name: Configure OpenSSL env vars
407+
run: |
408+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
409+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
410+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
411+
- name: 'Restore OpenSSL build'
412+
id: cache-openssl
413+
uses: actions/cache@v3
414+
with:
415+
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
416+
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
417+
- name: Install OpenSSL
418+
if: steps.cache-openssl.outputs.cache-hit != 'true'
419+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
420+
- name: Add ccache to PATH
421+
run: |
422+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
423+
- name: Configure ccache action
424+
uses: hendrikmuhs/[email protected]
425+
- name: Setup directory envs for out-of-tree builds
426+
run: |
427+
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
428+
echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
429+
- name: Create directories for read-only out-of-tree builds
430+
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
431+
- name: Bind mount sources read-only
432+
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
433+
- name: Restore config.cache
434+
uses: actions/cache@v3
435+
with:
436+
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
437+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
438+
- name: Configure CPython out-of-tree
439+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
440+
run: |
441+
../cpython-ro-srcdir/configure \
442+
--config-cache \
443+
--with-pydebug \
444+
--disable-gil \
445+
--with-openssl=$OPENSSL_DIR
446+
- name: Build CPython out-of-tree
447+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
448+
run: make -j4
449+
- name: Display build info
450+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
451+
run: make pythoninfo
452+
391453
test_hypothesis:
392454
name: "Hypothesis tests on Ubuntu"
393455
runs-on: ubuntu-20.04

0 commit comments

Comments
 (0)