mirror of
https://github.com/python/cpython.git
synced 2025-09-28 19:25:27 +00:00
gh-111062: Reusable ubuntu build that supports free-threaded mode as the conditional CI (#111452)
Co-authored-by: Donghee Na <donghee.na92@gmail.com>
This commit is contained in:
parent
940ee962a8
commit
c19561b9ca
2 changed files with 91 additions and 58 deletions
79
.github/workflows/build.yml
vendored
79
.github/workflows/build.yml
vendored
|
@ -248,70 +248,30 @@ jobs:
|
||||||
|
|
||||||
build_ubuntu:
|
build_ubuntu:
|
||||||
name: 'Ubuntu'
|
name: 'Ubuntu'
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
timeout-minutes: 60
|
|
||||||
needs: check_source
|
needs: check_source
|
||||||
if: needs.check_source.outputs.run_tests == 'true'
|
if: needs.check_source.outputs.run_tests == 'true'
|
||||||
env:
|
uses: ./.github/workflows/reusable-build-ubuntu.yml
|
||||||
OPENSSL_VER: 3.0.11
|
with:
|
||||||
PYTHONSTRICTEXTENSIONBUILD: 1
|
config_hash: ${{ needs.check_source.outputs.config_hash }}
|
||||||
steps:
|
options: |
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Register gcc problem matcher
|
|
||||||
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
|
|
||||||
- name: Install dependencies
|
|
||||||
run: sudo ./.github/workflows/posix-deps-apt.sh
|
|
||||||
- name: Configure OpenSSL env vars
|
|
||||||
run: |
|
|
||||||
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
|
|
||||||
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
|
|
||||||
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
|
|
||||||
- name: 'Restore OpenSSL build'
|
|
||||||
id: cache-openssl
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
|
|
||||||
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
|
|
||||||
- name: Install OpenSSL
|
|
||||||
if: steps.cache-openssl.outputs.cache-hit != 'true'
|
|
||||||
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
|
|
||||||
- name: Add ccache to PATH
|
|
||||||
run: |
|
|
||||||
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
|
|
||||||
- name: Configure ccache action
|
|
||||||
uses: hendrikmuhs/ccache-action@v1.2
|
|
||||||
- name: Setup directory envs for out-of-tree builds
|
|
||||||
run: |
|
|
||||||
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
|
|
||||||
echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
|
|
||||||
- name: Create directories for read-only out-of-tree builds
|
|
||||||
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
|
|
||||||
- name: Bind mount sources read-only
|
|
||||||
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
|
|
||||||
- name: Restore config.cache
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
|
|
||||||
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
|
|
||||||
- name: Configure CPython out-of-tree
|
|
||||||
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
|
||||||
run: |
|
|
||||||
../cpython-ro-srcdir/configure \
|
../cpython-ro-srcdir/configure \
|
||||||
--config-cache \
|
--config-cache \
|
||||||
--with-pydebug \
|
--with-pydebug \
|
||||||
--with-openssl=$OPENSSL_DIR
|
--with-openssl=$OPENSSL_DIR
|
||||||
- name: Build CPython out-of-tree
|
|
||||||
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
build_ubuntu_free_threaded:
|
||||||
run: make -j4
|
name: 'Ubuntu (free-threaded)'
|
||||||
- name: Display build info
|
needs: check_source
|
||||||
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
if: needs.check_source.outputs.run_tests == 'true' && contains(github.event.pull_request.labels.*.name, 'topic-free-threaded')
|
||||||
run: make pythoninfo
|
uses: ./.github/workflows/reusable-build-ubuntu.yml
|
||||||
- name: Remount sources writable for tests
|
with:
|
||||||
# some tests write to srcdir, lack of pyc files slows down testing
|
config_hash: ${{ needs.check_source.outputs.config_hash }}
|
||||||
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
|
options: |
|
||||||
- name: Tests
|
../cpython-ro-srcdir/configure \
|
||||||
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
--config-cache \
|
||||||
run: xvfb-run make test
|
--with-pydebug \
|
||||||
|
--with-openssl=$OPENSSL_DIR \
|
||||||
|
--disable-gil
|
||||||
|
|
||||||
build_ubuntu_ssltests:
|
build_ubuntu_ssltests:
|
||||||
name: 'Ubuntu SSL tests with OpenSSL'
|
name: 'Ubuntu SSL tests with OpenSSL'
|
||||||
|
@ -582,6 +542,7 @@ jobs:
|
||||||
- build_win_arm64
|
- build_win_arm64
|
||||||
- build_macos
|
- build_macos
|
||||||
- build_ubuntu
|
- build_ubuntu
|
||||||
|
- build_ubuntu_free_threaded
|
||||||
- build_ubuntu_ssltests
|
- build_ubuntu_ssltests
|
||||||
- test_hypothesis
|
- test_hypothesis
|
||||||
- build_asan
|
- build_asan
|
||||||
|
@ -595,6 +556,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
allowed-failures: >-
|
allowed-failures: >-
|
||||||
build_macos,
|
build_macos,
|
||||||
|
build_ubuntu_free_threaded,
|
||||||
build_ubuntu_ssltests,
|
build_ubuntu_ssltests,
|
||||||
build_win32,
|
build_win32,
|
||||||
build_win_arm64,
|
build_win_arm64,
|
||||||
|
@ -617,6 +579,7 @@ jobs:
|
||||||
build_win_arm64,
|
build_win_arm64,
|
||||||
build_macos,
|
build_macos,
|
||||||
build_ubuntu,
|
build_ubuntu,
|
||||||
|
build_ubuntu_free_threaded,
|
||||||
build_ubuntu_ssltests,
|
build_ubuntu_ssltests,
|
||||||
build_asan,
|
build_asan,
|
||||||
'
|
'
|
||||||
|
|
70
.github/workflows/reusable-build-ubuntu.yml
vendored
Normal file
70
.github/workflows/reusable-build-ubuntu.yml
vendored
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
config_hash:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
options:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_ubuntu_reusable:
|
||||||
|
timeout-minutes: 60
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
env:
|
||||||
|
OPENSSL_VER: 3.0.11
|
||||||
|
PYTHONSTRICTEXTENSIONBUILD: 1
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Register gcc problem matcher
|
||||||
|
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
|
||||||
|
- name: Install dependencies
|
||||||
|
run: sudo ./.github/workflows/posix-deps-apt.sh
|
||||||
|
- name: Configure OpenSSL env vars
|
||||||
|
run: |
|
||||||
|
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
|
||||||
|
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
|
||||||
|
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
|
||||||
|
- name: 'Restore OpenSSL build'
|
||||||
|
id: cache-openssl
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
|
||||||
|
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
|
||||||
|
- name: Install OpenSSL
|
||||||
|
if: steps.cache-openssl.outputs.cache-hit != 'true'
|
||||||
|
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
|
||||||
|
- name: Add ccache to PATH
|
||||||
|
run: |
|
||||||
|
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
|
||||||
|
- name: Configure ccache action
|
||||||
|
uses: hendrikmuhs/ccache-action@v1.2
|
||||||
|
- name: Setup directory envs for out-of-tree builds
|
||||||
|
run: |
|
||||||
|
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
|
||||||
|
echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
|
||||||
|
- name: Create directories for read-only out-of-tree builds
|
||||||
|
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
|
||||||
|
- name: Bind mount sources read-only
|
||||||
|
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
|
||||||
|
- name: Restore config.cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
|
||||||
|
key: ${{ github.job }}-${{ runner.os }}-${{ inputs.config_hash }}
|
||||||
|
- name: Configure CPython out-of-tree
|
||||||
|
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
||||||
|
run: ${{ inputs.options }}
|
||||||
|
- name: Build CPython out-of-tree
|
||||||
|
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
||||||
|
run: make -j4
|
||||||
|
- name: Display build info
|
||||||
|
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
||||||
|
run: make pythoninfo
|
||||||
|
- name: Remount sources writable for tests
|
||||||
|
# some tests write to srcdir, lack of pyc files slows down testing
|
||||||
|
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
|
||||||
|
- name: Tests
|
||||||
|
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
||||||
|
run: xvfb-run make test
|
Loading…
Add table
Add a link
Reference in a new issue