-
Notifications
You must be signed in to change notification settings - Fork 1
178 lines (145 loc) · 4.33 KB
/
ci.yml
File metadata and controls
178 lines (145 loc) · 4.33 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
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
BUILD_TYPE: Debug
jobs:
lint:
name: Format & Lint Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install clang-format
run: sudo apt-get install -y clang-format-17
- name: Check formatting
run: |
find include src test bench examples -name '*.cpp' -o -name '*.h' -o -name '*.hpp' | \
xargs clang-format-17 --dry-run --Werror
build-linux:
name: Linux (${{ matrix.compiler }})
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: false
matrix:
include:
- compiler: gcc
cc: gcc-13
cxx: g++-13
preset: ci-linux-gcc
- compiler: clang
cc: clang-17
cxx: clang++-17
preset: ci-linux-clang
steps:
- uses: actions/checkout@v4
- name: Install compiler
run: |
sudo apt-get update
if [ "${{ matrix.compiler }}" = "gcc" ]; then
sudo apt-get install -y g++-13
else
sudo apt-get install -y clang-17
fi
- name: Configure
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: cmake --preset ${{ matrix.preset }}
- name: Build
run: cmake --build --preset ${{ matrix.preset }} -j$(nproc)
- name: Test
run: ctest --preset ${{ matrix.preset }}
build-macos:
name: macOS (AppleClang)
runs-on: macos-latest
needs: lint
steps:
- uses: actions/checkout@v4
- name: Configure
run: cmake --preset ci-macos-clang
- name: Build
run: cmake --build --preset ci-macos-clang -j$(sysctl -n hw.logicalcpu)
- name: Test
run: ctest --preset ci-macos-clang
build-windows:
name: Windows (MSVC)
runs-on: windows-latest
needs: lint
steps:
- uses: actions/checkout@v4
- name: Configure
run: cmake --preset ci-windows-msvc
- name: Build
run: cmake --build --preset ci-windows-msvc
- name: Test
run: ctest --preset ci-windows-msvc
coverage:
name: Code Coverage
runs-on: ubuntu-latest
needs: build-linux
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y lcov g++-13
- name: Configure
env:
CC: gcc-13
CXX: g++-13
run: cmake --preset coverage
- name: Build
run: cmake --build --preset coverage -j$(nproc)
- name: Run tests
run: ctest --preset coverage
- name: Generate coverage report
run: |
cd build/coverage
lcov --capture --directory . --output-file coverage.info --rc lcov_branch_coverage=1
lcov --remove coverage.info \
"*/test/*" "*/bench/*" "*/examples/*" "*/_deps/*" "*/usr/*" \
--output-file coverage_filtered.info --rc lcov_branch_coverage=1
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: build/coverage/coverage_filtered.info
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
sanitizers:
name: Sanitizer (${{ matrix.sanitizer }})
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: false
matrix:
include:
- sanitizer: address
flags: "-DENABLE_SANITIZER_ADDRESS=ON -DENABLE_SANITIZER_UNDEFINED=ON"
- sanitizer: thread
flags: "-DENABLE_SANITIZER_ADDRESS=OFF -DENABLE_SANITIZER_UNDEFINED=OFF -DENABLE_SANITIZER_THREAD=ON"
steps:
- uses: actions/checkout@v4
- name: Install compiler
run: |
sudo apt-get update
sudo apt-get install -y clang-17
- name: Configure
env:
CC: clang-17
CXX: clang++-17
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TESTS=ON -DENABLE_SANITIZERS=ON \
${{ matrix.flags }}
- name: Build
run: cmake --build build -j$(nproc)
- name: Test
run: cd build && ctest --output-on-failure --timeout 120