+++ /dev/null
-#!/bin/sh
-
-set -eu
-
-./.ci/build.sh build "$@"
-
-# Which paths to ignore.
-paths='src/solaris src/windows src/gcrypt'
-
-case "$(uname -s)" in
-Linux)
- paths="$paths src/bsd"
- ;;
-
-FreeBSD)
- paths="$paths src/linux src/bsd/darwin src/bsd/openbsd"
- ;;
-
-Darwin)
- paths="$paths src/linux src/vde_device.c"
- ;;
-
-*) exit 1 ;;
-esac
-
-path_filters=''
-for path in $paths; do
- path_filters=" $path_filters ! ( -path $path -prune ) "
-done
-
-echo >&2 "Running clang-tidy without $paths"
-
-# This is fine, our paths are relative and do not contain any whitespace.
-# shellcheck disable=SC2086
-find src \
- $path_filters \
- -name '*.c' \
- -exec clang-tidy -p build --header-filter='.*' '{}' +
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
- name: Install tools
run: |
sudo apt-get install -y astyle clang-tidy-$CLANG
- sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$CLANG 100
+ sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$CLANG 100
+ sudo update-alternatives --install /usr/bin/run-clang-tidy run-clang-tidy /usr/bin/run-clang-tidy-$CLANG 100
curl -OL "https://github.com/koalaman/shellcheck/releases/download/v$SHELLCHECK/shellcheck-v${SHELLCHECK}.linux.x86_64.tar.xz"
tar -C ~ --strip-components=1 --wildcards -xf ./shellcheck-*.tar.xz 'shellcheck-*/shellcheck'
curl -o ~/shfmt -L "https://github.com/mvdan/sh/releases/download/v$SHFMT/shfmt_v${SHFMT}_linux_amd64"
PATH=$PATH:$HOME ./lint.py
if: always()
- - name: Run clang-tidy
- run: sh .ci/tidy/run.sh
- if: always()
-
- - name: Check warnings (gcc)
+ - name: Check warnings (clang)
run: bash .ci/warn/run.sh
env:
- CC: gcc-10
+ CC: clang-12
if: always()
- - name: Check warnings (clang)
+ - name: Check warnings (gcc)
run: bash .ci/warn/run.sh
env:
- CC: clang-12
+ CC: gcc-10
if: always()
sanitizer: