-
Notifications
You must be signed in to change notification settings - Fork 6
305 lines (259 loc) · 8.29 KB
/
test.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
name: Test
on:
push:
branches: [ master ]
tags:
- "*"
pull_request:
branches:
- "**"
schedule:
- cron: 30 0 * * *
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
sanitizers:
strategy:
fail-fast: false
matrix:
suffix:
- none
- vectorized
arch:
- amd64
- arm64
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'arm-4core-linux-arm-limited' }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Create directories
run: mkdir Debug
- name: Install dependencies
if: matrix.arch == 'arm64'
run: sudo apt update ; sudo apt install -y cmake git make curl
- name: Install clang-{tidy,format}
run: |
sudo .github/workflows/scripts/llvm.sh 17
sudo apt-get install -y clang-17 clang++-17
- name: CMake
env:
CC: clang-17
CXX: clang++-17
run: |
cmake .. -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="-fsanitize=address,leak,undefined -DASAN_BUILD" \
-DCMAKE_C_FLAGS="-fsanitize=address,leak,undefined -DASAN_BUILD" \
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,leak,undefined" \
-DCMAKE_MODULE_LINKER_FLAGS="-fsanitize=address,leak,undefined" \
-DLIBDDWAF_VECTORIZED_TRANSFORMERS=$([ "${{ matrix.suffix }}" != "none" ] && echo "ON" || echo "OFF")
working-directory: Debug
- name: Build
run: VERBOSE=1 make -j $(nproc) waf_test waf_validator
working-directory: Debug
- name: Test
run: ASAN_OPTIONS="verbosity=1 fast_unwind_on_malloc=0 detect_leaks=1" make test
working-directory: Debug
- name: Validate
run: ASAN_OPTIONS="verbosity=1 fast_unwind_on_malloc=0 detect_leaks=1" make validate
working-directory: Debug
valgrind:
strategy:
fail-fast: false
matrix:
suffix:
- none
- vectorized
arch:
- amd64
- arm64
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'arm-4core-linux-arm-limited' }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: sudo apt update ; sudo apt install -y valgrind cmake gcc-12 g++-12 git make curl
- name: Create directories
run: mkdir Debug
- name: CMake
env:
CC: gcc-12
CXX: g++-12
run: |
cmake .. \
-DCMAKE_BUILD_TYPE=Debug \
-DLIBDDWAF_VECTORIZED_TRANSFORMERS=$([ "${{ matrix.suffix }}" != "none" ] && echo "ON" || echo "OFF")
working-directory: Debug
- name: Build
run: VERBOSE=1 make -j $(nproc) waf_test waf_validator
working-directory: Debug
- name: Test
run: make test_valgrind
working-directory: Debug
- name: Validate
run: make validate_valgrind
working-directory: Debug
coverage:
strategy:
fail-fast: false
matrix:
suffix:
- none
- vectorized
arch:
- amd64
- arm64
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'arm-4core-linux-arm-limited' }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y cmake gcc-12 g++-12 git make curl python3 python3-venv python3-pip
python3 -m venv .venv
source .venv/bin/activate
pip install gcovr==7.2
- name: Create directories
run: mkdir Debug
- name: CMake
env:
CC: gcc-12
CXX: g++-12
run: |
cmake .. \
-DLIBDDWAF_TEST_COVERAGE=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DLIBDDWAF_VECTORIZED_TRANSFORMERS=$([ "${{ matrix.suffix }}" != "none" ] && echo "ON" || echo "OFF")
working-directory: Debug
- name: Build
run: VERBOSE=1 make -j $(nproc) waf_test waf_validator
working-directory: Debug
- name: Test
run: make test
working-directory: Debug
- name: Validate
run: make validate
working-directory: Debug
- name: Generate coverage
run: |
source ../.venv/bin/activate
gcovr --version
gcovr --gcov-executable gcov-12 --exclude-throw-branches -v -f '.*src.*' -e ".*src/vendor/.*" --json -o coverage-${{ matrix.suffix }}-${{ matrix.arch }}.json
working-directory: Debug
- uses: actions/upload-artifact@v4
with:
name: coverage_${{ matrix.suffix }}_${{ matrix.arch }}
path: ${{ github.workspace }}/Debug/coverage-${{ matrix.suffix }}-${{ matrix.arch }}.json
upload-coverage:
needs: [ coverage ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y python3 python3-venv python3-pip
python3 -m venv .venv
source .venv/bin/activate
pip install gcovr==7.2
- name: Generate coverage
run: |
source .venv/bin/activate
gcovr --version
gcovr --merge-mode-functions merge-use-line-0 --json-add-tracefile "artifacts/*/coverage-*.json" -x coverage.xml
mkdir -p coverage
gcovr --merge-mode-functions merge-use-line-0 --json-add-tracefile "artifacts/*/coverage-*.json" --html-details coverage/coverage.html
- name: Submit coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: waf_test
verbose: true
files: coverage.xml
- uses: actions/upload-artifact@v4
with:
name: coverage
path: ${{ github.workspace }}/coverage/
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Create directories
run: mkdir Debug
- name: Install clang-{tidy,format}
run: |
DEBIAN_FRONTEND="noninteractive" sudo apt-get -y remove python3-lldb-14
sudo .github/workflows/scripts/llvm.sh 17
sudo apt-get install -y clang-tidy-17 clang-format-17
- name: CMake
env:
CXX: clang++-17
CC: clang-17
run: |
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCLANG_TIDY=/usr/bin/run-clang-tidy-17 \
-DCLANG_FORMAT=/usr/bin/clang-format-17
working-directory: Debug
- name: Build
run: VERBOSE=1 make -j $(nproc)
working-directory: Debug
- name: Format
run: make format
working-directory: Debug
- name: Tidy
run: make tidy
working-directory: Debug
tools:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Create directories
run: mkdir Debug
- name: CMake
env:
CC: gcc-12
CXX: g++-12
run: |
cmake .. -DCMAKE_BUILD_TYPE=Debug
working-directory: Debug
- name: Build
run: VERBOSE=1 make -j $(nproc) verify_rule verify_ruleset waf_runner validate_schema
working-directory: Debug
#verify_ruleset:
#runs-on: ubuntu-latest
#strategy:
#fail-fast: false
#steps:
#- uses: actions/checkout@v4
#with:
#submodules: recursive
#- name: Create directories
#run: mkdir Debug
#- name: CMake
#env:
#CC: gcc-12
#CXX: g++-12
#run: |
#cmake .. -DCMAKE_BUILD_TYPE=Debug
#working-directory: Debug
#- name: Build
#run: VERBOSE=1 make -j $(nproc) verify_ruleset proj_event_rules
#working-directory: Debug
#- name: Verify
#run: ./tools/verify_ruleset ./third_party/proj_event_rules-prefix/src/proj_event_rules/build/recommended.json
#working-directory: Debug