Skip to content

Commit e8c4548

Browse files
updating CI to use CTest
1 parent c115458 commit e8c4548

File tree

1 file changed

+83
-41
lines changed

1 file changed

+83
-41
lines changed

.gitlab-ci.yml

Lines changed: 83 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ workflow:
158158
build_test:
159159
script:
160160
- mkdir -p install build && cd ./build && ../bootstrap.sh --prefix=../install --with-datasets=${ALP_DATASETS}
161-
&& make -j$(nproc) build_tests_all
161+
- make -j$(nproc) && make -j$(nproc) build_tests_all
162162
- *strip_symbols
163163
artifacts:
164164
paths:
@@ -171,39 +171,61 @@ build_test:
171171
expire_in: 2 hours
172172

173173

174-
build_tests_buildtype_debug_sym_debug:
174+
build_tests_build_type_debug_sym_debug:
175175
script:
176176
- mkdir -p install build && cd build && cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_CXX_FLAGS=-D_DEBUG
177-
-DCMAKE_C_FLAGS=-D_DEBUG -DCMAKE_BUILD_TYPE=Debug ../ && make -j$(nproc) build_tests_all
177+
-DCMAKE_C_FLAGS=-D_DEBUG -DCMAKE_BUILD_TYPE=Debug ../
178+
- make -j$(nproc) && make -j$(nproc) build_tests_all
178179

179180

180181
build_tests_sym_debug:
181182
rules:
182183
- if: $EXTRA_TESTS_ENABLED == "yes"
183184
script:
184185
- mkdir -p install build && cd build && cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_CXX_FLAGS=-D_DEBUG
185-
-DCMAKE_C_FLAGS=-D_DEBUG -DLPF_INSTALL_PATH=${LPF_PATH} -DCMAKE_BUILD_TYPE=Release ../ && make -j$(nproc) build_tests_all
186+
-DCMAKE_C_FLAGS=-D_DEBUG -DLPF_INSTALL_PATH=${LPF_PATH} -DCMAKE_BUILD_TYPE=Release ../
187+
- make -j$(nproc) && make -j$(nproc) build_tests_all
186188

187189

188-
tests_unit:
189-
needs: [build_test]
190+
# must specify CTEST_CATEGORY and CTEST_BACKEND to filter
191+
.ctests_run:
190192
script:
191-
- cd ./build && make -j$(nproc) tests_unit &> unittests.log
192-
- ../tests/summarise.sh unittests.log
193+
- cd build
194+
- cmake . # re-configure to update the available resources
195+
- |
196+
echo "CATEGORY: ${CTEST_CATEGORY}; BACKEND: ${CTEST_BACKEND}"
197+
- ${CMAKE_RECENT}/ctest -L "mode:${CTEST_CATEGORY}" -L "backend:${CTEST_BACKEND}" --output-junit ${CTEST_CATEGORY}.xml
198+
--output-on-failure || true
199+
- python3 ${CI_PROJECT_DIR}/tools/ctest-junit-parse.py --categories ${CTEST_CATEGORY} --xmls-dir $(pwd)
200+
--remove-successful-logs-from $(pwd)/tests
201+
artifacts:
202+
when: always
203+
name: "${CTEST_CATEGORY}_failed_tests"
204+
paths:
205+
- build/tests/${CTEST_CATEGORY}/output/
206+
- build/${CTEST_CATEGORY}.xml
207+
reports:
208+
junit: build/${CTEST_CATEGORY}.xml
209+
expire_in: 1 week
193210

194-
tests_smoke:
211+
212+
default_tests_matrix:
195213
needs: [build_test]
196-
script:
197-
- cd ./build && make -j$(nproc) tests_smoke &> smoketests.log
198-
- ../tests/summarise.sh smoketests.log
214+
variables:
215+
CTEST_BACKEND: ".*" # match all enabled backends
216+
parallel:
217+
matrix:
218+
- CTEST_CATEGORY: [unit, smoke]
219+
extends: .ctests_run
220+
199221

200222
test_installation:
201223
needs: [build_test]
202224
script:
203225
- cd ./build && make -j$(nproc) install
204226

