Files
2026-07-13 13:05:14 +08:00

123 lines
4.3 KiB
YAML

name: "C++ Tests on all platforms & compilers"
on:
workflow_call:
inputs:
CONCURRENCY:
required: true
type: string
CHANNEL:
required: false
type: string # enum: 'nightly', 'main', or 'pr'
workflow_dispatch:
inputs:
CONCURRENCY:
required: false
type: string
default: "adhoc"
CHANNEL:
required: false
type: string # enum: 'nightly', 'main', or 'pr'
concurrency:
group: ${{ inputs.CONCURRENCY }}-checks_cpp
cancel-in-progress: true
defaults:
run:
shell: bash --noprofile --norc -euo pipefail {0}
permissions:
contents: "read"
id-token: "write"
jobs:
matrix_prep:
runs-on: ubuntu-latest
outputs:
MATRIX: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
- name: Load C++ test matrix
id: set-matrix
run: echo "matrix=$(jq -c . < ./.github/workflows/cpp_matrix_full.json)" >> $GITHUB_OUTPUT
cpp-tests:
name: C++ build & test - ${{ matrix.name }}
timeout-minutes: 60
needs: matrix_prep
strategy:
matrix: ${{ fromJson(needs.matrix_prep.outputs.MATRIX) }}
runs-on: ${{ matrix.runs_on }}
steps:
# Skipping the entire step would apparently require a separate job, not doing that here.
# Instead we keep checking for the `matrix.pr_ci` flag.
# See https://stackoverflow.com/questions/77186893/how-can-i-skip-the-whole-job-for-a-matrix-match-in-github-action
- uses: actions/checkout@v4
if: ${{ github.event_name != 'pull_request' || matrix.pr_ci != false }}
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
- uses: prefix-dev/setup-pixi@v0.10.0
if: ${{ github.event_name != 'pull_request' || matrix.pr_ci != false }}
with:
pixi-version: v0.71.3
environments: cpp
- name: Set up Rust
uses: ./.github/actions/setup-rust
if: ${{ github.event_name != 'pull_request' || matrix.pr_ci != false }}
with:
cache_key: ${{ matrix.cache_key }}
# Cache will be produced by `reusable_checks/rs-lints`
save_cache: false
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
# Workaround for ASAN issues on Github images https://github.com/actions/runner-images/issues/9491
- name: Fix kernel mmap rnd bits
if: ${{ (github.event_name != 'pull_request' || matrix.pr_ci != false) && runner.os == 'Linux' }}
# Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
# high-entropy ASLR in much newer kernels that GitHub runners are
# using leading to random crashes: https://reviews.llvm.org/D148280
run: sudo sysctl vm.mmap_rnd_bits=28
- name: pixi run -e cpp cpp-clean
if: ${{ github.event_name != 'pull_request' || matrix.pr_ci != false }}
run: pixi run -e cpp cpp-clean
- name: pixi run -e cpp cpp-build-all
if: ${{ github.event_name != 'pull_request' || matrix.pr_ci != false }}
run: ${{ matrix.extra_env_vars }} RERUN_WERROR=ON pixi run -e cpp cpp-build-all
- name: pixi run -e cpp cpp-test
if: ${{ github.event_name != 'pull_request' || matrix.pr_ci != false }}
run: ${{ matrix.extra_env_vars }} RERUN_WERROR=ON pixi run -e cpp cpp-test
- name: pixi run -e cpp cpp-build-all-shared-libs
if: ${{ inputs.CHANNEL == 'nightly' }}
run: ${{ matrix.extra_env_vars }} RERUN_WERROR=ON pixi run -e cpp cpp-build-all-shared-libs
- name: additional_commands
if: ${{ github.event_name != 'pull_request' || matrix.pr_ci != false }}
run: ${{ matrix.additional_commands }}
cpp-formatting:
name: C++ formatting check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
- uses: prefix-dev/setup-pixi@v0.10.0
with:
pixi-version: v0.71.3
environments: cpp
- name: Run clang format on all relevant files
run: pixi run -e cpp cpp-fmt-check