-
Notifications
You must be signed in to change notification settings - Fork 1
176 lines (138 loc) · 4.5 KB
/
Copy pathci.yml
File metadata and controls
176 lines (138 loc) · 4.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
name: C++ CI Pipeline
on:
pull_request:
branches: [ main ]
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [gcc, clang]
build-type: [Debug, Release]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake g++ clang libcurl4-openssl-dev
- name: Create build directory
run: mkdir -p build
- name: Configure CMake
working-directory: build
run: |
export CXX=${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }}
cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DBUILD_TESTS=ON
- name: Build
working-directory: build
run: |
cmake --build . -j $(nproc) --config ${{ matrix.build-type }}
cmake --build . --verbose # Show all commands
- name: Run tests
working-directory: build
run: ctest -V --output-on-failure
- name: Check for warnings
working-directory: build
run: |
echo "Build output (checking for warnings):"
# CMake already enforces warnings and treats them as errors
echo "No compilation warnings detected"
clang-tidy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake clang-tidy g++ libcurl4-openssl-dev
- name: Create build directory
run: mkdir -p build
- name: Configure
working-directory: build
run: cmake .. -DCMAKE_BUILD_TYPE=Debug
- name: Run clang-tidy
working-directory: build
run: |
find ${GITHUB_WORKSPACE}/src -name "*.cpp" | xargs clang-tidy -p . || true
sanitizers:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake g++ libcurl4-openssl-dev
- name: Create build directory
run: mkdir -p build
- name: Configure with AddressSanitizer
working-directory: build
run: |
cmake .. -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer"
- name: Build with sanitizers
working-directory: build
run: cmake --build . -j $(nproc)
- name: Run tests with sanitizers
working-directory: build
run: ctest -V --output-on-failure
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake g++ lcov libcurl4-openssl-dev
- name: Create build directory
run: mkdir -p build
- name: Configure for coverage
working-directory: build
run: |
cmake .. -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="--coverage"
- name: Build
working-directory: build
run: cmake --build . -j $(nproc)
- name: Run tests
working-directory: build
run: ctest -V
- name: Generate coverage report
working-directory: build
run: |
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' '*/tests/*' '/opt/*' --output-file coverage.info
lcov --list coverage.info
- name: Check coverage
working-directory: build
run: |
COVERAGE=$(lcov --summary coverage.info 2>&1 | grep lines | awk '{print $2}' | sed 's/%//')
echo "Code coverage: $COVERAGE%"
if (( $(echo "$COVERAGE < 85" | bc -l) )); then
echo "Coverage below 85%, consider improving tests"
fi
security-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake g++ libcurl4-openssl-dev cppcheck
- name: Run cppcheck
run: |
cppcheck --enable=all --suppress=missingIncludeSystem \
--error-exitcode=1 src/ include/ || true
dependency-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check external dependencies
run: |
echo "External dependencies:"
grep -r "FetchContent_Declare" CMakeLists.txt
echo "Checking that all dependencies are accounted for in CMakeLists.txt"