Skip to content

Commit

Permalink
ci: Improve clang tidy job (#2365)
Browse files Browse the repository at this point in the history
Improves the output and error handling of the clang tidy job.

Before the CI job did not print the output of the clang tidy calls and the error code was ignored.
  • Loading branch information
andiwand authored Aug 21, 2023
1 parent b41968c commit 651ef7a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ clang_tidy:
-DACTS_BUILD_EVERYTHING=on
-DACTS_RUN_CLANG_TIDY=on
- mkdir clang-tidy

# Main clang-tidy run during cmake compilation
- CI/clang_tidy/run_clang_tidy.sh build | tee clang-tidy/clang-tidy.log
- CI/clang_tidy/run_clang_tidy.sh clang-tidy build

# Install dependencies for processing scripts
- pip install -r CI/clang_tidy/requirements.txt
Expand Down
23 changes: 21 additions & 2 deletions CI/clang_tidy/run_clang_tidy.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
#!/bin/bash

set -e

output_dir=$1
shift
build_dir=$1
shift

export NINJA_STATUS="[ninja][%f/%t] "
mkdir -p $output_dir
output_dir=$(realpath $output_dir)

pushd $build_dir
ninja | grep -v '\[ninja\]'
NINJA_STATUS="[ninja] [%f/%t] " ninja $@ | tee $output_dir/ninja.log
popd

# grep fails if it does not find anything
set +e
rm $output_dir/clang-tidy.log
cat $output_dir/ninja.log | grep -v '\[ninja\]' > $output_dir/clang-tidy.log
set -e

if [ ! -f $output_dir/clang-tidy.log ]; then
exit 1
fi

exit 0

0 comments on commit 651ef7a

Please sign in to comment.