2024-10-10 09:39:53 -03:00
|
|
|
name: Reusable Ubuntu
|
|
|
|
|
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-09-24 22:27:23 -03:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2024-11-22 13:29:18 -04:00
|
|
|
os: [ubuntu-24.04, ubuntu-24.04-aarch64]
|
2023-10-30 11:28:16 -03:00
|
|
|
env:
|
2024-04-24 17:25:22 -03:00
|
|
|
FORCE_COLOR: 1
|
2024-09-04 15:16:53 -03:00
|
|
|
OPENSSL_VER: 3.0.15
|
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: |
|
2024-10-28 15:59:35 -03:00
|
|
|
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"
|
2023-10-30 11:28:16 -03:00
|
|
|
- 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 }}
|
2024-09-24 22:27:23 -03:00
|
|
|
key: ${{ matrix.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
|
2023-10-30 11:28:16 -03:00
|
|
|
- name: Install OpenSSL
|
|
|
|
if: steps.cache-openssl.outputs.cache-hit != 'true'
|
2024-10-28 15:59:35 -03:00
|
|
|
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory "$MULTISSL_DIR" --openssl "$OPENSSL_VER" --system Linux
|
2023-10-30 11:28:16 -03:00
|
|
|
- name: Add ccache to PATH
|
|
|
|
run: |
|
2024-10-28 15:59:35 -03:00
|
|
|
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
|
2023-10-30 11:28:16 -03:00
|
|
|
- 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: |
|
2024-10-28 15:59:35 -03:00
|
|
|
echo "CPYTHON_RO_SRCDIR=$(realpath -m "${GITHUB_WORKSPACE}"/../cpython-ro-srcdir)" >> "$GITHUB_ENV"
|
|
|
|
echo "CPYTHON_BUILDDIR=$(realpath -m "${GITHUB_WORKSPACE}"/../cpython-builddir)" >> "$GITHUB_ENV"
|
2023-10-30 11:28:16 -03:00
|
|
|
- name: Create directories for read-only out-of-tree builds
|
2024-10-28 15:59:35 -03:00
|
|
|
run: mkdir -p "$CPYTHON_RO_SRCDIR" "$CPYTHON_BUILDDIR"
|
2023-10-30 11:28:16 -03:00
|
|
|
- name: Bind mount sources read-only
|
2024-10-28 15:59:35 -03:00
|
|
|
run: sudo mount --bind -o ro "$GITHUB_WORKSPACE" "$CPYTHON_RO_SRCDIR"
|
2024-02-13 15:35:06 -04:00
|
|
|
- name: Runner image version
|
2024-10-28 15:59:35 -03:00
|
|
|
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
|
|
|
|
--config-cache
|
|
|
|
--with-pydebug
|
2024-07-22 21:22:04 -03:00
|
|
|
--enable-slower-safety
|
2024-09-16 14:22:30 -03:00
|
|
|
--enable-safety
|
2024-10-28 15:59:35 -03:00
|
|
|
--with-openssl="$OPENSSL_DIR"
|
2024-07-21 16:09:23 -03:00
|
|
|
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
|
2023-10-30 11:28:16 -03:00
|
|
|
- name: Build CPython out-of-tree
|
2024-09-16 14:22:30 -03:00
|
|
|
if: ${{ inputs.free-threading }}
|
2023-10-30 11:28:16 -03:00
|
|
|
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
2024-11-22 13:29:18 -04:00
|
|
|
run: make -j
|
2024-09-16 14:22:30 -03:00
|
|
|
- name: Build CPython out-of-tree (for compiler warning check)
|
|
|
|
if: ${{ !inputs.free-threading}}
|
|
|
|
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
2024-11-22 13:29:18 -04:00
|
|
|
run: set -o pipefail; make -j --output-sync 2>&1 | tee compiler_output_ubuntu.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-09-16 14:22:30 -03:00
|
|
|
if: ${{ !inputs.free-threading }}
|
|
|
|
run: >-
|
|
|
|
python Tools/build/check_warnings.py
|
|
|
|
--compiler-output-file-path=${{ env.CPYTHON_BUILDDIR }}/compiler_output_ubuntu.txt
|
2024-10-28 15:59:35 -03:00
|
|
|
--warning-ignore-file-path "${GITHUB_WORKSPACE}/Tools/build/.warningignore_ubuntu"
|
2024-09-16 14:22:30 -03:00
|
|
|
--compiler-output-type=gcc
|
|
|
|
--fail-on-regression
|
|
|
|
--fail-on-improvement
|
|
|
|
--path-prefix="../cpython-ro-srcdir/"
|
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
|
2024-10-28 15:59:35 -03:00
|
|
|
run: sudo mount "$CPYTHON_RO_SRCDIR" -oremount,rw
|
2023-10-30 11:28:16 -03:00
|
|
|
- name: Tests
|
|
|
|
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
2024-10-30 11:14:22 -03:00
|
|
|
run: xvfb-run make ci
|