205227

206-
build_test_buildtype_debug:
228+
build_test_build_type_debug:
207229
script:
208230
- mkdir -p install build && cd ./build && ../bootstrap.sh --prefix=../install --with-datasets=${ALP_DATASETS}
209231
--debug-build && make -j$(nproc) && make -j$(nproc) build_tests_all
@@ -216,17 +238,21 @@ build_test_buildtype_debug:
216238
- build/**/*.o.d
217239
expire_in: 2 hours
218240

241+
219242
test_smoke_build_type_debug:
220-
needs: [build_test_buildtype_debug]
221-
script:
222-
- cd ./build && make -j$(nproc) smoketests &> smoketests.log
223-
- ../tests/summarise.sh smoketests.log
243+
needs: [build_test_build_type_debug]
244+
variables:
245+
CTEST_BACKEND: ".*" # match all enabled backends
246+
CTEST_CATEGORY: smoke
247+
extends: .ctests_run
248+
224249

225250
test_installation_build_type_debug:
226-
needs: [build_test_buildtype_debug]
251+
needs: [build_test_build_type_debug]
227252
script:
228253
- cd ./build && make -j$(nproc) install
229254

255+
230256
gitleaks:
231257
image:
232258
name: "zricethezav/gitleaks:v8.0.6"
@@ -240,17 +266,20 @@ tests_performance:
240266
rules:
241267
- if: $EXTRA_TESTS_ENABLED == "yes"
242268
needs: [build_test]
243-
script:
244-
- cd ./build && make -j$(nproc) performancetests &> performancetests.log
245-
- ../tests/summarise.sh performancetests.log tests/performance/output/benchmarks tests/performance/output/scaling
269+
variables:
270+
CTEST_BACKEND: ".*" # match all enabled backends
271+
CTEST_CATEGORY: "performance"
272+
extends: .ctests_run
246273

247-
tests_unit_buildtype_debug:
274+
275+
tests_unit_build_type_debug:
248276
rules:
249277
- if: $EXTRA_TESTS_ENABLED == "yes"
250-
needs: [build_test_buildtype_debug]
251-
script:
252-
- cd ./build && make -j$(nproc) unittests &> unittests.log
253-
- ../tests/summarise.sh unittests.log
278+
needs: [build_test_build_type_debug]
279+
variables:
280+
CTEST_BACKEND: ".*" # match all enabled backends
281+
CTEST_CATEGORY: "unit"
282+
extends: .ctests_run
254283

255284

256285
## Additional tests for LPF (on main branches only)
@@ -261,7 +290,8 @@ build_test_lpf:
261290
script:
262291
# build only LPF-related tests
263292
- mkdir -p install build && cd ./build && ../bootstrap.sh --with-lpf=${LPF_PATH} --no-nonblocking --no-reference
264-
--no-hyperdags --prefix=../install --with-datasets=${ALP_DATASETS} && make -j$(nproc) build_tests_all
293+
--no-hyperdags --prefix=../install --with-datasets=${ALP_DATASETS}
294+
- make -j$(nproc) && make -j$(nproc) build_tests_all
265295
- *strip_symbols
266296
artifacts:
267297
paths:
@@ -273,12 +303,12 @@ build_test_lpf:
273303
- build/**/*.dir
274304
expire_in: 2 hours
275305

276-
# common sections for LPF unit tests
277-
.tests_unit_lpf:
306+
# common sections for LPF unit tests: must specify CTEST_CATEGORY
307+
.tests_category_lpf:
278308
needs: [build_test_lpf]
279-
script:
280-
- cd ./build && make -j$(nproc) tests_unit &> unittests.log
281-
- ../tests/summarise.sh unittests.log
309+
variables:
310+
CTEST_BACKEND: "bsp1d|hybrid" # match all enabled backends
311+
extends: .ctests_run
282312

