2019-12-16 14:35:22 -04:00
|
|
|
name: Tests
|
|
|
|
|
2022-04-10 19:03:27 -03:00
|
|
|
# gh-84728: "paths-ignore" is not used to skip documentation-only PRs, because
|
2020-05-07 17:42:14 -03:00
|
|
|
# it prevents to mark a job as mandatory. A PR cannot be merged if a job is
|
|
|
|
# mandatory but not scheduled because of "paths-ignore".
|
2019-12-16 14:35:22 -04:00
|
|
|
on:
|
2021-10-21 17:34:18 -03:00
|
|
|
workflow_dispatch:
|
2019-12-16 15:15:08 -04:00
|
|
|
push:
|
|
|
|
branches:
|
2021-05-19 12:14:37 -03:00
|
|
|
- 'main'
|
2024-05-08 15:12:36 -03:00
|
|
|
- '3.*'
|
2019-12-16 14:35:22 -04:00
|
|
|
pull_request:
|
|
|
|
branches:
|
2021-05-19 12:14:37 -03:00
|
|
|
- 'main'
|
2024-05-08 15:12:36 -03:00
|
|
|
- '3.*'
|
2019-12-16 14:35:22 -04:00
|
|
|
|
2022-05-21 04:55:21 -03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-10-08 16:21:38 -03:00
|
|
|
concurrency:
|
2023-05-28 12:21:29 -03:00
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-reusable
|
2022-10-08 16:21:38 -03:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
2019-12-16 14:35:22 -04:00
|
|
|
jobs:
|
2020-05-14 19:11:40 -03:00
|
|
|
check_source:
|
|
|
|
name: 'Check for source changes'
|
|
|
|
runs-on: ubuntu-latest
|
2023-04-14 06:01:10 -03:00
|
|
|
timeout-minutes: 10
|
2020-05-14 19:11:40 -03:00
|
|
|
outputs:
|
2024-07-16 09:50:30 -03:00
|
|
|
# Some of the referenced steps set outputs conditionally and there may be
|
|
|
|
# cases when referencing them evaluates to empty strings. It is nice to
|
|
|
|
# work with proper booleans so they have to be evaluated through JSON
|
|
|
|
# conversion in the expressions. However, empty strings used like that
|
|
|
|
# may trigger all sorts of undefined and hard-to-debug behaviors in
|
|
|
|
# GitHub Actions CI/CD. To help with this, all of the outputs set here
|
|
|
|
# that are meant to be used as boolean flags (and not arbitrary strings),
|
|
|
|
# MUST have fallbacks with default values set. A common pattern would be
|
|
|
|
# to add ` || false` to all such expressions here, in the output
|
|
|
|
# definitions. They can then later be safely used through the following
|
|
|
|
# idiom in job conditionals and other expressions. Here's some examples:
|
|
|
|
#
|
|
|
|
# if: fromJSON(needs.check_source.outputs.run-docs)
|
|
|
|
#
|
|
|
|
# ${{
|
|
|
|
# fromJSON(needs.check_source.outputs.run_tests)
|
|
|
|
# && 'truthy-branch'
|
|
|
|
# || 'falsy-branch'
|
|
|
|
# }}
|
|
|
|
#
|
2023-05-28 12:21:29 -03:00
|
|
|
run-docs: ${{ steps.docs-changes.outputs.run-docs || false }}
|
2024-07-24 06:46:39 -03:00
|
|
|
run-win-msi: ${{ steps.win-msi-changes.outputs.run-win-msi || false }}
|
2024-07-16 09:50:30 -03:00
|
|
|
run_tests: ${{ steps.check.outputs.run_tests || false }}
|
|
|
|
run_hypothesis: ${{ steps.check.outputs.run_hypothesis || false }}
|
|
|
|
run_cifuzz: ${{ steps.check.outputs.run_cifuzz || false }}
|
|
|
|
config_hash: ${{ steps.config_hash.outputs.hash }} # str
|
2020-05-14 19:11:40 -03:00
|
|
|
steps:
|
2023-09-04 17:36:16 -03:00
|
|
|
- uses: actions/checkout@v4
|
2020-05-14 19:11:40 -03:00
|
|
|
- name: Check for source changes
|
|
|
|
id: check
|
|
|
|
run: |
|
2020-12-30 10:53:58 -04:00
|
|
|
if [ -z "$GITHUB_BASE_REF" ]; then
|
2022-10-23 02:23:40 -03:00
|
|
|
echo "run_tests=true" >> $GITHUB_OUTPUT
|
2020-05-14 19:11:40 -03:00
|
|
|
else
|
|
|
|
git fetch origin $GITHUB_BASE_REF --depth=1
|
2020-08-10 13:36:59 -03:00
|
|
|
# git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more
|
|
|
|
# reliable than git diff "origin/$GITHUB_BASE_REF.." (2 dots),
|
|
|
|
# but it requires to download more commits (this job uses
|
|
|
|
# "git fetch --depth=1").
|
|
|
|
#
|
|
|
|
# git diff "origin/$GITHUB_BASE_REF..." (3 dots) works with Git
|
|
|
|
# 2.26, but Git 2.28 is stricter and fails with "no merge base".
|
|
|
|
#
|
|
|
|
# git diff "origin/$GITHUB_BASE_REF.." (2 dots) should be enough on
|
|
|
|
# GitHub, since GitHub starts by merging origin/$GITHUB_BASE_REF
|
|
|
|
# into the PR branch anyway.
|
|
|
|
#
|
|
|
|
# https://github.com/python/core-workflow/issues/373
|
2024-06-13 08:38:31 -03:00
|
|
|
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$|\.md$|mypy\.ini$)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
|
2020-05-14 19:11:40 -03:00
|
|
|
fi
|
2020-11-20 10:14:16 -04:00
|
|
|
|
2023-05-12 09:35:53 -03:00
|
|
|
# Check if we should run hypothesis tests
|
|
|
|
GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
|
|
|
|
echo $GIT_BRANCH
|
|
|
|
if $(echo "$GIT_BRANCH" | grep -q -w '3\.\(8\|9\|10\|11\)'); then
|
|
|
|
echo "Branch too old for hypothesis tests"
|
|
|
|
echo "run_hypothesis=false" >> $GITHUB_OUTPUT
|
|
|
|
else
|
|
|
|
echo "Run hypothesis tests"
|
|
|
|
echo "run_hypothesis=true" >> $GITHUB_OUTPUT
|
|
|
|
fi
|
2023-10-09 12:30:10 -03:00
|
|
|
|
|
|
|
# oss-fuzz maintains a configuration for fuzzing the main branch of
|
|
|
|
# CPython, so CIFuzz should be run only for code that is likely to be
|
|
|
|
# merged into the main branch; compatibility with older branches may
|
|
|
|
# be broken.
|
2023-10-10 03:44:57 -03:00
|
|
|
FUZZ_RELEVANT_FILES='(\.c$|\.h$|\.cpp$|^configure$|^\.github/workflows/build\.yml$|^Modules/_xxtestfuzz)'
|
2023-10-10 06:34:48 -03:00
|
|
|
if [ "$GITHUB_BASE_REF" = "main" ] && [ "$(git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qE $FUZZ_RELEVANT_FILES; echo $?)" -eq 0 ]; then
|
2023-10-09 12:30:10 -03:00
|
|
|
# The tests are pretty slow so they are executed only for PRs
|
|
|
|
# changing relevant files.
|
2023-10-10 03:44:57 -03:00
|
|
|
echo "Run CIFuzz tests"
|
|
|
|
echo "run_cifuzz=true" >> $GITHUB_OUTPUT
|
|
|
|
else
|
|
|
|
echo "Branch too old for CIFuzz tests; or no C files were changed"
|
|
|
|
echo "run_cifuzz=false" >> $GITHUB_OUTPUT
|
2023-10-09 12:30:10 -03:00
|
|
|
fi
|
2023-05-27 06:43:50 -03:00
|
|
|
- name: Compute hash for config cache key
|
|
|
|
id: config_hash
|
|
|
|
run: |
|
|
|
|
echo "hash=${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}" >> $GITHUB_OUTPUT
|
2023-05-28 12:21:29 -03:00
|
|
|
- name: Get a list of the changed documentation-related files
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
id: changed-docs-files
|
2024-03-18 05:44:15 -03:00
|
|
|
uses: Ana06/get-changed-files@v2.3.0
|
2023-05-28 12:21:29 -03:00
|
|
|
with:
|
|
|
|
filter: |
|
|
|
|
Doc/**
|
2023-06-21 07:42:59 -03:00
|
|
|
Misc/**
|
2023-05-28 12:21:29 -03:00
|
|
|
.github/workflows/reusable-docs.yml
|
2023-06-21 07:42:59 -03:00
|
|
|
format: csv # works for paths with spaces
|
2023-05-28 12:21:29 -03:00
|
|
|
- name: Check for docs changes
|
|
|
|
if: >-
|
|
|
|
github.event_name == 'pull_request'
|
|
|
|
&& steps.changed-docs-files.outputs.added_modified_renamed != ''
|
|
|
|
id: docs-changes
|
|
|
|
run: |
|
|
|
|
echo "run-docs=true" >> "${GITHUB_OUTPUT}"
|
2024-07-24 06:46:39 -03:00
|
|
|
- name: Get a list of the MSI installer-related files
|
|
|
|
id: changed-win-msi-files
|
|
|
|
uses: Ana06/get-changed-files@v2.3.0
|
|
|
|
with:
|
|
|
|
filter: |
|
|
|
|
Tools/msi/**
|
|
|
|
.github/workflows/reusable-windows-msi.yml
|
|
|
|
format: csv # works for paths with spaces
|
|
|
|
- name: Check for changes in MSI installer-related files
|
|
|
|
if: >-
|
|
|
|
steps.changed-win-msi-files.outputs.added_modified_renamed != ''
|
|
|
|
id: win-msi-changes
|
|
|
|
run: |
|
|
|
|
echo "run-win-msi=true" >> "${GITHUB_OUTPUT}"
|
2023-05-28 12:21:29 -03:00
|
|
|
|
|
|
|
check-docs:
|
|
|
|
name: Docs
|
|
|
|
needs: check_source
|
|
|
|
if: fromJSON(needs.check_source.outputs.run-docs)
|
|
|
|
uses: ./.github/workflows/reusable-docs.yml
|
2023-05-12 09:35:53 -03:00
|
|
|
|
2020-11-20 10:14:16 -04:00
|
|
|
check_generated_files:
|
|
|
|
name: 'Check if generated files are up to date'
|
2023-11-15 16:47:14 -04:00
|
|
|
# Don't use ubuntu-latest but a specific version to make the job
|
|
|
|
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
|
|
|
|
runs-on: ubuntu-22.04
|
2023-04-14 06:01:10 -03:00
|
|
|
timeout-minutes: 60
|
2020-11-20 10:14:16 -04:00
|
|
|
needs: check_source
|
|
|
|
if: needs.check_source.outputs.run_tests == 'true'
|
|
|
|
steps:
|
2023-09-04 17:36:16 -03:00
|
|
|
- uses: actions/checkout@v4
|
2024-01-01 05:25:58 -04:00
|
|
|
- uses: actions/setup-python@v5
|
2023-10-28 04:23:47 -03:00
|
|
|
with:
|
|
|
|
python-version: '3.x'
|
2024-02-13 15:35:06 -04:00
|
|
|
- name: Runner image version
|
|
|
|
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
|
2023-05-25 08:09:57 -03:00
|
|
|
- name: Restore config.cache
|
2024-02-01 06:49:07 -04:00
|
|
|
uses: actions/cache@v4
|
2023-05-25 08:09:57 -03:00
|
|
|
with:
|
|
|
|
path: config.cache
|
2024-04-23 04:46:28 -03:00
|
|
|
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python
|
2024-02-13 15:35:06 -04:00
|
|
|
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}-${{ env.pythonLocation }}
|
2020-11-20 10:14:16 -04:00
|
|
|
- name: Install Dependencies
|
|
|
|
run: sudo ./.github/workflows/posix-deps-apt.sh
|
2021-12-06 08:18:56 -04:00
|
|
|
- name: Add ccache to PATH
|
|
|
|
run: echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
|
|
|
|
- name: Configure ccache action
|
2022-10-11 10:15:14 -03:00
|
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
2024-01-10 04:49:18 -04:00
|
|
|
with:
|
2024-01-12 05:48:25 -04:00
|
|
|
save: false
|
2023-06-01 18:44:25 -03:00
|
|
|
- name: Check Autoconf and aclocal versions
|
2021-12-06 08:18:56 -04:00
|
|
|
run: |
|
2023-06-01 18:44:25 -03:00
|
|
|
grep "Generated by GNU Autoconf 2.71" configure
|
2023-11-15 16:47:14 -04:00
|
|
|
grep "aclocal 1.16.5" aclocal.m4
|
2021-12-06 08:18:56 -04:00
|
|
|
grep -q "runstatedir" configure
|
|
|
|
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
|
2022-03-10 13:03:27 -04:00
|
|
|
- name: Configure CPython
|
2020-11-20 10:14:16 -04:00
|
|
|
run: |
|
2020-11-24 08:38:08 -04:00
|
|
|
# Build Python with the libpython dynamic library
|
2023-05-25 08:09:57 -03:00
|
|
|
./configure --config-cache --with-pydebug --enable-shared
|
2023-11-15 16:47:14 -04:00
|
|
|
- name: Regenerate autoconf files
|
|
|
|
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
|
|
|
|
run: autoreconf -ivf -Werror
|
2022-03-10 13:03:27 -04:00
|
|
|
- name: Build CPython
|
|
|
|
run: |
|
2020-11-20 10:14:16 -04:00
|
|
|
make -j4 regen-all
|
2024-02-22 09:42:26 -04:00
|
|
|
make regen-stdlib-module-names regen-sbom
|
2020-11-20 10:14:16 -04:00
|
|
|
- name: Check for changes
|
|
|
|
run: |
|
2021-08-30 20:25:11 -03:00
|
|
|
git add -u
|
2020-11-20 10:14:16 -04:00
|
|
|
changes=$(git status --porcelain)
|
|
|
|
# Check for changes in regenerated files
|
2021-12-06 08:18:56 -04:00
|
|
|
if test -n "$changes"; then
|
|
|
|
echo "Generated files not up to date."
|
|
|
|
echo "Perhaps you forgot to run make regen-all or build.bat --regen. ;)"
|
2021-12-17 11:17:56 -04:00
|
|
|
echo "configure files must be regenerated with a specific version of autoconf."
|
2020-11-20 10:14:16 -04:00
|
|
|
echo "$changes"
|
2021-12-17 11:17:56 -04:00
|
|
|
echo ""
|
|
|
|
git diff --staged || true
|
2020-11-20 10:14:16 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
- name: Check exported libpython symbols
|
|
|
|
run: make smelly
|
2020-12-04 18:05:58 -04:00
|
|
|
- name: Check limited ABI symbols
|
|
|
|
run: make check-limited-abi
|
2023-03-14 13:05:54 -03:00
|
|
|
- name: Check for unsupported C global variables
|
|
|
|
if: github.event_name == 'pull_request' # $GITHUB_EVENT_NAME
|
|
|
|
run: make check-c-globals
|
2020-11-20 10:14:16 -04:00
|
|
|
|
2023-10-30 12:30:40 -03:00
|
|
|
build_windows:
|
2024-07-14 18:22:35 -03:00
|
|
|
name: >-
|
|
|
|
Windows
|
|
|
|
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
|
2020-05-14 19:11:40 -03:00
|
|
|
needs: check_source
|
2024-07-14 18:22:35 -03:00
|
|
|
if: fromJSON(needs.check_source.outputs.run_tests)
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
arch:
|
|
|
|
- Win32
|
|
|
|
- x64
|
|
|
|
- arm64
|
|
|
|
free-threading:
|
|
|
|
- false
|
|
|
|
- true
|
2023-10-31 12:55:17 -03:00
|
|
|
uses: ./.github/workflows/reusable-windows.yml
|
2023-10-30 12:30:40 -03:00
|
|
|
with:
|
2024-07-14 18:22:35 -03:00
|
|
|
arch: ${{ matrix.arch }}
|
|
|
|
free-threading: ${{ matrix.free-threading }}
|
2023-09-20 15:56:42 -03:00
|
|
|
|
2024-07-24 06:46:39 -03:00
|
|
|
build_windows_msi:
|
|
|
|
name: >- # ${{ '' } is a hack to nest jobs under the same sidebar category
|
|
|
|
Windows MSI${{ '' }}
|
|
|
|
needs: check_source
|
|
|
|
if: fromJSON(needs.check_source.outputs.run-win-msi)
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
arch:
|
|
|
|
- x86
|
|
|
|
- x64
|
|
|
|
- arm64
|
|
|
|
uses: ./.github/workflows/reusable-windows-msi.yml
|
|
|
|
with:
|
|
|
|
arch: ${{ matrix.arch }}
|
|
|
|
|
2019-12-16 14:35:22 -04:00
|
|
|
build_macos:
|
2024-07-25 17:27:26 -03:00
|
|
|
name: >-
|
|
|
|
macOS
|
|
|
|
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
|
2023-10-29 04:20:11 -03:00
|
|
|
needs: check_source
|
2023-11-28 11:45:03 -04:00
|
|
|
if: needs.check_source.outputs.run_tests == 'true'
|
2024-07-25 17:27:26 -03:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
# Cirrus and macos-14 are M1, macos-13 is default GHA Intel.
|
|
|
|
# macOS 13 only runs tests against the GIL-enabled CPython.
|
|
|
|
# Cirrus used for upstream, macos-14 for forks.
|
|
|
|
os:
|
|
|
|
- ghcr.io/cirruslabs/macos-runner:sonoma
|
|
|
|
- macos-14
|
|
|
|
- macos-13
|
|
|
|
is-fork: # only used for the exclusion trick
|
|
|
|
- ${{ github.repository_owner != 'python' }}
|
|
|
|
free-threading:
|
|
|
|
- false
|
|
|
|
- true
|
|
|
|
exclude:
|
|
|
|
- os: ghcr.io/cirruslabs/macos-runner:sonoma
|
|
|
|
is-fork: true
|
|
|
|
- os: macos-14
|
|
|
|
is-fork: false
|
|
|
|
- os: macos-13
|
|
|
|
free-threading: true
|
2023-10-31 12:55:17 -03:00
|
|
|
uses: ./.github/workflows/reusable-macos.yml
|
2023-10-29 04:20:11 -03:00
|
|
|
with:
|
|
|
|
config_hash: ${{ needs.check_source.outputs.config_hash }}
|
2024-07-25 17:27:26 -03:00
|
|
|
free-threading: ${{ matrix.free-threading }}
|
|
|
|
os: ${{ matrix.os }}
|
2023-10-29 04:20:11 -03:00
|
|
|
|
2019-12-16 14:35:22 -04:00
|
|
|
build_ubuntu:
|
2024-07-21 16:09:23 -03:00
|
|
|
name: >-
|
|
|
|
Ubuntu
|
|
|
|
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
|
2023-10-30 11:28:16 -03:00
|
|
|
needs: check_source
|
2023-11-28 11:45:03 -04:00
|
|
|
if: needs.check_source.outputs.run_tests == 'true'
|
2024-07-21 16:09:23 -03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
free-threading:
|
|
|
|
- false
|
|
|
|
- true
|
2023-10-31 12:55:17 -03:00
|
|
|
uses: ./.github/workflows/reusable-ubuntu.yml
|
2023-10-30 11:28:16 -03:00
|
|
|
with:
|
|
|
|
config_hash: ${{ needs.check_source.outputs.config_hash }}
|
2024-07-21 16:09:23 -03:00
|
|
|
free-threading: ${{ matrix.free-threading }}
|
2021-04-13 14:23:45 -03:00
|
|
|
|
|
|
|
build_ubuntu_ssltests:
|
2021-05-01 19:02:30 -03:00
|
|
|
name: 'Ubuntu SSL tests with OpenSSL'
|
2024-05-06 05:39:43 -03:00
|
|
|
runs-on: ubuntu-22.04
|
2023-04-14 06:01:10 -03:00
|
|
|
timeout-minutes: 60
|
2021-04-13 14:23:45 -03:00
|
|
|
needs: check_source
|
2022-10-07 15:58:46 -03:00
|
|
|
if: needs.check_source.outputs.run_tests == 'true'
|
2021-04-13 14:23:45 -03:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2024-02-05 22:10:11 -04:00
|
|
|
openssl_ver: [1.1.1w, 3.0.13, 3.1.5, 3.2.1]
|
2021-04-13 14:23:45 -03:00
|
|
|
env:
|
|
|
|
OPENSSL_VER: ${{ matrix.openssl_ver }}
|
|
|
|
MULTISSL_DIR: ${{ github.workspace }}/multissl
|
|
|
|
OPENSSL_DIR: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}
|
|
|
|
LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib
|
|
|
|
steps:
|
2023-09-04 17:36:16 -03:00
|
|
|
- uses: actions/checkout@v4
|
2024-02-13 15:35:06 -04:00
|
|
|
- name: Runner image version
|
|
|
|
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
|
2023-05-25 08:09:57 -03:00
|
|
|
- name: Restore config.cache
|
2024-02-01 06:49:07 -04:00
|
|
|
uses: actions/cache@v4
|
2023-05-25 08:09:57 -03:00
|
|
|
with:
|
|
|
|
path: config.cache
|
2024-02-13 15:35:06 -04:00
|
|
|
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}
|
2021-04-13 14:23:45 -03:00
|
|
|
- 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
|
2021-04-13 14:23:45 -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
|
2022-10-11 10:15:14 -03:00
|
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
2024-01-10 04:49:18 -04:00
|
|
|
with:
|
2024-01-12 05:48:25 -04:00
|
|
|
save: false
|
2021-04-13 14:23:45 -03:00
|
|
|
- name: Configure CPython
|
2024-07-22 21:22:04 -03:00
|
|
|
run: ./configure --config-cache --enable-slower-safety --with-pydebug --with-openssl=$OPENSSL_DIR
|
2021-04-13 14:23:45 -03:00
|
|
|
- name: Build CPython
|
|
|
|
run: make -j4
|
|
|
|
- name: Display build info
|
|
|
|
run: make pythoninfo
|
|
|
|
- name: SSL tests
|
|
|
|
run: ./python Lib/test/ssltests.py
|
2021-06-10 14:47:53 -03:00
|
|
|
|
2024-03-11 15:59:09 -03:00
|
|
|
build_wasi:
|
|
|
|
name: 'WASI'
|
|
|
|
needs: check_source
|
|
|
|
if: needs.check_source.outputs.run_tests == 'true'
|
|
|
|
uses: ./.github/workflows/reusable-wasi.yml
|
|
|
|
with:
|
|
|
|
config_hash: ${{ needs.check_source.outputs.config_hash }}
|
|
|
|
|
2023-05-12 09:35:53 -03:00
|
|
|
test_hypothesis:
|
2023-05-25 08:09:57 -03:00
|
|
|
name: "Hypothesis tests on Ubuntu"
|
2024-05-06 05:39:43 -03:00
|
|
|
runs-on: ubuntu-22.04
|
2023-05-12 09:35:53 -03:00
|
|
|
timeout-minutes: 60
|
|
|
|
needs: check_source
|
|
|
|
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
|
|
|
|
env:
|
2024-02-05 22:10:11 -04:00
|
|
|
OPENSSL_VER: 3.0.13
|
2023-05-12 09:35:53 -03:00
|
|
|
PYTHONSTRICTEXTENSIONBUILD: 1
|
|
|
|
steps:
|
2023-09-04 17:36:16 -03:00
|
|
|
- uses: actions/checkout@v4
|
2023-05-12 09:35:53 -03:00
|
|
|
- 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-05-12 09:35:53 -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:
|
2024-01-12 05:48:25 -04:00
|
|
|
save: false
|
2023-05-12 09:35:53 -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-05-25 08:09:57 -03:00
|
|
|
- name: Restore config.cache
|
2024-02-01 06:49:07 -04:00
|
|
|
uses: actions/cache@v4
|
2023-05-25 08:09:57 -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 }}-${{ needs.check_source.outputs.config_hash }}
|
2023-05-12 09:35:53 -03:00
|
|
|
- name: Configure CPython out-of-tree
|
|
|
|
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
2023-05-25 08:09:57 -03:00
|
|
|
run: |
|
|
|
|
../cpython-ro-srcdir/configure \
|
|
|
|
--config-cache \
|
|
|
|
--with-pydebug \
|
2024-07-22 21:22:04 -03:00
|
|
|
--enable-slower-safety \
|
2023-05-25 08:09:57 -03:00
|
|
|
--with-openssl=$OPENSSL_DIR
|
2023-05-12 09:35:53 -03:00
|
|
|
- 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: Setup directory envs for out-of-tree builds
|
|
|
|
run: |
|
|
|
|
echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
|
|
|
|
- name: "Create hypothesis venv"
|
|
|
|
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
|
|
|
run: |
|
|
|
|
VENV_LOC=$(realpath -m .)/hypovenv
|
|
|
|
VENV_PYTHON=$VENV_LOC/bin/python
|
|
|
|
echo "HYPOVENV=${VENV_LOC}" >> $GITHUB_ENV
|
|
|
|
echo "VENV_PYTHON=${VENV_PYTHON}" >> $GITHUB_ENV
|
2023-09-04 15:31:58 -03:00
|
|
|
./python -m venv $VENV_LOC && $VENV_PYTHON -m pip install -r ${GITHUB_WORKSPACE}/Tools/requirements-hypothesis.txt
|
2023-05-21 08:52:29 -03:00
|
|
|
- name: 'Restore Hypothesis database'
|
|
|
|
id: cache-hypothesis-database
|
2024-02-01 06:49:07 -04:00
|
|
|
uses: actions/cache@v4
|
2023-05-21 08:52:29 -03:00
|
|
|
with:
|
2024-05-29 09:13:18 -03:00
|
|
|
path: ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/
|
2023-05-21 08:52:29 -03:00
|
|
|
key: hypothesis-database-${{ github.head_ref || github.run_id }}
|
|
|
|
restore-keys: |
|
2024-07-14 08:00:32 -03:00
|
|
|
hypothesis-database-
|
2023-05-12 09:35:53 -03:00
|
|
|
- name: "Run tests"
|
|
|
|
working-directory: ${{ env.CPYTHON_BUILDDIR }}
|
|
|
|
run: |
|
|
|
|
# Most of the excluded tests are slow test suites with no property tests
|
|
|
|
#
|
|
|
|
# (GH-104097) test_sysconfig is skipped because it has tests that are
|
|
|
|
# failing when executed from inside a virtual environment.
|
|
|
|
${{ env.VENV_PYTHON }} -m test \
|
|
|
|
-W \
|
2023-05-12 13:23:08 -03:00
|
|
|
-o \
|
|
|
|
-j4 \
|
2023-05-12 09:35:53 -03:00
|
|
|
-x test_asyncio \
|
|
|
|
-x test_multiprocessing_fork \
|
|
|
|
-x test_multiprocessing_forkserver \
|
|
|
|
-x test_multiprocessing_spawn \
|
|
|
|
-x test_concurrent_futures \
|
|
|
|
-x test_socket \
|
|
|
|
-x test_subprocess \
|
|
|
|
-x test_signal \
|
|
|
|
-x test_sysconfig
|
2024-01-02 12:20:17 -04:00
|
|
|
- uses: actions/upload-artifact@v4
|
2023-05-21 08:52:29 -03:00
|
|
|
if: always()
|
|
|
|
with:
|
|
|
|
name: hypothesis-example-db
|
2024-05-29 09:13:18 -03:00
|
|
|
path: ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/examples/
|
2023-05-12 09:35:53 -03:00
|
|
|
|
2021-06-10 14:47:53 -03:00
|
|
|
|
|
|
|
build_asan:
|
|
|
|
name: 'Address sanitizer'
|
2024-05-06 05:39:43 -03:00
|
|
|
runs-on: ubuntu-22.04
|
2023-04-14 06:01:10 -03:00
|
|
|
timeout-minutes: 60
|
2021-06-10 14:47:53 -03:00
|
|
|
needs: check_source
|
|
|
|
if: needs.check_source.outputs.run_tests == 'true'
|
|
|
|
env:
|
2024-02-05 22:10:11 -04:00
|
|
|
OPENSSL_VER: 3.0.13
|
2021-07-30 11:21:09 -03:00
|
|
|
PYTHONSTRICTEXTENSIONBUILD: 1
|
2021-06-10 14:47:53 -03:00
|
|
|
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
|
|
|
|
steps:
|
2023-09-04 17:36:16 -03:00
|
|
|
- uses: actions/checkout@v4
|
2024-02-13 15:35:06 -04:00
|
|
|
- name: Runner image version
|
|
|
|
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
|
2023-05-25 08:09:57 -03:00
|
|
|
- name: Restore config.cache
|
2024-02-01 06:49:07 -04:00
|
|
|
uses: actions/cache@v4
|
2023-05-25 08:09:57 -03:00
|
|
|
with:
|
|
|
|
path: config.cache
|
2024-02-13 15:35:06 -04:00
|
|
|
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}
|
2021-06-10 14:47:53 -03:00
|
|
|
- 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
|
2023-04-25 09:13:36 -03:00
|
|
|
- name: Set up GCC-10 for ASAN
|
|
|
|
uses: egor-tensin/setup-gcc@v1
|
|
|
|
with:
|
|
|
|
version: 10
|
2021-06-10 14:47:53 -03:00
|
|
|
- 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
|
2021-06-10 14:47:53 -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
|
2022-10-11 10:15:14 -03:00
|
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
2024-01-10 04:49:18 -04:00
|
|
|
with:
|
|
|
|
save: ${{ github.event_name == 'push' }}
|
2024-01-16 09:21:16 -04:00
|
|
|
max-size: "200M"
|
2021-06-10 14:47:53 -03:00
|
|
|
- name: Configure CPython
|
2023-05-25 08:09:57 -03:00
|
|
|
run: ./configure --config-cache --with-address-sanitizer --without-pymalloc
|
2021-06-10 14:47:53 -03:00
|
|
|
- name: Build CPython
|
|
|
|
run: make -j4
|
|
|
|
- name: Display build info
|
|
|
|
run: make pythoninfo
|
|
|
|
- name: Tests
|
2023-09-26 12:22:50 -03:00
|
|
|
run: xvfb-run make test
|
2023-07-06 12:06:18 -03:00
|
|
|
|
2024-03-16 07:10:37 -03:00
|
|
|
build_tsan:
|
|
|
|
name: 'Thread sanitizer'
|
|
|
|
needs: check_source
|
|
|
|
if: needs.check_source.outputs.run_tests == 'true'
|
|
|
|
uses: ./.github/workflows/reusable-tsan.yml
|
|
|
|
with:
|
|
|
|
config_hash: ${{ needs.check_source.outputs.config_hash }}
|
|
|
|
options: ./configure --config-cache --with-thread-sanitizer --with-pydebug
|
2024-04-15 13:08:25 -03:00
|
|
|
suppressions_path: Tools/tsan/supressions.txt
|
2024-05-10 18:54:23 -03:00
|
|
|
tsan_logs_artifact_name: tsan-logs-default
|
2024-03-16 07:10:37 -03:00
|
|
|
|
|
|
|
build_tsan_free_threading:
|
|
|
|
name: 'Thread sanitizer (free-threading)'
|
|
|
|
needs: check_source
|
|
|
|
if: needs.check_source.outputs.run_tests == 'true'
|
|
|
|
uses: ./.github/workflows/reusable-tsan.yml
|
|
|
|
with:
|
|
|
|
config_hash: ${{ needs.check_source.outputs.config_hash }}
|
|
|
|
options: ./configure --config-cache --disable-gil --with-thread-sanitizer --with-pydebug
|
2024-04-15 13:08:25 -03:00
|
|
|
suppressions_path: Tools/tsan/suppressions_free_threading.txt
|
2024-05-10 18:54:23 -03:00
|
|
|
tsan_logs_artifact_name: tsan-logs-free-threading
|
2024-03-16 07:10:37 -03:00
|
|
|
|
2023-10-09 12:30:10 -03:00
|
|
|
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
|
|
|
|
cifuzz:
|
|
|
|
name: CIFuzz
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 60
|
|
|
|
needs: check_source
|
|
|
|
if: needs.check_source.outputs.run_cifuzz == 'true'
|
|
|
|
permissions:
|
|
|
|
security-events: write
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2024-03-28 03:46:01 -03:00
|
|
|
sanitizer: [address, undefined, memory]
|
2023-10-09 12:30:10 -03:00
|
|
|
steps:
|
|
|
|
- name: Build fuzzers (${{ matrix.sanitizer }})
|
|
|
|
id: build
|
|
|
|
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
|
|
|
with:
|
|
|
|
oss-fuzz-project-name: cpython3
|
|
|
|
sanitizer: ${{ matrix.sanitizer }}
|
|
|
|
- name: Run fuzzers (${{ matrix.sanitizer }})
|
|
|
|
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
|
|
|
with:
|
|
|
|
fuzz-seconds: 600
|
|
|
|
oss-fuzz-project-name: cpython3
|
|
|
|
output-sarif: true
|
|
|
|
sanitizer: ${{ matrix.sanitizer }}
|
|
|
|
- name: Upload crash
|
2024-01-02 12:20:17 -04:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-10-09 12:30:10 -03:00
|
|
|
if: failure() && steps.build.outcome == 'success'
|
|
|
|
with:
|
|
|
|
name: ${{ matrix.sanitizer }}-artifacts
|
|
|
|
path: ./out/artifacts
|
|
|
|
- name: Upload SARIF
|
|
|
|
if: always() && steps.build.outcome == 'success'
|
2024-01-01 05:30:30 -04:00
|
|
|
uses: github/codeql-action/upload-sarif@v3
|
2023-10-09 12:30:10 -03:00
|
|
|
with:
|
|
|
|
sarif_file: cifuzz-sarif/results.sarif
|
|
|
|
checkout_path: cifuzz-sarif
|
|
|
|
|
2023-07-06 12:06:18 -03:00
|
|
|
all-required-green: # This job does nothing and is only used for the branch protection
|
|
|
|
name: All required checks pass
|
|
|
|
if: always()
|
|
|
|
|
|
|
|
needs:
|
|
|
|
- check_source # Transitive dependency, needed to access `run_tests` value
|
|
|
|
- check-docs
|
|
|
|
- check_generated_files
|
|
|
|
- build_macos
|
|
|
|
- build_ubuntu
|
|
|
|
- build_ubuntu_ssltests
|
2024-03-11 15:59:09 -03:00
|
|
|
- build_wasi
|
2023-10-31 02:49:15 -03:00
|
|
|
- build_windows
|
2024-07-24 06:46:39 -03:00
|
|
|
- build_windows_msi
|
2023-07-06 12:06:18 -03:00
|
|
|
- test_hypothesis
|
|
|
|
- build_asan
|
2024-03-16 07:10:37 -03:00
|
|
|
- build_tsan
|
|
|
|
- build_tsan_free_threading
|
2023-10-09 12:30:10 -03:00
|
|
|
- cifuzz
|
2023-07-06 12:06:18 -03:00
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Check whether the needed jobs succeeded or failed
|
|
|
|
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
|
|
|
|
with:
|
|
|
|
allowed-failures: >-
|
|
|
|
build_ubuntu_ssltests,
|
2024-07-24 06:46:39 -03:00
|
|
|
build_windows_msi,
|
2023-10-09 12:30:10 -03:00
|
|
|
cifuzz,
|
2023-07-06 12:06:18 -03:00
|
|
|
test_hypothesis,
|
|
|
|
allowed-skips: >-
|
|
|
|
${{
|
|
|
|
!fromJSON(needs.check_source.outputs.run-docs)
|
|
|
|
&& '
|
|
|
|
check-docs,
|
|
|
|
'
|
|
|
|
|| ''
|
|
|
|
}}
|
|
|
|
${{
|
|
|
|
needs.check_source.outputs.run_tests != 'true'
|
|
|
|
&& '
|
|
|
|
check_generated_files,
|
|
|
|
build_macos,
|
|
|
|
build_ubuntu,
|
|
|
|
build_ubuntu_ssltests,
|
2024-03-11 15:59:09 -03:00
|
|
|
build_wasi,
|
2023-10-31 02:49:15 -03:00
|
|
|
build_windows,
|
2023-07-06 12:06:18 -03:00
|
|
|
build_asan,
|
2024-03-16 07:10:37 -03:00
|
|
|
build_tsan,
|
|
|
|
build_tsan_free_threading,
|
2023-07-06 12:06:18 -03:00
|
|
|
'
|
|
|
|
|| ''
|
|
|
|
}}
|
2023-10-09 12:30:10 -03:00
|
|
|
${{
|
|
|
|
!fromJSON(needs.check_source.outputs.run_cifuzz)
|
|
|
|
&& '
|
|
|
|
cifuzz,
|
|
|
|
'
|
|
|
|
|| ''
|
|
|
|
}}
|
2023-07-06 12:06:18 -03:00
|
|
|
${{
|
|
|
|
!fromJSON(needs.check_source.outputs.run_hypothesis)
|
|
|
|
&& '
|
|
|
|
test_hypothesis,
|
|
|
|
'
|
|
|
|
|| ''
|
|
|
|
}}
|
|
|
|
jobs: ${{ toJSON(needs) }}
|