summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Holder <thomas@thomas-holder.de>2019-03-02 21:04:35 +0000
committerThomas Holder <thomas@thomas-holder.de>2019-03-02 21:04:35 +0000
commitbd58add3c0a0d5f57276ab413cd24c8f9abc8eae (patch)
tree322ff3d3905fe21463c93005458f5b006f1b0958
parentspeed up clangtidy job (diff)
downloadinkscape-bd58add3c0a0d5f57276ab413cd24c8f9abc8eae.tar.gz
inkscape-bd58add3c0a0d5f57276ab413cd24c8f9abc8eae.zip
fix clangtidy CI job
-rw-r--r--.gitlab-ci.yml16
-rw-r--r--buildtools/clangtidy-helper.sh25
2 files changed, 28 insertions, 13 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7dd9944b7..1c499745d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -192,28 +192,18 @@ clangtidy:linux:
- schedules
- branches@inkscape/inkscape
script:
- - mkdir -p build && cd build
- - cmake .. -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=$PWD/install_dir/ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- git fetch https://gitlab.com/inkscape/inkscape.git
# "borrow" a 2geom file to dump header includes
- - git diff FETCH_HEAD --name-only | grep '^src/.*\.h$' || true | sed 's/^src/#include"../;s/$/"/' | tee ../src/2geom/geom.cpp
+ - git diff FETCH_HEAD --name-only | (grep '^src/.*\.h$' || true) | sed 's/^src/#include"../;s/$/"/' | tee src/2geom/geom.cpp
- git diff FETCH_HEAD --name-only | grep '^src/.*\.cpp$' | tee clang_tidy_files
- - run-clang-tidy -fix -header-filter='.*' $(cat clang_tidy_files) > /dev/null
- # revert all fixes in protected directories
- - git checkout ../src/3rdparty/ ../src/2geom/
- - git diff | tee clang_tidy_diff
- - if [[ -s clang_tidy_diff ]]; then false; fi
+ - bash buildtools/clangtidy-helper.sh $(cat clang_tidy_files)
clangtidyfull:linux:
stage: build
only:
- branches@inkscape/inkscape
script:
- - mkdir -p build && cd build
- - cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- - run-clang-tidy -fix -header-filter='.*' > /dev/null && git checkout ../src/3rdparty/ ../src/2geom/
- - git diff | tee clang_tidy_diff
- - if [[ -s clang_tidy_diff ]]; then false; fi
+ - bash buildtools/clangtidy-helper.sh
### scan-build is a static analysis tool. This job is *slow*.
diff --git a/buildtools/clangtidy-helper.sh b/buildtools/clangtidy-helper.sh
new file mode 100644
index 000000000..80e08581b
--- /dev/null
+++ b/buildtools/clangtidy-helper.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+##
+## usage: clangtidy-helper [list of cpp files]
+##
+## Without arguments, run for all source files.
+##
+
+set -e
+
+mkdir -p build
+cd build
+
+cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
+
+run-clang-tidy -fix -header-filter='.*' "$@" > /dev/null
+
+# revert all fixes in protected directories
+git checkout ../src/3rdparty/ ../src/2geom/
+
+git diff | tee clang_tidy_diff
+
+if [[ -s clang_tidy_diff ]]; then
+ exit 1
+fi