diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | .gitlab-ci.yml | 1 | ||||
-rw-r--r-- | .gitlab/.gitignore | 2 | ||||
-rw-r--r-- | .gitlab/artifacts.yml | 7 | ||||
-rw-r--r-- | .gitlab/ci/configure_fedora39_tidy.cmake | 1 | ||||
-rw-r--r-- | .gitlab/ci/ctest_build.cmake | 1 | ||||
-rw-r--r-- | .gitlab/ci/post_build_fedora39_tidy.sh | 21 | ||||
-rw-r--r-- | .gitlab/os-linux.yml | 1 |
8 files changed, 36 insertions, 1 deletions
@@ -32,3 +32,6 @@ /.vs/ # Visual Studio build directory /out/ + +# clang-tidy output +/clang-tidy-fixes.patch diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 21eaa6f..b2c90eb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -112,6 +112,7 @@ l:tidy-fedora39: extends: - .fedora39_tidy - .cmake_build_linux + - .cmake_tidy_artifacts - .linux_x86_64_tags - .cmake_cdash_artifacts - .run_automatically diff --git a/.gitlab/.gitignore b/.gitlab/.gitignore index 19796ef..b28fe32 100644 --- a/.gitlab/.gitignore +++ b/.gitlab/.gitignore @@ -19,3 +19,5 @@ /unstable-jom* /watcom /wix* +/clang-tidy-fixes +/num_warnings.txt diff --git a/.gitlab/artifacts.yml b/.gitlab/artifacts.yml index 40a8509..b2315be 100644 --- a/.gitlab/artifacts.yml +++ b/.gitlab/artifacts.yml @@ -153,3 +153,10 @@ - ${CMAKE_CI_BUILD_DIR}/html exclude: - ${CMAKE_CI_BUILD_DIR}/html/.buildinfo + +.cmake_tidy_artifacts: + artifacts: + expire_in: 1d + when: always + paths: + - clang-tidy-fixes.patch 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 diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index f529ab2..e0364a5 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -82,7 +82,6 @@ variables: CMAKE_CONFIGURATION: fedora39_tidy - CTEST_NO_WARNINGS_ALLOWED: 1 CMAKE_CI_NO_INSTALL: 1 .fedora39_clang_analyzer: |