-
Notifications
You must be signed in to change notification settings - Fork 14
527 lines (467 loc) · 19.8 KB
/
unit_tests.yml
File metadata and controls
527 lines (467 loc) · 19.8 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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
name: Unit Tests
permissions: read-all
on:
workflow_dispatch:
merge_group:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
DEBIAN_FRONTEND: noninteractive
CMAKE_GENERATOR: Ninja
DEFAULT_CXX_STANDARD: 20
DEFAULT_LLVM_VERSION: 20
DEFAULT_GCC_VERSION: 14
MULL_LLVM_VERSION: 18
MULL_VERSION: 0.24.0
HYPOTHESIS_PROFILE: default
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build_and_test_24:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
strategy:
fail-fast: false
matrix:
compiler: [clang, gcc]
version: [12, 13, 14, 16, 17, 18, 19, 20]
cxx_standard: [17, 20]
stdlib: [libstdc++, libc++]
build_type: [Debug]
include:
- compiler: clang
cc: "clang"
cxx: "clang++"
cxx_flags: "-stdlib=libstdc++"
- version: 20
compiler: clang
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 20
toolchain_root: "/usr/lib/llvm-20"
- version: 20
compiler: clang
stdlib: libc++
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 20 && sudo apt install -y libc++-20-dev libc++abi-20-dev
cxx_flags: "-stdlib=libc++"
- version: 19
compiler: clang
install: sudo apt update && sudo apt install -y clang-19
toolchain_root: "/usr/lib/llvm-19"
- version: 19
compiler: clang
stdlib: libc++
install: sudo apt update && sudo apt install -y clang-19 libc++-19-dev libc++abi-19-dev
cxx_flags: "-stdlib=libc++"
- version: 18
compiler: clang
install: sudo apt update && sudo apt install -y clang-18
toolchain_root: "/usr/lib/llvm-18"
- version: 18
compiler: clang
stdlib: libc++
install: sudo apt update && sudo apt install -y clang-18 libc++-18-dev libc++abi-18-dev
cxx_flags: "-stdlib=libc++"
- version: 17
compiler: clang
install: sudo apt update && sudo apt install -y clang-17
toolchain_root: "/usr/lib/llvm-17"
- version: 17
compiler: clang
stdlib: libc++
install: sudo apt update && sudo apt install -y clang-17 libc++-17-dev libc++abi-17-dev
cxx_flags: "-stdlib=libc++"
- version: 16
compiler: clang
install: sudo apt update && sudo apt install -y clang-16
toolchain_root: "/usr/lib/llvm-16"
- version: 16
compiler: clang
stdlib: libc++
install: sudo apt update && sudo apt install -y clang-16 libc++-16-dev libc++abi-16-dev
cxx_flags: "-stdlib=libc++"
- compiler: gcc
toolchain_root: "/usr"
cxx_flags: ""
- version: 14
compiler: gcc
install: sudo apt update && sudo apt install -y gcc-14 g++-14
cc: "gcc-14"
cxx: "g++-14"
- version: 13
compiler: gcc
install: sudo apt update && sudo apt install -y gcc-13 g++-13
cc: "gcc-13"
cxx: "g++-13"
- version: 12
compiler: gcc
install: sudo apt update && sudo apt install -y gcc-12 g++-12
cc: "gcc-12"
cxx: "g++-12"
cxx_flags: ""
exclude:
- compiler: gcc
version: 20
- compiler: gcc
version: 19
- compiler: gcc
version: 18
- compiler: gcc
version: 17
- compiler: gcc
version: 16
- compiler: clang
version: 14
- compiler: clang
version: 13
- compiler: clang
version: 12
- compiler: gcc
stdlib: libc++
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install build tools
run: |
${{ matrix.install }}
sudo apt install -y ninja-build python3-venv python3-pip
- name: Restore CPM cache
env:
cache-name: cpm-cache-0
id: cpm-cache-restore
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
restore-keys: |
${{runner.os}}-${{env.cache-name}}-
- name: Configure CMake
env:
CC: ${{matrix.toolchain_root}}/bin/${{matrix.cc}}
CXX: ${{matrix.toolchain_root}}/bin/${{matrix.cxx}}
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{matrix.cxx_standard}} -DCMAKE_CXX_FLAGS_INIT=${{matrix.cxx_flags}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCPM_SOURCE_CACHE=~/cpm-cache
- name: Save CPM cache
env:
cache-name: cpm-cache-0
if: steps.cpm-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- name: Install python test requirements
run: |
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
- name: Build Unit Tests
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -v -t build_unit_tests
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest --output-on-failure -j $(nproc) -C ${{matrix.build_type}}
build_and_test_22:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-22.04
strategy:
fail-fast: false
matrix:
compiler: [clang]
version: [14, 15]
cxx_standard: [17, 20]
stdlib: [libstdc++, libc++]
build_type: [Debug]
include:
- compiler: clang
cc: "clang"
cxx: "clang++"
cxx_flags: "-stdlib=libstdc++"
- version: 15
compiler: clang
install: sudo apt update && sudo apt install -y clang-15
toolchain_root: "/usr/lib/llvm-15"
- version: 15
compiler: clang
stdlib: libc++
install: sudo apt update && sudo apt install -y clang-15 libc++-15-dev libc++abi-15-dev
cxx_flags: "-stdlib=libc++"
- version: 14
compiler: clang
install: sudo apt update && sudo apt install -y clang-14
toolchain_root: "/usr/lib/llvm-14"
- version: 14
compiler: clang
stdlib: libc++
install: sudo apt update && sudo apt install -y clang-14 libc++-14-dev libc++abi-14-dev
cxx_flags: "-stdlib=libc++"
exclude:
- compiler: clang
version: 14
stdlib: libstdc++
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install build tools
run: |
${{ matrix.install }}
sudo apt install -y ninja-build python3-venv python3-pip
- name: Restore CPM cache
env:
cache-name: cpm-cache-0
id: cpm-cache-restore
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
restore-keys: |
${{runner.os}}-${{env.cache-name}}-
- name: Configure CMake
env:
CC: ${{matrix.toolchain_root}}/bin/${{matrix.cc}}
CXX: ${{matrix.toolchain_root}}/bin/${{matrix.cxx}}
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{matrix.cxx_standard}} -DCMAKE_CXX_FLAGS_INIT=${{matrix.cxx_flags}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCPM_SOURCE_CACHE=~/cpm-cache
- name: Save CPM cache
env:
cache-name: cpm-cache-0
if: steps.cpm-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- name: Install python test requirements
run: |
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
- name: Build Unit Tests
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -v -t build_unit_tests
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest --output-on-failure -j $(nproc) -C ${{matrix.build_type}}
quality_checks_pass:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
steps:
- name: Checkout target branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{github.base_ref}}
- name: Extract target branch SHA
run: echo "branch=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
id: target_branch
- name: Checkout PR branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install build tools
run: |
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh ${{env.DEFAULT_LLVM_VERSION}}
sudo apt install -y pipx ninja-build clang-tidy-${{env.DEFAULT_LLVM_VERSION}} clang-format-${{env.DEFAULT_LLVM_VERSION}}
- name: Install cmake-format
run: |
pipx install cmakelang
pipx inject cmakelang pyyaml
echo "/opt/pipx_bin" >> $GITHUB_PATH
- name: Restore CPM cache
env:
cache-name: cpm-cache-0
id: cpm-cache-restore
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
restore-keys: |
${{runner.os}}-${{env.cache-name}}-
- name: Configure CMake
env:
CC: "/usr/lib/llvm-${{env.DEFAULT_LLVM_VERSION}}/bin/clang"
CXX: "/usr/lib/llvm-${{env.DEFAULT_LLVM_VERSION}}/bin/clang++"
PR_TARGET_BRANCH: ${{ steps.target_branch.outputs.branch }}
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache
- name: Save CPM cache
env:
cache-name: cpm-cache-0
if: steps.cpm-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- name: Run quality checks
run: cmake --build ${{github.workspace}}/build -t ci-quality
sanitize:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
strategy:
fail-fast: false
matrix:
sanitizer: [undefined, address, thread]
compiler: [clang, gcc]
include:
- compiler: clang
cc: "clang"
cxx: "clang++"
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 20
toolchain_root: "/usr/lib/llvm-20"
- compiler: gcc
cc: "gcc-14"
cxx: "g++-14"
install: sudo apt update && sudo apt install -y gcc-14 g++-14
toolchain_root: "/usr"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install build tools
run: |
${{ matrix.install }}
sudo apt install -y ninja-build python3-venv python3-pip
- name: Restore CPM cache
env:
cache-name: cpm-cache-0
id: cpm-cache-restore
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
restore-keys: |
${{runner.os}}-${{env.cache-name}}-
- name: Configure CMake
env:
CC: ${{matrix.toolchain_root}}/bin/${{matrix.cc}}
CXX: ${{matrix.toolchain_root}}/bin/${{matrix.cxx}}
SANITIZERS: ${{matrix.sanitizer}}
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache
- name: Save CPM cache
env:
cache-name: cpm-cache-0
if: steps.cpm-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- name: Install python test requirements
run: |
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
# https://github.com/actions/runner-images/issues/9524
- name: Fix kernel mmap rnd bits
# 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: Build Unit Tests
run: cmake --build ${{github.workspace}}/build -t unit_tests
valgrind:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install build tools
run: |
sudo apt update && sudo apt install -y gcc-${{env.DEFAULT_GCC_VERSION}} g++-${{env.DEFAULT_GCC_VERSION}} ninja-build valgrind python3-venv python3-pip
- name: Restore CPM cache
env:
cache-name: cpm-cache-0
id: cpm-cache-restore
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
restore-keys: |
${{runner.os}}-${{env.cache-name}}-
- name: Configure CMake
env:
CC: "/usr/bin/gcc-${{env.DEFAULT_GCC_VERSION}}"
CXX: "/usr/bin/g++-${{env.DEFAULT_GCC_VERSION}}"
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache
- name: Save CPM cache
env:
cache-name: cpm-cache-0
if: steps.cpm-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- name: Install python test requirements
run: |
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
- name: Build Unit Tests
run: cmake --build ${{github.workspace}}/build -t build_unit_tests
- name: Test
working-directory: ${{github.workspace}}/build
run: |
ctest --output-on-failure -j $(nproc) -E EXPECT_FAIL -T memcheck
LOGFILE=$(ls ./Testing/Temporary/LastDynamicAnalysis_*.log)
FAILSIZE=$(du -c ./Testing/Temporary/MemoryChecker.* | tail -1 | cut -f1)
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>" >> $GITHUB_STEP_SUMMARY
if [ $FAILSIZE != "0" ]; then
echo "Failing tests:" | tee -a $GITHUB_STEP_SUMMARY
else
echo "No failing tests" >> $GITHUB_STEP_SUMMARY
fi
echo "</summary>" >> $GITHUB_STEP_SUMMARY
for f in ./Testing/Temporary/MemoryChecker.*
do
if [ -s $f ]; then
FILENAME=$(cd $(dirname $f) && pwd)/$(basename $f)
TEST_COMMAND=$(grep $FILENAME $LOGFILE)
echo "" | tee -a $GITHUB_STEP_SUMMARY
echo "========================================"
echo $TEST_COMMAND | tee -a $GITHUB_STEP_SUMMARY
echo "--------------------"
cat $f
fi
done
echo "</details>" >> $GITHUB_STEP_SUMMARY
test $FAILSIZE = "0"
mutate:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install build tools
run: |
sudo apt update && sudo apt install -y clang-${{env.MULL_LLVM_VERSION}} ninja-build python3-venv python3-pip
- name: Install mull
run: |
wget https://github.com/mull-project/mull/releases/download/${{env.MULL_VERSION}}/Mull-${{env.MULL_LLVM_VERSION}}-${{env.MULL_VERSION}}-LLVM-${{env.MULL_LLVM_VERSION}}.1-ubuntu-24.04.deb
sudo dpkg -i Mull-${{env.MULL_LLVM_VERSION}}-${{env.MULL_VERSION}}-LLVM-${{env.MULL_LLVM_VERSION}}.1-ubuntu-24.04.deb
- name: Restore CPM cache
env:
cache-name: cpm-cache-0
id: cpm-cache-restore
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
restore-keys: |
${{runner.os}}-${{env.cache-name}}-
- name: Configure CMake
env:
CC: "/usr/lib/llvm-${{env.MULL_LLVM_VERSION}}/bin/clang"
CXX: "/usr/lib/llvm-${{env.MULL_LLVM_VERSION}}/bin/clang++"
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache
- name: Save CPM cache
env:
cache-name: cpm-cache-0
if: steps.cpm-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- name: Install python test requirements
run: |
python3 -m venv ${{github.workspace}}/test_venv
source ${{github.workspace}}/test_venv/bin/activate
pip install -r ${{github.workspace}}/requirements.txt
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
- name: Build and run mull tests
run: cmake --build build -t mull_tests
merge_ok:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
needs: [build_and_test_24, build_and_test_22, mutate, quality_checks_pass, sanitize, valgrind]
if: ${{ !cancelled() }}
steps:
- name: Enable merge
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
}}
run: exit 1