-
Notifications
You must be signed in to change notification settings - Fork 371
128 lines (110 loc) · 3.93 KB
/
reusable_checks_cpp.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: "C++ Tests on all platforms & compilers"
on:
workflow_call:
inputs:
CONCURRENCY:
required: true
type: string
FULL:
# Booleans are almost unusable
# See https://medium.com/@sohail.ra5/github-actions-passing-boolean-input-variables-to-reusable-workflow-call-42d39bf7342e
type: string
required: true
default: "true"
workflow_dispatch:
inputs:
CONCURRENCY:
required: false
type: string
default: "adhoc"
FULL:
description: "If false only linux is tested"
type: choice
options:
- "true"
- "false"
concurrency:
group: ${{ inputs.CONCURRENCY }}-checks_cpp
cancel-in-progress: true
env:
# See: https://github.com/marketplace/actions/sccache-action
SCCACHE_GHA_ENABLED: "false"
RUSTC_WRAPPER: "sccache"
# Not only `sccache` cannot cache incremental builds, it's counter-productive to generate all
# these incremental artifacts when running on CI.
CARGO_INCREMENTAL: "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
shell: bash
run: |
echo "Full matrix: ${{ inputs.FULL }}"
if ${{ inputs.FULL }}; then
echo "matrix=$(jq -c . < ./.github/workflows/cpp_matrix_full.json)" >> $GITHUB_OUTPUT
else
echo "matrix=$(jq -c . < ./.github/workflows/cpp_matrix_partial.json)" >> $GITHUB_OUTPUT
fi
cpp-tests:
name: C++ build & test - ${{ matrix.name }}
needs: matrix_prep
strategy:
matrix: ${{ fromJson(needs.matrix_prep.outputs.MATRIX) }}
runs-on: ${{ matrix.runs_on }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.19.0
- name: Set up Rust
uses: ./.github/actions/setup-rust
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: 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 cpp-clean
shell: bash
run: pixi run cpp-clean
- name: pixi run cpp-build-all
shell: bash
run: ${{ matrix.extra_env_vars }} RERUN_WERROR=ON pixi run cpp-build-all
- name: pixi run cpp-test
shell: bash
run: ${{ matrix.extra_env_vars }} RERUN_WERROR=ON pixi run cpp-test
- name: additional_commands
shell: bash
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 || '' }}
- name: Run clang format on all relevant files
uses: jidicula/[email protected]
with:
clang-format-version: "16"
# Only check c/cpp/h/hpp (default checks also .proto and others)
include-regex: ^.*\.(c|cpp|h|hpp)$