forked from cwida/FastLanes
-
Notifications
You must be signed in to change notification settings - Fork 0
405 lines (354 loc) · 16.5 KB
/
Copy pathcpp.yaml
File metadata and controls
405 lines (354 loc) · 16.5 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# ────────────────────────────────────────────────────────
# | FastLanes |
# ────────────────────────────────────────────────────────
# .github/workflows/cpp.yaml
# ────────────────────────────────────────────────────────
name: CPP
run-name: >-
${{ github.workflow }} on ${{ github.ref_name }} (#${{ github.run_number }})
— ${{ github.event.pull_request.title || github.event.head_commit.message }}
# ──────────────────────────────────────────────────────────────────────────────
# Events
# ──────────────────────────────────────────────────────────────────────────────
on:
push:
pull_request:
branches: [ "main", "dev" ]
# Cancel in-flight runs on the same branch/PR so we do not waste minutes
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Global env (tweak once, use everywhere)
env:
CMAKE_GENERATOR: Ninja # much faster than Makefiles
jobs:
# ──────────────────────────────────────────────────────────────────────────────
# 1️⃣ Format-check (quick)
# ──────────────────────────────────────────────────────────────────────────────
check-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Detect CPU count
shell: bash
run: make detect-cpu | tee -a "$GITHUB_ENV"
- name: Run format check
run: make format-check
# ──────────────────────────────────────────────────────────────────────────────
# 2️⃣ Main build + clang-tidy (Linux + macOS + Windows)
# ──────────────────────────────────────────────────────────────────────────────
build:
needs: check-format
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-24.04
- ubuntu-22.04
- ubuntu-24.04-arm
- ubuntu-22.04-arm
- macos-15
- macos-14
- macos-13
build_type: [ Debug, Release ]
cxx: [ clang++ ]
shared_lib: [ false, true ]
# 🛑 Skip the flaky public-preview runner (arm64 Debug + shared)
# GitHub’s ubuntu-24.04-arm image is still in public beta (burstable capacity),
# which can terminate long jobs with “The runner has received a shutdown signal”
# → exit-code 143. See:
# https://github.blog/changelog/2024-06-24-github-actions-ubuntu-24-04-image-now-available-for-arm64-runners/
# See also Issue #11541: “Intermittent segmentation faults on Ubuntu 24.04 ARM”
# — ~15% of runs on ubuntu-24.04-arm see segfaults or pre-emptions mid-build
exclude:
- platform: ubuntu-24.04-arm
build_type: Debug
shared_lib: true
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Detect CPU count
shell: bash
run: make detect-cpu | tee -a "$GITHUB_ENV"
- name: Install LLVM
uses: ./.github/actions/install-llvm
- name: Print clang/clang-tidy version
run: |
clang --version
clang-tidy --version
# ----------------------------------------------------------------------
# Configure (runs clang-tidy via CMake)
# ----------------------------------------------------------------------
- name: Configure (with clang-tidy checks)
shell: bash
run: |
cmake -S "${{ github.workspace }}" \
-B build_${{ matrix.build_type }}_${{ matrix.shared_lib }} \
-DFLS_ENABLE_VERBOSE_OUTPUT=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DFLS_ENABLE_CLANG_TIDY=ON \
-DFLS_BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \
-DFLS_ENABLE_INSTALL=OFF \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }}
- name: Build (clang-tidy runs automatically)
run: cmake --build build_${{ matrix.build_type }}_${{ matrix.shared_lib }} -j $BUILD_THREADS
# ──────────────────────────────────────────────────────────────────────────────
# 3️⃣ IWYU build (Linux only)
# ──────────────────────────────────────────────────────────────────────────────
# build-iwyu:
# needs: build
# strategy:
# matrix:
# build_type: [ Debug, Release ]
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v4
# - name: Detect CPU count
# shell: bash
# run: make detect-cpu | tee -a "$GITHUB_ENV"
# - name: Cache IWYU build
# uses: actions/cache@v4
# with:
# path: build_iwyu_${{ matrix.build_type }}
# key: ${{ runner.os }}-iwyu-${{ matrix.build_type }}-${{ hashFiles('CMakeLists.txt', '**/*.cmake', '**/*.[ch]pp', '**/*.h') }}
# restore-keys: |
# ${{ runner.os }}-iwyu-${{ matrix.build_type }}-
# - name: Configure (IWYU)
# run: |
# cmake -S ${{ github.workspace }} \
# -B build_iwyu_${{ matrix.build_type }} \
# -DFLS_ENABLE_IWYU=ON \
# -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
# -DCMAKE_C_COMPILER=clang \
# -DCMAKE_CXX_COMPILER=clang++
# - name: Build (IWYU)
# run: cmake --build build_iwyu_${{ matrix.build_type }} -j $BUILD_THREADS
# ──────────────────────────────────────────────────────────────────────────────
# 4️⃣ Synthetic-dataset generator (Python, cached pip)
# ──────────────────────────────────────────────────────────────────────────────
generate_dataset:
needs: build
strategy:
matrix:
platform:
- ubuntu-24.04
- ubuntu-22.04
- ubuntu-24.04-arm
- ubuntu-22.04-arm
- macos-15
- macos-14
- macos-13
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Detect CPU count
shell: bash
run: make detect-cpu | tee -a "$GITHUB_ENV"
- name: Generate synthetic dataset
uses: ./.github/actions/generate-dataset
# ──────────────────────────────────────────────────────────────────────────────
# 5️⃣ Example build & run
# ──────────────────────────────────────────────────────────────────────────────
example:
# needs: build
strategy:
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
build_type: [ Release ]
cxx: [ clang++ ]
shared_lib: [ false, true ]
runs-on: ${{ matrix.platform }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Detect CPU count
shell: bash
run: make detect-cpu | tee -a "$GITHUB_ENV"
- name: Install LLVM
uses: ./.github/actions/install-llvm
- name: Configure example
run: |
CMAKE_ARGS=(
-S "${{ github.workspace }}"
-B "build_${{ matrix.build_type }}_${{ matrix.shared_lib }}"
-DFLS_BUILD_EXAMPLES=ON
-DFLS_ENABLE_VERBOSE_OUTPUT=ON
-DCMAKE_BUILD_TYPE="${{ matrix.build_type }}"
-DFLS_BUILD_SHARED_LIBS=${{ matrix.shared_lib }}
-DFLS_ENABLE_INSTALL=OFF
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER="${{ matrix.cxx }}"
)
# Use static MSVC runtime on Windows to avoid ASAN/UBSAN mismatch
if [[ "${{ runner.os }}" == "Windows" ]]; then
CMAKE_ARGS+=(-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded)
fi
cmake "${CMAKE_ARGS[@]}"
- name: Build example
run: cmake --build "build_${{ matrix.build_type }}_${{ matrix.shared_lib }}" --parallel
- name: Run cpp_example
shell: bash
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
./build_${{ matrix.build_type }}_${{ matrix.shared_lib }}/examples/cpp_example.exe
else
./build_${{ matrix.build_type }}_${{ matrix.shared_lib }}/examples/cpp_example
fi
# ──────────────────────────────────────────────────────────────────────────────
# 6️⃣ Tests (Linux + macOS, Release only)
# ──────────────────────────────────────────────────────────────────────────────
test:
# needs: build
name: test (${{ matrix.platform }}, ${{ matrix.build_type }}, ${{ matrix.shared_lib && 'shared' || 'static' }})
strategy:
matrix:
platform:
- ubuntu-24.04
- ubuntu-22.04
- ubuntu-24.04-arm
- ubuntu-22.04-arm
- macos-15
- macos-14
- macos-13
build_type: [ Release ]
shared_lib: [ false, true ]
runs-on: ${{ matrix.platform }}
defaults:
run:
shell: bash # Use bash on all platforms to avoid PowerShell issues on Windows
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
# Map the boolean shared_lib into a human-friendly label
- name: Determine lib label
run: |
if [[ "${{ matrix.shared_lib }}" == "true" ]]; then
echo "LIB_LABEL=shared" >> $GITHUB_ENV
else
echo "LIB_LABEL=static" >> $GITHUB_ENV
fi
- name: Detect CPU count
run: make detect-cpu | tee -a "$GITHUB_ENV"
- name: Generate synthetic dataset
uses: ./.github/actions/generate-dataset
- name: Install LLVM
uses: ./.github/actions/install-llvm
- name: Configure tests
run: |
# Build directory uses our human-friendly label
BUILD_DIR="test_build_${LIB_LABEL}"
CMAKE_ARGS=(
-S "${{ github.workspace }}"
-B "${BUILD_DIR}"
-DFLS_BUILD_TESTING=ON
-DFLS_ENABLE_VERBOSE_OUTPUT=ON
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DFLS_BUILD_SHARED_LIBS=${{ matrix.shared_lib }}
-DFLS_ENABLE_INSTALL=OFF
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
)
# On Windows, use static MSVC runtime to prevent ASAN/UBSAN mismatch
if [[ "${{ runner.os }}" == "Windows" ]]; then
CMAKE_ARGS+=(-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded)
fi
cmake "${CMAKE_ARGS[@]}"
- name: Build tests
run: |
# Use the same labeled build directory
cmake --build "test_build_${LIB_LABEL}" -j $BUILD_THREADS
- name: Run tests
working-directory: "test_build_${{ env.LIB_LABEL }}"
run: |
# Exclude Quick-Fuzz tests from the normal suite
ctest -j $BUILD_THREADS \
--stop-on-failure \
--output-on-failure \
--timeout 5000 \
-E "QuickFuzz"
# ──────────────────────────────────────────────────────────────────────────────
# 7️⃣ Install job
# ──────────────────────────────────────────────────────────────────────────────
install:
needs: test
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
shared_lib: [ false, true ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Detect CPU count
shell: bash
run: make detect-cpu | tee -a "$GITHUB_ENV"
# Use the same LLVM toolchain as the other jobs
- name: Install LLVM toolchain
uses: ./.github/actions/install-llvm
- name: Configure + build + install
shell: bash
run: |
CMAKE_ARGS=(
-S "${{ github.workspace }}"
-B build_${{ matrix.shared_lib }}
-G "${CMAKE_GENERATOR}"
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=build_${{ matrix.shared_lib }}/install
-DFLS_BUILD_SHARED_LIBS=${{ matrix.shared_lib }}
-DFLS_ENABLE_INSTALL=ON
)
# Use static MSVC runtime on Windows to avoid ASAN/UBSAN mismatch
if [[ "${{ runner.os }}" == "Windows" ]]; then
CMAKE_ARGS+=(-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded)
fi
cmake "${CMAKE_ARGS[@]}"
cmake --build build_${{ matrix.shared_lib }} --target install -j $BUILD_THREADS
- name: Verify installed header files
shell: bash
run: |
set -euo pipefail
SOURCE_INCLUDE=src/include
INSTALL_INCLUDE=build_${{ matrix.shared_lib }}/install/include
# 1) fail fast if the install tree isn't there
if [[ ! -d "$INSTALL_INCLUDE" ]]; then
echo "❌ Error: '$INSTALL_INCLUDE' directory not found"
exit 1
fi
# 2) show what *did* get installed
echo "✅ Found install include directory; installed headers:"
find "$INSTALL_INCLUDE" -type f -print
# 3) walk every .h/.hpp under your source include/, check its counterpart
missing=()
while IFS= read -r -d '' src; do
rel="${src#./}"
if [[ ! -f "$INSTALL_INCLUDE/$rel" ]]; then
missing+=("$rel")
fi
done < <(
cd "$SOURCE_INCLUDE"
find . -type f \( -name '*.h' -o -name '*.hpp' \) -print0
)
# 4) report & fail if anything’s missing
if (( ${#missing[@]} > 0 )); then
echo "❌ Missing expected header(s):"
for hdr in "${missing[@]}"; do
echo " • $hdr"
done
exit 1
fi
echo "✅ All expected headers are present."
- name: Upload C++ install tree
uses: actions/upload-artifact@v4
with:
name: fastlanes-cpp-install-${{ matrix.os }}-shared-${{ matrix.shared_lib }}
path: build_${{ matrix.shared_lib }}/install