Skip to content

Update dependency rules_python to v2.4.2 #3486

Update dependency rules_python to v2.4.2

Update dependency rules_python to v2.4.2 #3486

Workflow file for this run

name: Tests
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: read-all
jobs:
lint:
runs-on: ubuntu-latest
permissions:
checks: write # For trunk to post annotations
contents: read # For repo checkout
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Trunk Check
uses: trunk-io/trunk-action@v2.0.0
distribution_scripts_test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- name: Test distribution scripts without network downloads
run: python3 -m unittest discover -s utils -p '*_test.py' -v
cc_wrapper_test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- name: Test compiler wrapper argument handling without LLVM downloads
run: python3 -m unittest discover -s tests -p '*_wrapper_test.py' -v
test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
bazel_version: [7.*, 8.*, 9.*, latest]
bzlmod: [true, false]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- if: startsWith(matrix.os, 'ubuntu')
run: tests/scripts/ubuntu_install_libtinfo.sh
- run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android
- name: Test
env:
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
USE_BZLMOD: ${{ matrix.bzlmod }}
run: tests/scripts/run_tests.sh -O
lsan_macos_test:
# LLVM <= 21 deadlocks while enumerating dyld images during LSan's exit
# check on current macOS. LLVM 22 uses _dyld_get_dyld_header instead; keep a
# focused test pinned to the first release line containing that fix.
runs-on: macos-latest
steps:
- uses: actions/checkout@v7
- name: Test LSan with LLVM 22
env:
USE_BAZEL_VERSION: latest
USE_BZLMOD: true
run: |
source tests/scripts/bazel.sh
cd tests
"${bazel}" --bazelrc=/dev/null test \
"${common_test_args[@]}" \
--repo_env=LLVM_VERSION=22.1.8 \
//:lsan_test
cpp_modules_test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- name: Test C++ modules with LLVM 22
env:
USE_BAZEL_VERSION: 9.2.0
run: tests/scripts/run_cpp_modules_test.sh
llvm_23_archive_test:
# LLVM 23.1.2 publishes both xz and zstd archives for these platforms, but
# released Bazel versions cannot decode the zstd archives' 1 GiB window.
# Build with both packages to ensure toolchains_llvm selects xz without
# first attempting to extract zstd. The macOS leg overrides LLVM 23's
# bundled linker, whose current-SDK TAPI fix is available in LLVM 24.
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- if: startsWith(matrix.os, 'ubuntu')
run: tests/scripts/ubuntu_install_libtinfo.sh
- name: Test LLVM 23.1.2 xz fallback
env:
USE_BAZEL_VERSION: latest
USE_BZLMOD: true
run: tests/scripts/run_llvm_23_archive_test.sh
darwin_thin_lto_test:
strategy:
fail-fast: false
matrix:
include:
- bazel_version: 9.*
bzlmod: true
- bazel_version: 8.*
bzlmod: false
runs-on: macos-latest
steps:
- uses: actions/checkout@v7
- name: Test actual ThinLTO with LLVM 23 and Apple ld
env:
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
USE_BZLMOD: ${{ matrix.bzlmod }}
run: tests/scripts/run_darwin_thin_lto_tests.sh
toolchain_test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
bazel_version: [7.*, 8.*, 9.*, latest]
bzlmod: [true, false]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- name: Test
env:
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
USE_BZLMOD: ${{ matrix.bzlmod }}
run: tests/scripts/run_toolchain_tests.sh
feature_override_test:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
bazel_version: 9.*
bzlmod: true
- os: ubuntu-latest
bazel_version: 9.*
bzlmod: true
- os: macos-latest
bazel_version: 8.*
bzlmod: false
- os: ubuntu-latest
bazel_version: 8.*
bzlmod: false
- os: ubuntu-latest
bazel_version: 7.*
bzlmod: true
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- if: startsWith(matrix.os, 'ubuntu')
run: tests/scripts/ubuntu_install_libtinfo.sh
- name: Test feature-selected toolchains and fallback
env:
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
USE_BZLMOD: ${{ matrix.bzlmod }}
run: tests/scripts/run_feature_override_tests.sh
local_linker_test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
bzlmod: [true, false]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- if: startsWith(matrix.os, 'ubuntu')
run: tests/scripts/ubuntu_install_libtinfo.sh
- name: Test native linker selection
env:
USE_BAZEL_VERSION: latest
USE_BZLMOD: ${{ matrix.bzlmod }}
run: tests/scripts/run_local_linker_tests.sh
mold_linker_test:
strategy:
fail-fast: false
matrix:
include:
- bazel_version: latest
bzlmod: true
- bazel_version: 8.*
bzlmod: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: tests/scripts/ubuntu_install_libtinfo.sh
- name: Test mold linker selection
env:
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
USE_BZLMOD: ${{ matrix.bzlmod }}
run: tests/scripts/run_mold_linker_tests.sh
external_test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
bazel_version: [8.*, latest]
bzlmod: [true, false]
stdlib: [default, libc++, stdc++, dynamic-stdc++]
exclude:
- os: macos-latest
stdlib: libc++ # Needs to be installed first
- os: macos-latest
stdlib: stdc++ # Needs to be installed first
- os: macos-latest
stdlib: dynamic-stdc++ # Needs to be installed first
- bazel_version: latest
bzlmod: false
- bzlmod: false # Only test the default stdlib: builtin-libc++
stdlib: libc++
- bzlmod: false
stdlib: stdc++
- bzlmod: false
stdlib: dynamic-stdc++
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- if: startsWith(matrix.os, 'ubuntu')
run: tests/scripts/ubuntu_install_libtinfo.sh
- name: Test (${{ matrix.stdlib }})
env:
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
USE_BZLMOD: ${{ matrix.bzlmod }}
TEST_STDLIB: ${{ matrix.stdlib }}
run: tests/scripts/run_external_tests.sh
container_test:
strategy:
fail-fast: false
matrix:
script: [
archlinux,
debian,
fedora,
suse_leap,
suse_tumbleweed,
ubuntu_20_04, # Includes omp tests
ubuntu_22_04,
ubuntu_24_04,
linux_sysroot,
]
bzlmod: [true, false]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android
- name: Test
env:
USE_BZLMOD: ${{ matrix.bzlmod }}
run: tests/scripts/${{ matrix.script }}_test.sh
xcompile_test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
bzlmod: [true, false]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- if: startsWith(matrix.os, 'ubuntu')
run: tests/scripts/ubuntu_install_libtinfo.sh
- name: Test
env:
USE_BZLMOD: ${{ matrix.bzlmod }}
run: tests/scripts/run_xcompile_tests.sh
abs_paths_test:
strategy:
fail-fast: false
matrix:
bzlmod: [true, false]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: tests/scripts/ubuntu_install_libtinfo.sh
- name: Test
env:
USE_BZLMOD: ${{ matrix.bzlmod }}
run: tests/scripts/run_tests.sh -t @llvm_toolchain_with_absolute_paths//:cc-toolchain-x86_64-linux -O
sys_paths_test:
strategy:
fail-fast: false
matrix:
bzlmod: [true, false]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: tests/scripts/ubuntu_install_libtinfo.sh
- name: Download and Extract LLVM distribution
# The downloaded version here must match version specified as '-v' arg to run_tests.sh below.
env:
release: llvmorg-16.0.0
archive: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04
ext: .tar.xz
local_path: /opt/llvm-16
run: wget --no-verbose "https://github.com/llvm/llvm-project/releases/download/${release}/${archive}${ext}" && tar -xf "${archive}${ext}" && mv "${archive}" "${local_path}"
- name: Test
env:
USE_BZLMOD: ${{ matrix.bzlmod }}
run: tests/scripts/run_tests.sh -t @llvm_toolchain_with_system_llvm//:cc-toolchain-x86_64-linux -v 16.0.0
msan_test:
# End-to-end MemorySanitizer test. Downloads a full clang + an
# instrumented-libc++ overlay and builds/runs an msan binary, exercising the
# instrumented-libc++ swap end to end. Linux/x86_64 and bzlmod only (the
# overlay toolchain is defined via bzlmod). The bazel-version matrix covers
# both filegroup layouts: <9 uses lib_legacy/include, 9+ uses
# lib/cxx_builtin_include (merkle_cache_v2).
strategy:
fail-fast: false
matrix:
bazel_version: [7.*, 8.*, 9.*, latest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: tests/scripts/ubuntu_install_libtinfo.sh
- run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android
- name: Test
env:
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
USE_BZLMOD: true
run: tests/scripts/run_msan_tests.sh
unsupported_msan_test:
# The real MSan runtime tests above are Linux-only. On macOS, requesting
# MSan must fail loudly rather than silently running without instrumentation.
runs-on: macos-latest
steps:
- uses: actions/checkout@v7
- name: Test Bazel 9 with LLVM 23
env:
USE_BAZEL_VERSION: 9.0.0
USE_BZLMOD: true
run: tests/scripts/run_unsupported_msan_test.sh
# Single aggregating gate for branch protection. It depends on every job that
# must pass, so "required_checks_done" is the only status check that needs to
# be marked "required" on the master branch -- adding or renaming a job above
# no longer means editing branch protection, only this job's `needs` list.
# When any dependency fails or is cancelled, this job fails and names the
# offending jobs in its log and in the run summary.
required_checks_done:
name: required_checks_done
needs:
- lint
- distribution_scripts_test
- cc_wrapper_test
- test
- lsan_macos_test
- cpp_modules_test
- llvm_23_archive_test
- darwin_thin_lto_test
- toolchain_test
- feature_override_test
- local_linker_test
- mold_linker_test
- external_test
- container_test
- xcompile_test
- abs_paths_test
- sys_paths_test
- msan_test
- unsupported_msan_test
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Ensure every job is wired into this gate
env:
NEEDS_JSON: ${{ toJSON(needs) }}
run: |
# Parse the workflow with a real YAML reader (yq) and fail if any
# declared job (other than this gate) is absent from `needs` above, so
# a newly added job cannot silently escape the required gate.
declared="$(yq '.jobs | keys | .[]' .github/workflows/tests.yml |
grep -vx required_checks_done | sort)"
wired="$(jq -r 'keys[]' <<<"${NEEDS_JSON}" | sort)"
missing="$(comm -23 <(printf '%s\n' "${declared}") <(printf '%s\n' "${wired}"))"
if [[ -n "${missing}" ]]; then
echo "Jobs declared in the workflow but missing from required_checks_done.needs:"
while read -r job; do
echo " - ${job}"
echo "::error title=Gate is missing a job::${job} not in required_checks_done.needs"
done <<<"${missing}"
exit 1
fi
echo "required_checks_done covers all $(grep -c . <<<"${declared}") workflow jobs."
- name: Verify required jobs succeeded
env:
NEEDS_JSON: ${{ toJSON(needs) }}
run: |
{
echo "| Required job | Result |"
echo "| --- | --- |"
jq -r 'to_entries[] | "| \(.key) | \(.value.result) |"' <<<"${NEEDS_JSON}"
} >>"${GITHUB_STEP_SUMMARY}"
failed="$(jq -r 'to_entries[]
| select(.value.result != "success" and .value.result != "skipped")
| .key' <<<"${NEEDS_JSON}")"
if [[ -n "${failed}" ]]; then
echo "The following required jobs did not succeed:"
while read -r job; do
echo " - ${job}"
echo "::error title=Required job failed::${job} did not succeed"
done <<<"${failed}"
exit 1
fi
echo "All required jobs succeeded."