ci: make the static-analysis warning gate actually fail

- the gate did `grep -q warning: build.log`, but build.log was never
  produced by the cmake-action build, so under `set -e` the grep in the
  `if` condition just reported "no match" and the job always passed
- as a result ~4961 clang-tidy warnings were silently ignored
- build manually and capture output to build.log with pipefail, and
  fail explicitly if the log is missing or contains a warning
This commit is contained in:
Dennis Klein
2026-06-09 17:10:09 +02:00
committed by Dennis Klein
parent 2cf49cc50d
commit 824825e911

View File

@@ -149,21 +149,25 @@ jobs:
key: ${{ github.job }} key: ${{ github.job }}
max-size: 500M max-size: 500M
- name: Configure and Build - name: Configure
uses: threeal/cmake-action@v2 run: |
with: cmake -S . -B build -G Ninja \
generator: Ninja -DCMAKE_BUILD_TYPE=Debug \
options: | -DBUILD_TESTING=ON \
CMAKE_BUILD_TYPE=Debug -DRUN_STATIC_ANALYSIS=ON \
BUILD_TESTING=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache \
RUN_STATIC_ANALYSIS=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
CMAKE_C_COMPILER_LAUNCHER=ccache
CMAKE_CXX_COMPILER_LAUNCHER=ccache - name: Build
run: |
set -o pipefail
cmake --build build 2>&1 | tee build.log
- name: Check for warnings - name: Check for warnings
run: | run: |
test -f build.log || { echo "::error::build.log was not produced"; exit 1; }
if grep -q "warning:" build.log; then if grep -q "warning:" build.log; then
echo "::warning::Static analysis found warnings" echo "::error::Static analysis found warnings"
grep "warning:" build.log grep "warning:" build.log
exit 1 exit 1
fi fi