2023-10-30 11:28:16 -03:00
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
config_hash:
|
|
|
|
required: true
|
|
|
|
type: string
|
2024-07-21 16:09:23 -03:00
|
|
|
free-threading:
|
|
|
|
description: Whether to use free-threaded mode
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2023-10-30 11:28:16 -03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build_ubuntu_reusable:
|
2023-10-30 12:15:22 -03:00
|
|
|
name: 'build and test'
|
2023-10-30 11:28:16 -03:00
|
|
|
timeout-minutes: 60
|
2024-05-06 05:39:43 -03:00
|
|
|
runs-on: ubuntu-22.04
|
2023-10-30 11:28:16 -03:00
|
|
|
env:
|
2024-04-24 17:25:22 -03:00
|
|
|
FORCE_COLOR: 1
|
2024-02-05 22:10:11 -04:00
|
|
|
OPENSSL_VER: 3.0.13
|
2023-10-30 11:28:16 -03:00
|
|
|
PYTHONSTRICTEXTENSIONBUILD: 1
|
2024-05-05 16:32:23 -03:00
|
|
|
TERM: linux
|
2023-10-30 11:28:16 -03:00
|
|
|
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
|
2024-02-01 06:49:07 -04:00
|
|
|
uses: actions/cache@v4
|
2023-10-30 11:28:16 -03:00
|
|
|
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
|
2024-01-10 04:49:18 -04:00
|
|
|
with:
|
|
|
|
save: ${{ github.event_name == 'push' }}
|
2024-01-12 05:48:25 -04:00
|
|
|
max-size: "200M"
|
2023-10-30 11:28:16 -03:00
|
|
|
- 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
|
2024-02-13 15:35:06 -04:00
|
|
|
- name: Runner image version
|
|
|
|
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
|
2023-10-30 11:28:16 -03:00
|
|
|
- name: Restore config.cache
|
2024-02-01 06:49:07 -04:00
|
|
|
uses: actions/cache@v4
|
2023-10-30 11:28:16 -03:00
|
|
|
with:
|
|
|
|
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
|
2024-02-13 15:35:06 -04:00
|
|
|
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
|
2023-10-30 11:28:16 -03:00
|
|
|
- name: Configure CPython out-of-tree
|
|
|
|
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
2024-07-21 16:09:23 -03:00
|
|
|
run: >-
|
|
|
|
../cpython-ro-srcdir/configure
|
2024-07-27 06:57:44 -03:00
|
|
|
CFLAGS="-fdiagnostics-format=json"
|
2024-07-21 16:09:23 -03:00
|
|
|
--config-cache
|
|
|
|
--with-pydebug
|
2024-07-22 21:22:04 -03:00
|
|
|
--enable-slower-safety
|
2024-07-21 16:09:23 -03:00
|
|
|
--with-openssl=$OPENSSL_DIR
|
|
|
|
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
|
2023-10-30 11:28:16 -03:00
|
|
|
- name: Build CPython out-of-tree
|
|
|
|
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
2024-07-30 16:49:15 -03:00
|
|
|
run: set -o pipefail; make -j4 2>&1 | tee compiler_output.txt
|
2023-10-30 11:28:16 -03:00
|
|
|
- name: Display build info
|
|
|
|
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
|
|
|
run: make pythoninfo
|
2024-07-27 06:57:44 -03:00
|
|
|
- name: Check compiler warnings
|
2024-08-06 14:26:37 -03:00
|
|
|
run: python Tools/build/check_warnings.py --compiler-output-file-path=${{ env.CPYTHON_BUILDDIR }}/compiler_output.txt --warning-ignore-file-path ${GITHUB_WORKSPACE}/Tools/build/.warningignore_ubuntu --compiler-output-type=json
|
2023-10-30 11:28:16 -03:00
|
|
|
- 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
|