CI: use compilation database for clang-tidy job
[tinc] / .ci / warn / run.sh
1 #!/bin/bash
2
3 set -euo pipefail
4
5 test -n "$CC"
6
7 result=0
8
9 clang_tidy() {
10   rm -f compile_commands.json
11   ln -s "$1"/compile_commands.json .
12   run-clang-tidy || result=$?
13 }
14
15 check_warnings() {
16   flavor="$1"
17   dir="${CC}_${flavor}"
18
19   ./.ci/build.sh "$dir" -Dwerror=true || result=$?
20
21   case "$CC" in
22   clang*) clang_tidy "$dir" ;;
23   esac
24 }
25
26 check_warnings default
27 check_warnings nolegacy
28 check_warnings gcrypt
29
30 exit $result