ci: generate annotation reports
These will render links in the sidebar for each job. See: https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportsannotations
This commit is contained in:
parent
ae84de5a0c
commit
a518e402c5
32
.gitlab/ci/ctest_annotation.cmake
Normal file
32
.gitlab/ci/ctest_annotation.cmake
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
function (ctest_annotation_report file)
|
||||||
|
set(label "")
|
||||||
|
|
||||||
|
if (EXISTS "${file}")
|
||||||
|
file(READ "${file}" json)
|
||||||
|
else ()
|
||||||
|
set(json "{\"CDash\": []}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
foreach (arg IN LISTS ARGN)
|
||||||
|
if (NOT label)
|
||||||
|
set(label "${arg}")
|
||||||
|
continue ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set(item "{\"external_link\":{\"label\":\"${label}\",\"url\":\"${arg}\"}}")
|
||||||
|
set(label "")
|
||||||
|
|
||||||
|
string(JSON length LENGTH "${json}" "CDash")
|
||||||
|
string(JSON json SET "${json}" "CDash" "${length}" "${item}")
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
file(WRITE "${file}" "${json}")
|
||||||
|
endfunction ()
|
||||||
|
|
||||||
|
if (NOT DEFINED build_id)
|
||||||
|
include("${CTEST_BINARY_DIRECTORY}/cdash-build-id" OPTIONAL)
|
||||||
|
endif ()
|
||||||
|
function (store_build_id build_id)
|
||||||
|
file(WRITE "${CTEST_BINARY_DIRECTORY}/cdash-build-id"
|
||||||
|
"set(build_id \"${build_id}\")\n")
|
||||||
|
endfunction ()
|
@ -45,11 +45,17 @@ if (iwyu_source_name AND "$ENV{CMAKE_CONFIGURATION}" MATCHES "iwyu")
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
ctest_build(
|
ctest_build(
|
||||||
|
NUMBER_ERRORS num_errors
|
||||||
NUMBER_WARNINGS num_warnings
|
NUMBER_WARNINGS num_warnings
|
||||||
RETURN_VALUE build_result
|
RETURN_VALUE build_result
|
||||||
${ctest_build_args})
|
${ctest_build_args})
|
||||||
ctest_submit(PARTS Build)
|
ctest_submit(PARTS Build)
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/ctest_annotation.cmake")
|
||||||
|
ctest_annotation_report("${CTEST_BINARY_DIRECTORY}/annotations.json"
|
||||||
|
"Build Errors (${num_errors})" "https://open.cdash.org/viewBuildError.php?buildid=${build_id}"
|
||||||
|
"Build Warnings (${num_warnings})" "https://open.cdash.org/viewBuildError.php?type=1&buildid=${build_id}")
|
||||||
|
|
||||||
if (build_result)
|
if (build_result)
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
"Failed to build")
|
"Failed to build")
|
||||||
|
@ -22,10 +22,18 @@ ctest_configure(
|
|||||||
# Read the files from the build directory.
|
# Read the files from the build directory.
|
||||||
ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}")
|
ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}")
|
||||||
|
|
||||||
# We can now submit because we've configured. This is a cmb-superbuild-ism.
|
# We can now submit because we've configured.
|
||||||
ctest_submit(PARTS Update)
|
ctest_submit(PARTS Update
|
||||||
|
BUILD_ID build_id)
|
||||||
ctest_submit(PARTS Configure)
|
ctest_submit(PARTS Configure)
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/ctest_annotation.cmake")
|
||||||
|
ctest_annotation_report("${CTEST_BINARY_DIRECTORY}/annotations.json"
|
||||||
|
"Build Summary" "https://open.cdash.org/build/${build_id}"
|
||||||
|
"Update" "https://open.cdash.org/build/${build_id}/update"
|
||||||
|
"Configure" "https://open.cdash.org/build/${build_id}/configure")
|
||||||
|
store_build_id("${build_id}")
|
||||||
|
|
||||||
if (configure_result)
|
if (configure_result)
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
"Failed to configure")
|
"Failed to configure")
|
||||||
|
@ -34,6 +34,15 @@ ctest_memcheck(
|
|||||||
ctest_submit(PARTS Test)
|
ctest_submit(PARTS Test)
|
||||||
ctest_submit(PARTS Memcheck)
|
ctest_submit(PARTS Memcheck)
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/ctest_annotation.cmake")
|
||||||
|
ctest_annotation_report("${CTEST_BINARY_DIRECTORY}/annotations.json"
|
||||||
|
"Build Summary" "https://open.cdash.org/build/${build_id}"
|
||||||
|
"All Tests" "https://open.cdash.org/viewTest.php?buildid=${build_id}"
|
||||||
|
"Dynamic Analysis" "https://open.cdash.org/viewDynamicAnalysis.php?buildid=${build_id}"
|
||||||
|
"Test Failures" "https://open.cdash.org/viewTest.php?onlyfailed&buildid=${build_id}"
|
||||||
|
"Tests Not Run" "https://open.cdash.org/viewTest.php?onlynotrun&buildid=${build_id}"
|
||||||
|
"Test Passes" "https://open.cdash.org/viewTest.php?onlypassed&buildid=${build_id}")
|
||||||
|
|
||||||
if (test_result)
|
if (test_result)
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
"Failed to test")
|
"Failed to test")
|
||||||
|
@ -38,9 +38,16 @@ ctest_configure(
|
|||||||
ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}")
|
ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}")
|
||||||
|
|
||||||
# We can now submit because we've configured. This is a cmb-superbuild-ism.
|
# We can now submit because we've configured. This is a cmb-superbuild-ism.
|
||||||
ctest_submit(PARTS Update)
|
ctest_submit(PARTS Update
|
||||||
|
BUILD_ID build_id)
|
||||||
ctest_submit(PARTS Configure)
|
ctest_submit(PARTS Configure)
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/ctest_annotation.cmake")
|
||||||
|
ctest_annotation_report("${CTEST_BINARY_DIRECTORY}/annotations.json"
|
||||||
|
"Build Summary" "https://open.cdash.org/build/${build_id}"
|
||||||
|
"Update" "https://open.cdash.org/build/${build_id}/update"
|
||||||
|
"Configure" "https://open.cdash.org/build/${build_id}/configure")
|
||||||
|
|
||||||
if (configure_result)
|
if (configure_result)
|
||||||
ctest_submit(PARTS Done)
|
ctest_submit(PARTS Done)
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
@ -54,10 +61,15 @@ elseif (CTEST_CMAKE_GENERATOR MATCHES "Ninja")
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
ctest_build(
|
ctest_build(
|
||||||
|
NUMBER_ERRORS num_errors
|
||||||
NUMBER_WARNINGS num_warnings
|
NUMBER_WARNINGS num_warnings
|
||||||
RETURN_VALUE build_result)
|
RETURN_VALUE build_result)
|
||||||
ctest_submit(PARTS Build)
|
ctest_submit(PARTS Build)
|
||||||
|
|
||||||
|
ctest_annotation_report("${CTEST_BINARY_DIRECTORY}/annotations.json"
|
||||||
|
"Build Errors (${num_errors})" "https://open.cdash.org/viewBuildError.php?buildid=${build_id}"
|
||||||
|
"Build Warnings (${num_warnings})" "https://open.cdash.org/viewBuildError.php?type=1&buildid=${build_id}")
|
||||||
|
|
||||||
if (build_result)
|
if (build_result)
|
||||||
ctest_submit(PARTS Done)
|
ctest_submit(PARTS Done)
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
@ -86,6 +98,12 @@ ctest_test(
|
|||||||
EXCLUDE "${test_exclusions}")
|
EXCLUDE "${test_exclusions}")
|
||||||
ctest_submit(PARTS Test)
|
ctest_submit(PARTS Test)
|
||||||
|
|
||||||
|
ctest_annotation_report("${CTEST_BINARY_DIRECTORY}/annotations.json"
|
||||||
|
"All Tests" "https://open.cdash.org/viewTest.php?buildid=${build_id}"
|
||||||
|
"Test Failures" "https://open.cdash.org/viewTest.php?onlyfailed&buildid=${build_id}"
|
||||||
|
"Tests Not Run" "https://open.cdash.org/viewTest.php?onlynotrun&buildid=${build_id}"
|
||||||
|
"Test Passes" "https://open.cdash.org/viewTest.php?onlypassed&buildid=${build_id}")
|
||||||
|
|
||||||
if (test_result)
|
if (test_result)
|
||||||
ctest_submit(PARTS Done)
|
ctest_submit(PARTS Done)
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
|
@ -25,6 +25,14 @@ ctest_test(
|
|||||||
EXCLUDE "${test_exclusions}")
|
EXCLUDE "${test_exclusions}")
|
||||||
ctest_submit(PARTS Test)
|
ctest_submit(PARTS Test)
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/ctest_annotation.cmake")
|
||||||
|
ctest_annotation_report("${CTEST_BINARY_DIRECTORY}/annotations.json"
|
||||||
|
"Build Summary" "https://open.cdash.org/build/${build_id}"
|
||||||
|
"All Tests" "https://open.cdash.org/viewTest.php?buildid=${build_id}"
|
||||||
|
"Test Failures" "https://open.cdash.org/viewTest.php?onlyfailed&buildid=${build_id}"
|
||||||
|
"Tests Not Run" "https://open.cdash.org/viewTest.php?onlynotrun&buildid=${build_id}"
|
||||||
|
"Test Passes" "https://open.cdash.org/viewTest.php?onlypassed&buildid=${build_id}")
|
||||||
|
|
||||||
if (test_result)
|
if (test_result)
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
"Failed to test")
|
"Failed to test")
|
||||||
|
Loading…
Reference in New Issue
Block a user