-
Notifications
You must be signed in to change notification settings - Fork 2
295 lines (247 loc) · 8.17 KB
/
Copy pathqa-analysis.yml
File metadata and controls
295 lines (247 loc) · 8.17 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
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
name: Quality Assurance
on:
workflow_dispatch:
push:
branches:
- main
# PRs trigger for all the default events
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
FORCE_COLOR: 3
COLUMNS: 120
CPM_USE_LOCAL_PACKAGES: "TRUE"
jobs:
cpp-changes:
name: Detect C++ file changes
runs-on: ubuntu-slim
outputs:
any: ${{ steps.detect.outputs.any_changed }}
files: ${{ steps.detect.outputs.all_changed_files }}
steps:
- uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- name: Detect C++ file changes
id: detect
uses: tj-actions/changed-files@v47.0.6
with:
matrix: true
files: |
cpp/monoprop/**/*.cpp
cpp/monoprop/**/*.h
cpp/monoprop/**/*.inl
cpp/include/monoprop/**/*.h
cpp/include/monoprop/**/*.inl
coverage-run:
name: Collect coverage [mpi:${{ matrix.mpi }}]
runs-on: ubuntu-26.04
strategy:
fail-fast: false
matrix:
mpi: ["off", "on"]
steps:
- uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- name: Set up the build environment
uses: ./.github/actions/setup
with:
cache-suffix: coverage-mpi-${{ matrix.mpi }}
mpi: ${{ matrix.mpi }}
- name: Collect coverage
run: |
just code-coverage-collect \
"${{ matrix.mpi }}" \
build/editable/Coverage \
coverage-data
- name: Upload coverage data
uses: actions/upload-artifact@v7
with:
name: coverage-mpi-${{ matrix.mpi }}
path: coverage-data
include-hidden-files: true
if-no-files-found: error
retention-days: 1
code-coverage:
name: Check code coverage
runs-on: ubuntu-26.04
needs: [coverage-run]
steps:
- uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- name: Set up the build environment
uses: ./.github/actions/setup
with:
cache-suffix: coverage-report
- name: Download coverage data
uses: actions/download-artifact@v8
with:
pattern: coverage-mpi-*
path: coverage-input
- name: Combine coverage
run: |
just code-coverage-aggregate \
coverage-input/coverage-mpi-off \
coverage-input/coverage-mpi-on \
.
- name: Upload combined coverage to Codecov
uses: codecov/codecov-action@v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: python-coverage.xml, cpp-coverage-through-python-bindings.xml, cpp-coverage.xml
flags: cpp
disable_search: true
fail_ci_if_error: true
- name: Upload coverage reports for SonarQube
uses: actions/upload-artifact@v7
with:
name: coverage-reports
path: |
python-coverage.xml
cpp-coverage-through-python-bindings-sonar.xml
cpp-coverage-sonar.xml
if-no-files-found: error
retention-days: 1
gcc-asan-ubsan:
name: GCC ASan+LSan+UBSan
runs-on: ubuntu-26.04
permissions:
contents: read
# The build type also selects the tree the test recipes run against.
env:
SKBUILD_CMAKE_BUILD_TYPE: "AsanUbsan"
SKBUILD_CMAKE_DEFINE: "monoprop_SANITIZER=asan-ubsan"
steps:
- uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- name: Set up the build environment
uses: ./.github/actions/setup
with:
cache-suffix: gcc-asan-ubsan
- name: Install package
run: just build --group workspace-test
- name: Run C++ unit tests
run: just test-cpp-asan
- name: Run Python tests
run: just test-py-asan
- name: Show sanitizer reports
if: failure()
run: just sanitizer-reports
gcc-tsan:
# TSan cannot load instrumented _core into stock CPython; Python coverage needs an
# instrumented interpreter. C++ tests cover the relevant partition and ShmComm paths.
name: GCC ThreadSanitizer (C++)
runs-on: ubuntu-26.04
permissions:
contents: read
env:
SKBUILD_CMAKE_BUILD_TYPE: "Tsan"
SKBUILD_CMAKE_DEFINE: "monoprop_SANITIZER=tsan"
steps:
- uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- name: Set up the build environment
uses: ./.github/actions/setup
with:
cache-suffix: gcc-tsan
- name: Install package
run: just build --group workspace-test
- name: Run C++ partition and ShmComm tests
run: just test-cpp-tsan
sonarqube-analysis:
name: SonarQube analysis
runs-on: ubuntu-26.04
needs: [code-coverage]
steps:
- uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- name: Set up the build environment
uses: ./.github/actions/setup
with:
cache-suffix: sonarqube-mpi
mpi: "on"
- name: Install package
env:
SKBUILD_CMAKE_DEFINE: "monoprop_ENABLE_CXX_UNIT_TESTS=OFF"
monoprop_ENABLE_MPI: "ON"
run: just build
- name: Download coverage reports
uses: actions/download-artifact@v8
with:
name: coverage-reports
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v8.2.1
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.cfamily.compile-commands=build/editable/Release/compile_commands.json
clang-tidy:
needs: [cpp-changes]
# Skip when no production C++ sources or headers changed.
if: ${{ needs.cpp-changes.outputs.any == 'true' }}
permissions:
contents: read
name: clang-tidy analysis
runs-on: ubuntu-26.04
continue-on-error: true
steps:
- uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Set up the build environment
uses: ./.github/actions/setup
with:
cache-suffix: clang-tidy-mpi
mpi: "on"
- name: Build (generates compile_commands.json)
env:
SKBUILD_CMAKE_DEFINE: "CMAKE_CXX_COMPILER=clang++;monoprop_ENABLE_CXX_UNIT_TESTS=OFF"
monoprop_ENABLE_MPI: "ON"
run: just build
- name: Register clang-tidy problem matcher
run: echo "::add-matcher::.github/problem-matchers/clang-tidy.json"
- name: Run clang-tidy via run-clang-tidy
env:
CHANGED_CXX_FILES: ${{ needs.cpp-changes.outputs.files }}
FORCE_COLOR: "0"
run: |
set -o pipefail
mapfile -t changed_cpp_files < <(
jq -r --arg workspace "$GITHUB_WORKSPACE/" \
'.[] | select(endswith(".cpp")) | $workspace + .' <<< "$CHANGED_CXX_FILES"
)
if jq -e 'any(.[]; test("\\.(h|inl)$"))' <<< "$CHANGED_CXX_FILES" > /dev/null; then
mapfile -t clang_tidy_inputs < <(
jq -r --arg source_root "$GITHUB_WORKSPACE/cpp/monoprop/" \
'.[].file | select(startswith($source_root)) | select(endswith(".cpp"))' \
build/editable/Release/compile_commands.json
)
else
clang_tidy_inputs=("${changed_cpp_files[@]}")
fi
line_filter=$(jq -cn \
--arg workspace "$GITHUB_WORKSPACE/" \
--argjson files "$CHANGED_CXX_FILES" \
'$files | map({name: ($workspace + .), lines: [[1, 2147483647]]})')
run-clang-tidy \
-p build/editable/Release \
-source-filter='^${{ github.workspace }}/cpp/monoprop/.*$' \
-header-filter='^(.*/)?cpp/(include/)?monoprop/.*$' \
-exclude-header-filter='^.*/src/monoprop/bindings/.*$' \
-line-filter="$line_filter" \
-extra-arg=-fno-color-diagnostics \
-j "$(nproc)" \
"${clang_tidy_inputs[@]}" \
2>&1 | tee /tmp/clang-tidy-output.txt
- name: Remove clang-tidy problem matcher
if: always()
run: echo "::remove-matcher owner=clang-tidy::"