gitlab-ci: upload JUnit reports for builds

GitLab can render test results which come from JUnit files and inform
which tests have started failing on an MR.
This commit is contained in:
Ben Boeckel
2021-05-01 14:05:18 -04:00
parent 722270ff50
commit cb5c03ed04
4 changed files with 21 additions and 0 deletions

View File

@@ -163,6 +163,7 @@ test:debian10-ninja:
- .debian10_ninja
- .cmake_test_linux_release
- .linux_builder_tags_qt
- .cmake_junit_artifacts
- .run_dependent
- .needs_centos6_x86_64
@@ -171,6 +172,7 @@ test:debian10-aarch64-ninja:
- .debian10_aarch64_ninja
- .cmake_test_linux_release
- .linux_builder_tags_aarch64_qt
- .cmake_junit_artifacts
- .run_dependent
- .needs_centos7_aarch64
variables:
@@ -209,6 +211,7 @@ test:fedora34-makefiles-nospace:
- .fedora34_makefiles
- .cmake_test_linux_release
- .linux_builder_tags_qt
- .cmake_junit_artifacts
- .run_dependent
- .needs_centos6_x86_64
variables:
@@ -221,6 +224,7 @@ test:cuda10.2-nvidia:
- .cuda10.2_nvidia
- .cmake_test_linux_release
- .linux_builder_tags_cuda
- .cmake_junit_artifacts
- .run_dependent
- .needs_centos6_x86_64
@@ -259,6 +263,7 @@ test:fedora34-ninja-multi:
- .fedora34_ninja_multi
- .cmake_test_linux_external
- .linux_builder_tags_qt
- .cmake_junit_artifacts
- .run_dependent
dependencies:
- test:fedora34-ninja
@@ -625,6 +630,7 @@ test:macos-x86_64-xcode:
- .macos_x86_64_xcode
- .cmake_test_macos_external
- .macos_x86_64_builder_ext_tags
- .cmake_junit_artifacts
- .run_dependent
dependencies:
- test:macos-x86_64-ninja
@@ -636,6 +642,7 @@ test:macos-arm64-xcode:
- .macos_arm64_xcode
- .cmake_test_macos_external
- .macos_arm64_builder_ext_tags
- .cmake_junit_artifacts
- .run_dependent
dependencies:
- test:macos-arm64-ninja
@@ -717,6 +724,7 @@ test:windows-vs2019-x64:
- .windows_vs2019_x64
- .cmake_test_windows_external
- .windows_builder_ext_tags
- .cmake_junit_artifacts
- .run_dependent
dependencies:
- test:windows-vs2019-x64-ninja

View File

@@ -82,11 +82,22 @@
- build/cmake-*.tar.gz
- build/cmake-*.zip
.cmake_junit_artifacts:
artifacts:
expire_in: 1d
when: always
reports:
junit:
- build/junit.xml
.cmake_test_artifacts:
artifacts:
expire_in: 1d
# External testing can be useful even if test jobs fail.
when: always
reports:
junit:
- build/junit.xml
paths:
# Take the install tree.
- build/install/

View File

@@ -20,6 +20,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/ctest_exclusions.cmake")
ctest_test(
PARALLEL_LEVEL "${nproc}"
TEST_LOAD "${nproc}"
OUTPUT_JUNIT "${CTEST_BINARY_DIRECTORY}/junit.xml"
RETURN_VALUE test_result
EXCLUDE "${test_exclusions}")
ctest_submit(PARTS Test)

View File

@@ -74,6 +74,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/ctest_exclusions.cmake")
ctest_test(
PARALLEL_LEVEL "${nproc}"
TEST_LOAD "${nproc}"
OUTPUT_JUNIT "${CTEST_BINARY_DIRECTORY}/junit.xml"
RETURN_VALUE test_result
${ctest_label_args}
EXCLUDE "${test_exclusions}")