CI: use compilation database for clang-tidy job
[tinc] / .ci / warn / run.sh
index b84bc2e..2add1a5 100755 (executable)
@@ -6,12 +6,25 @@ test -n "$CC"
 
 result=0
 
+clang_tidy() {
+  rm -f compile_commands.json
+  ln -s "$1"/compile_commands.json .
+  run-clang-tidy || result=$?
+}
+
 check_warnings() {
-  git clean -dfx
-  ./.ci/build.sh build -Dwerror=true "$@" || result=$?
+  flavor="$1"
+  dir="${CC}_${flavor}"
+
+  ./.ci/build.sh "$dir" -Dwerror=true || result=$?
+
+  case "$CC" in
+  clang*) clang_tidy "$dir" ;;
+  esac
 }
 
-check_warnings
-check_warnings -Dcrypto=nolegacy
+check_warnings default
+check_warnings nolegacy
+check_warnings gcrypt
 
 exit $result