@@ -11,7 +11,15 @@ permissions:
1111
1212jobs :
1313 clang-tidy :
14- runs-on : ubuntu-24.04
14+ runs-on : ubuntu-latest
15+ strategy :
16+ fail-fast : false
17+ matrix :
18+ include :
19+ - cmake_options : all-options-abiv1-preview
20+ warning_limit : 215
21+ - cmake_options : all-options-abiv2-preview
22+ warning_limit : 216
1523 steps :
1624 - name : Harden the runner (Audit all outbound calls)
1725 uses : step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
@@ -23,19 +31,20 @@ jobs:
2331 submodules : recursive
2432
2533 - name : Setup Environment
26- env :
27- PROTOBUF_VERSION : ' 23.3'
28- ABSEIL_CPP_VERSION : ' 20230125.3'
29- CXX_STANDARD : ' 14'
3034 run : |
3135 sudo apt update -y
3236 sudo apt install -y --no-install-recommends --no-install-suggests \
3337 build-essential \
3438 cmake \
39+ zlib1g-dev \
3540 libssl-dev \
3641 libcurl4-openssl-dev \
42+ nlohmann-json3-dev \
43+ libabsl-dev \
3744 libprotobuf-dev \
45+ libgrpc++-dev \
3846 protobuf-compiler \
47+ protobuf-compiler-grpc \
3948 libgmock-dev \
4049 libgtest-dev \
4150 libbenchmark-dev
@@ -47,42 +56,43 @@ jobs:
4756 echo "Using clang-tidy version: $(clang-tidy --version)"
4857 echo "clang-tidy installed at: $(which clang-tidy)"
4958
50-
5159 - name : Prepare CMake
5260 env :
5361 CC : clang
5462 CXX : clang++
5563 run : |
5664 echo "Running cmake..."
57- cmake -B build \
65+ cmake -B build-${{ matrix.cmake_options }} \
66+ -C ./test_common/cmake/${{ matrix.cmake_options }}.cmake \
5867 -DCMAKE_CXX_STANDARD=14 \
5968 -DWITH_STL=CXX14 \
60- -DWITH_OTLP_HTTP=ON \
61- -DWITH_OTLP_FILE=ON \
62- -DWITH_PROMETHEUS=ON \
63- -DWITH_ZIPKIN=ON \
64- -DWITH_ELASTICSEARCH=ON \
65- -DWITH_OTLP_HTTP_COMPRESSION=ON \
66- -DWITH_EXAMPLES=ON \
67- -DWITH_EXAMPLES_HTTP=ON \
68- -DBUILD_W3CTRACECONTEXT_TEST=ON \
69- -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \
70- -DWITH_ASYNC_EXPORT_PREVIEW=ON \
71- -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
69+ -DWITH_OPENTRACING=OFF \
70+ -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" \
71+ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
72+ -DCMAKE_CXX_CLANG_TIDY="clang-tidy;--quiet;-p;build-${{ matrix.cmake_options }}"
7273
7374 - name : Run clang-tidy
7475 run : |
75- cmake --build build --target opentelemetry_proto
76- 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
76+ cmake --build build-${{ matrix.cmake_options }} -- -j$(nproc) 2>&1 | tee clang-tidy-${{ matrix.cmake_options }}.log
7777
7878 - uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
7979 with :
80- name : Logs ( clang-tidy)
81- path : ./clang-tidy.log
80+ name : Logs- clang-tidy-${{ matrix.cmake_options }}
81+ path : ./clang-tidy-${{ matrix.cmake_options }} .log
8282
8383 - name : Count warnings
8484 run : |
85- COUNT=$(grep -c "warning:" clang-tidy.log)
86- echo "clang-tidy reported ${COUNT} warning(s)"
85+ COUNT=$(grep -c "warning:" clang-tidy-${{ matrix.cmake_options }}.log)
86+ echo "clang-tidy reported ${COUNT} warning(s) with cmake options preset '${{ matrix.cmake_options }}'"
87+
88+ readonly WARNING_LIMIT=${{ matrix.warning_limit }}
89+
90+ # FAIL the build if COUNT > WARNING_LIMIT
91+ if [ $COUNT -gt $WARNING_LIMIT ] ; then
92+ echo "clang-tidy reported ${COUNT} warning(s) exceeding the existing warning limit of ${WARNING_LIMIT} with cmake options preset '${{ matrix.cmake_options }}'"
93+ exit 1
94+ # WARN in annotations if COUNT > 0
95+ elif [ $COUNT -gt 0 ] ; then
96+ echo "::warning::clang-tidy reported ${COUNT} warning(s) with cmake options preset '${{ matrix.cmake_options }}'"
97+ fi
8798
88- # TODO: include WITH_OTLP_GRPC flags.
0 commit comments