summaryrefslogtreecommitdiffstats
path: root/.gitlab/ci
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2022-12-07 15:39:25 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2023-12-05 16:53:35 (GMT)
commit1f0c28c84016602a4b24facb025706f42f717037 (patch)
tree2a07d49c207feb9f22d5329d521800b3ca25e6d4 /.gitlab/ci
parent57b94595a3a0056aef1446ce1827dd945261d362 (diff)
downloadCMake-1f0c28c84016602a4b24facb025706f42f717037.zip
CMake-1f0c28c84016602a4b24facb025706f42f717037.tar.gz
CMake-1f0c28c84016602a4b24facb025706f42f717037.tar.bz2
ci: export clang-tidy fixes as an artifact
Diffstat (limited to '.gitlab/ci')
-rw-r--r--.gitlab/ci/configure_fedora39_tidy.cmake1
-rw-r--r--.gitlab/ci/ctest_build.cmake1
-rw-r--r--.gitlab/ci/post_build_fedora39_tidy.sh21
3 files changed, 23 insertions, 0 deletions
diff --git a/.gitlab/ci/configure_fedora39_tidy.cmake b/.gitlab/ci/configure_fedora39_tidy.cmake
index 4ed1eb3..7a3eaa6 100644
--- a/.gitlab/ci/configure_fedora39_tidy.cmake
+++ b/.gitlab/ci/configure_fedora39_tidy.cmake
@@ -1,5 +1,6 @@
set(CMake_RUN_CLANG_TIDY ON CACHE BOOL "")
set(CMake_USE_CLANG_TIDY_MODULE ON CACHE BOOL "")
set(CMake_CLANG_TIDY_MODULE "$ENV{CI_PROJECT_DIR}/Utilities/ClangTidyModule/build/libcmake-clang-tidy-module.so" CACHE FILEPATH "")
+set(CMake_CLANG_TIDY_EXPORT_FIXES_DIR "$ENV{CI_PROJECT_DIR}/.gitlab/clang-tidy-fixes" CACHE PATH "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora39_common.cmake")
diff --git a/.gitlab/ci/ctest_build.cmake b/.gitlab/ci/ctest_build.cmake
index b1b9830..4a18cf9 100644
--- a/.gitlab/ci/ctest_build.cmake
+++ b/.gitlab/ci/ctest_build.cmake
@@ -65,6 +65,7 @@ if ("$ENV{CTEST_NO_WARNINGS_ALLOWED}" AND num_warnings GREATER 0)
message(FATAL_ERROR
"Found ${num_warnings} warnings (treating as fatal).")
endif ()
+file(WRITE "$ENV{CI_PROJECT_DIR}/.gitlab/num_warnings.txt" "${num_warnings}\n")
if (ctest_build_args)
message(FATAL_ERROR
diff --git a/.gitlab/ci/post_build_fedora39_tidy.sh b/.gitlab/ci/post_build_fedora39_tidy.sh
new file mode 100644
index 0000000..a36663a
--- /dev/null
+++ b/.gitlab/ci/post_build_fedora39_tidy.sh
@@ -0,0 +1,21 @@
+git config user.name "Kitware Robot"
+git config user.email "kwrobot@kitware.com"
+
+clang-apply-replacements --style=file .gitlab/clang-tidy-fixes
+git add .
+
+if [ -n "$(git status --porcelain)" ]; then
+ quietly git commit --file=- <<EOF
+WIP: clang-tidy: <SHORT DESCRIPTION OF CHANGE HERE>
+
+<LONGER DESCRIPTION OF CHANGE HERE.>
+EOF
+ git format-patch --output=clang-tidy-fixes.patch -1 -N
+ echo "Patch from clang-tidy available, check artifacts of this CI job." >&2
+fi
+
+readonly num_warnings="$(cat .gitlab/num_warnings.txt)"
+if [ "$num_warnings" -ne 0 ]; then
+ echo "Found $num_warnings warnings (treating as fatal)." >&2
+ exit 1
+fi