283313
# this job triggers in internal CI, where LPF tests run better on runners
284314
# with a given tag $LPF_PREFERRED_RUNNERS_TAG
@@ -288,22 +318,29 @@ tests_unit_lpf_preferred:
288318
tags:
289319
- docker
290320
- $LPF_PREFERRED_RUNNERS_TAG
291-
extends: .tests_unit_lpf
321+
variables:
322+
CTEST_CATEGORY: "unit"
323+
extends: .tests_category_lpf
324+
292325

293326
# if runners with a specific tag are not present, run this job
294327
# attention: it may timeout
295328
tests_unit_lpf_generic:
296329
rules:
297330
- if: $LPF_TESTS_ENABLED == "yes" && $LPF_PREFERRED_RUNNERS != "yes"
298-
extends: .tests_unit_lpf
331+
variables:
332+
CTEST_CATEGORY: "unit"
333+
extends: .tests_category_lpf
334+
299335

300336
tests_smoke_lpf:
301337
rules:
302338
- if: $LPF_TESTS_ENABLED == "yes"
303339
needs: [build_test_lpf]
304-
script:
305-
- cd ./build && make -j$(nproc) tests_smoke &> smoketests.log
306-
- ../tests/summarise.sh smoketests.log
340+
variables:
341+
CTEST_CATEGORY: "smoke"
342+
extends: .tests_category_lpf
343+
307344

308345
test_installation_lpf:
309346
rules:
@@ -312,6 +349,7 @@ test_installation_lpf:
312349
script:
313350
- cd ./build && make -j$(nproc) install
314351

352+
315353
## Additional jobs to build againt multiple compilers (on main branches only)
316354

317355
build_test_gcc_versions:
@@ -333,6 +371,7 @@ build_test_gcc_versions:
333371
--with-lpf=${LPF_BASE_PATH}/build_mpich_${CC_COMPILER}_${VER}/install &&
334372
make -j$(nproc) build_tests_all
335373

374+
336375
# Coverage build + tests for each backend
337376

338377
coverage_matrix:
@@ -354,15 +393,15 @@ coverage_matrix:
354393
- echo "-- NONBLOCKING=${backends_array[3]}"
355394

356395
- rm -rf build install && mkdir -p install build && cd build
357-
- cmake -DCMAKE_INSTALL_PREFIX='../install'
396+
- cmake -DCMAKE_INSTALL_PREFIX='../install'
358397
-DCMAKE_BUILD_TYPE=Coverage
359398
-DDATASETS_DIR=${ALP_DATASETS}
360399
-DWITH_HYPERDAGS_BACKEND=${backends_array[0]}
361400
-DWITH_REFERENCE_BACKEND=${backends_array[1]}
362401
-DWITH_OMP_BACKEND=${backends_array[2]}
363402
-DWITH_NONBLOCKING_BACKEND=${backends_array[3]} ..
364-
- make -j$(nproc)
365-
- make -j$(nproc) unittests
403+
- make -j$(nproc) build_tests_category_unit
404+
- ${CMAKE_RECENT}/ctest -L "mode:unit" --output-on-failure || true # ignore not run tests (failing ones are detected in standard jobs)
366405
# for each job (i.e., each backend), generate a separate JSON to me merged later
367406
# (gcovr merges only JSON files)
368407
- python3 -m gcovr --json
@@ -375,6 +414,7 @@ coverage_matrix:
375414
- COVERAGE_${CI_JOB_ID}.json
376415
expire_in: 4 weeks
377416

417+
378418
cobertura_coverage_report:
379419
rules:
380420
- if: $COVERAGE_ENABLED == "yes" || $GENERATE_COVERAGE_PAGES == "yes"
@@ -395,6 +435,7 @@ cobertura_coverage_report:
395435
coverage_format: cobertura
396436
path: coverage.xml
397437

438+
398439
html_coverage_report:
399440
rules:
400441
- if: $COVERAGE_ENABLED == "yes" || $GENERATE_COVERAGE_PAGES == "yes"
@@ -411,9 +452,10 @@ html_coverage_report:
411452
--output public/index.html
412453
artifacts:
413454
expire_in: 4 weeks
414-
paths:
455+
paths:
415456
- public
416457

458+
417459
## GitLab Pages update job
418460

419461
pages:

0 commit comments

Comments
 (0)