-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (86 loc) · 3.12 KB
/
Copy pathci.yml
File metadata and controls
98 lines (86 loc) · 3.12 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
name: CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
# [x] build
# [ ] static analysis
# [x] unit tests
# [ ] intergration tests
# [ ] artifacts
# [ ] deploy artifacts to storage or servers
# [ ] performance and something
# [x] coverage
jobs:
build-and-test:
strategy:
matrix:
compiler:
- gcc-13
- gcc-14
- clang-18
- clang-19
build_type: [Debug, Release]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build lcov
sudo apt-get install -y libgtest-dev libbenchmark-dev catch2
case "${{ matrix.compiler }}" in
gcc-13)
sudo apt-get install -y gcc-13 g++-13
echo "CC=gcc-13" >> $GITHUB_ENV
echo "CXX=g++-13" >> $GITHUB_ENV
;;
gcc-14)
sudo apt-get install -y gcc-14 g++-14
echo "CC=gcc-14" >> $GITHUB_ENV
echo "CXX=g++-14" >> $GITHUB_ENV
;;
clang-18)
sudo apt-get install -y clang-18 lld-18
echo "CC=clang-18" >> $GITHUB_ENV
echo "CXX=clang++-18" >> $GITHUB_ENV
;;
clang-19)
sudo apt-get install -y clang-19 lld-19
echo "CC=clang-19" >> $GITHUB_ENV
echo "CXX=clang++-19" >> $GITHUB_ENV
;;
esac
- name: Clean build directory
run: rm -rf build
- name: Configure CMake
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
${{ matrix.compiler == 'gcc-14' && matrix.build_type == 'Release' && '-DENABLE_COVERAGE=ON' || '' }}
- name: Build
run: cmake --build build
- name: Run unit tests
run: ctest --test-dir build --output-on-failure
- name: Capture coverage
if: matrix.compiler == 'gcc-14' && matrix.build_type == 'Release'
run: |
lcov --gcov-tool gcov-14 --directory build --capture --output-file coverage.info \
--ignore-errors mismatch,inconsistent,unused \
--rc geninfo_unexecuted_blocks=1
lcov --gcov-tool gcov-14 --remove coverage.info '/usr/*' \
'*/tests/bench_catch_tests/*' \
'*/tests/benchmark_tests/*' \
'*/tests/*.cpp' \
--output-file coverage.info \
--ignore-errors unused \
--rc geninfo_unexecuted_blocks=1
lcov --gcov-tool gcov-14 --list coverage.info
- name: Upload to Codecov
if: matrix.compiler == 'gcc-14' && matrix.build_type == 'Release'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.info