summaryrefslogtreecommitdiffstats
path: root/.gitlab/ci/ctest_annotation.cmake
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-11-02 00:59:44 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-11-02 19:24:45 (GMT)
commita518e402c5dc1f2677e6cb1ef529b8d886b585d5 (patch)
treeac5d540e66ba845545ed0082574d79466ba4e9d1 /.gitlab/ci/ctest_annotation.cmake
parentae84de5a0c204bbb6ad808f9bae36ef71dcc4ca1 (diff)
downloadCMake-a518e402c5dc1f2677e6cb1ef529b8d886b585d5.zip
CMake-a518e402c5dc1f2677e6cb1ef529b8d886b585d5.tar.gz
CMake-a518e402c5dc1f2677e6cb1ef529b8d886b585d5.tar.bz2
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
Diffstat (limited to '.gitlab/ci/ctest_annotation.cmake')
-rw-r--r--.gitlab/ci/ctest_annotation.cmake32
1 files changed, 32 insertions, 0 deletions
diff --git a/.gitlab/ci/ctest_annotation.cmake b/.gitlab/ci/ctest_annotation.cmake
new file mode 100644
index 0000000..a219753
--- /dev/null
+++ b/.gitlab/ci/ctest_annotation.cmake
@@ -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 ()