From a388e87d72b8321c189c8d41edb746ffa687ce3c Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Fri, 15 Nov 2024 17:46:25 +0200 Subject: [PATCH] [CI] speed up `clang-tidy` workflow (#3148) --- .github/workflows/clang-tidy.yaml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/clang-tidy.yaml b/.github/workflows/clang-tidy.yaml index 612ff05270..b467c56d44 100644 --- a/.github/workflows/clang-tidy.yaml +++ b/.github/workflows/clang-tidy.yaml @@ -46,9 +46,8 @@ jobs: CC: clang CXX: clang++ run: | - mkdir -p build && cd build echo "Running cmake..." - cmake .. \ + cmake -B build \ -DCMAKE_CXX_STANDARD=14 \ -DWITH_STL=CXX14 \ -DWITH_OTLP_HTTP=ON \ @@ -62,23 +61,21 @@ jobs: -DBUILD_W3CTRACECONTEXT_TEST=ON \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ - -DCMAKE_CXX_CLANG_TIDY="clang-tidy" + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Run clang-tidy run: | - cd build - make 2>&1 | tee -a clang-tidy.log || exit 1 + cmake --build build --target opentelemetry_proto + jq -r .[].file build/compile_commands.json | grep -vE '/(generated|third_party)/' | xargs -P $(nproc) -n 1 clang-tidy --quiet -p build 2>&1 | tee -a clang-tidy.log - uses: actions/upload-artifact@v4 with: name: Logs (clang-tidy) - path: ./build/clang-tidy.log + path: ./clang-tidy.log - name: Count warnings run: | - cd build COUNT=$(grep -c "warning:" clang-tidy.log) echo "clang-tidy reported ${COUNT} warning(s)" -# TODO: include WITH_OTLP_GRPC and WITH_ABSEIL flags. \ No newline at end of file +# TODO: include WITH_OTLP_GRPC and WITH_ABSEIL flags.