-
Notifications
You must be signed in to change notification settings - Fork 42
490 lines (484 loc) · 17.8 KB
/
ci.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
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
name: CI
on: [push, pull_request]
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
jobs:
build_and_test_windows:
name: Windows
strategy:
fail-fast: false
matrix:
toolset: ["14.0", "14.1", "14.2", "14.4"]
compiler: [msvc, clang]
config: [Release, Debug]
standard: ["11", "17"]
include:
- config: Debug
sccache: "false"
cmake_extra: ""
- config: Release
sccache: "true"
cmake_extra: -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
- compiler: clang
cxx: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe
cc: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe
os: windows-2022
# disable cache in Windows with Clang, as it fails compilation with latest compilers
sccache: "false"
cmake_extra: ""
vsvarsall: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat
- compiler: msvc
cxx: cl
cc: cl
os: windows-2022
vsvarsall: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat
- toolset: "14.0"
compiler: msvc
os: windows-2019
vsvarsall: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat
- toolset: "14.1"
compiler: msvc
os: windows-2019
vsvarsall: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat
exclude:
- compiler: clang
toolset: "14.1"
- compiler: clang
toolset: "14.2"
- compiler: clang
toolset: "14.0"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: setup
run: |
choco install -y ninja sccache
- name: ccache
if: ${{ matrix.sccache == 'true' }}
uses: hendrikmuhs/[email protected]
with:
key: windows-${{ matrix.compiler }}-${{ matrix.toolset }}-${{ matrix.config }}
variant: sccache
- name: configure
shell: cmd
run: |
mkdir build
cd build
call "${{ matrix.vsvarsall }}" amd64 -vcvars_ver=${{ matrix.toolset }}
cmake .. -GNinja ^
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" ^
-DCMAKE_CXX_COMPILER="${{ matrix.cxx }}" ^
-DCMAKE_C_COMPILER="${{ matrix.cc }}" ^
-DCMAKE_CXX_STANDARD="${{ matrix.standard }}" ^
${{ matrix.cmake_extra }} ^
-DCMAKE_BUILD_TYPE=${{ matrix.config }}
- name: build
shell: cmd
run: |
cd build
call "${{ matrix.vsvarsall }}" amd64 -vcvars_ver=${{ matrix.toolset }}
cmake --build .
- name: test
shell: cmd
run: |
cd build
call "${{ matrix.vsvarsall }}" amd64 -vcvars_ver=${{ matrix.toolset }}
ctest --no-compress-output --output-on-failure -j3 --output-junit test_results.xml
- name: upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results (windows ${{ matrix.compiler }}-${{ matrix.toolset }}-${{ matrix.config }})
path: build/test_results.xml
- name: install
shell: cmd
run: |
cd build
call "${{ matrix.vsvarsall }}" amd64 -vcvars_ver=${{ matrix.toolset }}
cmake --install .
- name: install test
shell: cmd
run: |
mkdir installtest
cd installtest
call "${{ matrix.vsvarsall }}" amd64 -vcvars_ver=${{ matrix.toolset }}
cmake ..\\samples -GNinja ^
-DCMAKE_CXX_COMPILER="${{ matrix.cxx }}" ^
-DCMAKE_C_COMPILER="${{ matrix.cc }}" ^
-DCMAKE_CXX_STANDARD="${{ matrix.standard }}" ^
-DCMAKE_BUILD_TYPE=${{ matrix.config }} ^
${{ matrix.cmake_extra }} ^
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/install"
cmake --build .
build_and_test_clang:
name: Linux/Clang
strategy:
fail-fast: false
matrix:
compiler:
- clang-11
- clang-12
- clang-13
- clang-14
- clang-15
config: [Release, Debug]
reuse_slots: [OFF, ON]
standard: ["11", "17"]
include:
- compiler: clang-11
cxx: clang++-11
cc: clang-11
os: ubuntu-20.04
- compiler: clang-12
cxx: clang++-12
cc: clang-12
os: ubuntu-22.04
- compiler: clang-13
cxx: clang++-13
cc: clang-13
os: ubuntu-22.04
- compiler: clang-14
cxx: clang++-14
cc: clang-14
os: ubuntu-22.04
- compiler: clang-15
cxx: clang++-15
cc: clang-15
os: ubuntu-22.04
exclude:
- config: Debug
reuse_slots: ON
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: setup
run: |
sudo apt-get update
sudo apt-get install -y ccache ninja-build ${{ matrix.compiler }}
- name: Setup cmake
uses: jwlawson/[email protected]
with:
github-api-token: ${{ secrets.CMAKE_TOKEN }}
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: linux-${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }}
- name: configure
run: |
mkdir build
cd build
cmake .. -GNinja \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
-DCMAKE_CXX_STANDARD=${{ matrix.standard }} \
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DXAD_TAPE_REUSE_SLOTS=${{ matrix.reuse_slots }} \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
- name: build
run: |
cd build
cmake --build .
- name: test
run: |
cd build
ctest --no-compress-output --output-on-failure --parallel $(($(nproc) + 2)) --output-junit test_results.xml
- name: upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results (linux ${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }})
path: build/test_results.xml
- name: install
run: |
cd build
cmake --install .
- name: install test
run: |
mkdir installtest
cd installtest
cmake ../samples -GNinja \
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/install" \
-DCMAKE_CXX_STANDARD=${{ matrix.standard }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
-DCMAKE_C_COMPILER=${{ matrix.cc }}
cmake --build .
build_and_test_gcc:
name: Linux/Gcc
strategy:
fail-fast: false
matrix:
compiler:
- gcc5
- gcc6
- gcc7
- gcc8
- gcc9
- gcc10
- gcc11
config: [Release, Debug]
reuse_slots: [OFF, ON]
standard: [c++11, c++17]
exclude:
- config: Debug
reuse_slots: ON
- compiler: gcc5
standard: c++17
- compiler: gcc6
standard: c++17
- compiler: gcc7
standard: c++17
include:
- config: Debug
compiler: gcc11
coverage: true
coverage_cxx_flags: "-fprofile-arcs -ftest-coverage"
coverage_ld_flags: "-lgcov"
standard: c++11
- compiler: gcc11
config: Debug # also with reusing slots, for coverage
reuse_slots: ON
coverage: true
coverage_cxx_flags: "-fprofile-arcs -ftest-coverage"
coverage_ld_flags: "-lgcov"
standard: c++11
runs-on: ubuntu-latest
container:
image: conanio/${{ matrix.compiler }}
options: --user root
env:
ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION: node16
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
steps:
- uses: actions/checkout@v3
- name: Setup tools
run: |
cat /etc/lsb-release
/lib/x86_64-linux-gnu/libc.so.6
sudo rm -f /etc/apt/sources.list.d/git-core-ubuntu-ppa-artful.list || true
sudo rm -f /etc/apt/sources.list.d/git-core-ubuntu-ppa-xenial.list || true
sudo apt-get update
sudo apt-get install -y ccache ninja-build lcov
- name: GitHub WS Tmp
# there is an issue with workspace locations in github inside containers, which this works around
# see: https://github.com/actions/runner/issues/2058
run: |
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Setup cmake
run: |
wget https://github.com/Kitware/CMake/releases/download/v3.29.0/cmake-3.29.0-linux-x86_64.tar.gz
tar -xzf cmake-3.29.0-linux-x86_64.tar.gz
sudo rm /usr/bin/cmake /usr/share/cmake-* -rf
echo $(pwd)/cmake-3.29.0-linux-x86_64/bin >> $GITHUB_PATH
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: linux-${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }}
- name: configure
run: |
mkdir build
cd build
cmake .. -GNinja \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DCMAKE_CXX_FLAGS="-std=${{ matrix.standard }} ${{ matrix.coverage_cxx_flags }}" \
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.coverage_ld_flags }}" \
-DXAD_TAPE_REUSE_SLOTS=${{ matrix.reuse_slots }} \
-DCMAKE_INSTALL_PREFIX=${{ env.GITHUB_WORKSPACE }}/install
- name: build
run: |
cd build
cmake --build .
- name: coverage baseline
if: ${{ matrix.coverage }}
run: |
cd build
mkdir coverage tmp
lcov --no-external --capture --initial --directory ${{ env.GITHUB_WORKSPACE }} --output-file ./tmp/lcov_base.info
- name: test
run: |
cd build
ctest --no-compress-output --output-on-failure --parallel $(($(nproc) + 2)) --output-junit test_results.xml
- name: upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results (linux ${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }})
path: ${{ env.GITHUB_WORKSPACE }}/build/test_results.xml
- name: coverage tests
if: ${{ matrix.coverage }}
run: |
cd build
lcov --no-external --capture --directory ${{ env.GITHUB_WORKSPACE }} --output-file ./tmp/lcov_run.info
lcov --add-tracefile ./tmp/lcov_base.info --add-tracefile ./tmp/lcov_run.info --output-file ./tmp/lcov_total.info
lcov --remove ./tmp/lcov_total.info "$PWD/*" "${{ env.GITHUB_WORKSPACE }}/test/*" "${{ env.GITHUB_WORKSPACE }}/samples/*" --output-file ./coverage/lcov.info
- name: upload coverage results
if: ${{ matrix.coverage }}
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: linux-${{ matrix.compiler }}-${{ matrix.reuse_slots }}
path-to-lcov: ${{env.GITHUB_WORKSPACE }}/build/coverage/lcov.info
parallel: true
- name: install
run: |
cd build
cmake --install .
- name: install test
if: ${{ ! matrix.coverage }}
run: |
mkdir installtest
cd installtest
cmake ../samples -GNinja \
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_PREFIX_PATH="${{ env.GITHUB_WORKSPACE }}/install" \
-DCMAKE_CXX_FLAGS="-std=${{ matrix.standard}}" \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.coverage_ld_flags }}"
cmake --build .
build_and_test_macos:
name: Mac
strategy:
fail-fast: false
matrix:
config: [Release, Debug]
os: [macos-13, macos-latest]
compiler: [default, clang15]
standard: [c++11, c++17]
include:
- config: Release
os: macos-13
compiler: default
coverage: false
- config: Debug
os: macos-13
compiler: default
coverage: true
coverage_cxx_flags: "-fprofile-arcs -ftest-coverage"
coverage_ld_flags: "-ftest-coverage"
standard: c++11
- config: Release
os: macos-latest
compiler: clang15
coverage: false
- config: Debug
os: macos-latest
compiler: clang15
coverage: true
coverage_cxx_flags: "-fprofile-arcs -ftest-coverage"
coverage_ld_flags: "-ftest-coverage"
standard: c++17
exclude:
- os: macos-13
compiler: clang15
- os: macos-latest
compiler: default
runs-on: ${{ matrix.os }}
steps:
- name: setup
run: |
brew update
brew install ninja ccache
- name: setup coverage
if: ${{ matrix.coverage }}
# needs to be lcov1.14 specifically and brew no longer supports version selection
run: |
git clone --branch v1.14 https://github.com/linux-test-project/lcov.git
cd lcov
sudo make install
- uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: macos-${{ matrix.config }}
- name: configure
run: |
mkdir build
cd build
cmake .. -GNinja \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \
-DCMAKE_CXX_FLAGS="-std=${{matrix.standard }} ${{ matrix.coverage_cxx_flags }}" \
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.coverage_ld_flags }}" \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install \
${{ matrix.compiler == 'clang15' && ' -DCMAKE_CXX_COMPILER=$(brew --prefix llvm@15)/bin/clang++ -DCMAKE_C_COMPILER=clang' || '' }}
- name: build
run: |
cd build
cmake --build .
- name: coverage baseline
if: ${{ matrix.coverage }}
run: |
cd build
mkdir coverage tmp
lcov --no-external --capture --initial --directory ${{ github.workspace }} --output-file ./tmp/lcov_base.info
- name: test
run: |
cd build
ctest --no-compress-output --output-on-failure -j$(sysctl -n hw.ncpu) --output-junit test_results.xml
- name: upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results (macos ${{ matrix.config }})
path: build/test_results.xml
- name: coverage tests
if: ${{ matrix.coverage }}
run: |
cd build
lcov --no-external --capture --directory ${{ github.workspace }} --output-file ./tmp/lcov_run.info
lcov --add-tracefile ./tmp/lcov_base.info --add-tracefile ./tmp/lcov_run.info --ignore-errors inconsistent --output-file ./tmp/lcov_total.info
lcov --remove ./tmp/lcov_total.info "$PWD/*" "${{ github.workspace }}/test/*" "${{ github.workspace }}/samples/*" --ignore-errors inconsistent --output-file ./coverage/lcov.info
- name: upload coverage results
if: ${{ matrix.coverage }}
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: macos
path-to-lcov: build/coverage/lcov.info
parallel: true
- name: install
run: |
cd build
cmake --install .
- name: install test
if: ${{ ! matrix.coverage }}
run: |
mkdir installtest
cd installtest
cmake ../samples -GNinja \
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_FLAGS="-std=${{ matrix.standard }}" \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/install" \
${{ matrix.compiler == 'clang15' && ' -DCMAKE_CXX_COMPILER=$(brew --prefix llvm@15)/bin/clang++ -DCMAKE_C_COMPILER=clang' || '' }}
cmake --build .
coverage_finish:
name: Coverage Collect
needs: [ build_and_test_gcc, build_and_test_macos]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
- name: Rerun coverage workaround
# from https://github.com/lemurheavy/coveralls-public/issues/1653#issuecomment-1251587119
run: |
curl --location --request GET 'https://coveralls.io/rerun_build?repo_token=${{ secrets.COVERALLS_REPO_TOKEN }}&build_num=${{ github.run_id }}'
event_file:
name: Event File
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{ github.event_path }}