@@ -11,7 +11,15 @@ permissions:
11
11
12
12
jobs :
13
13
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
15
23
steps :
16
24
- name : Harden the runner (Audit all outbound calls)
17
25
uses : step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
@@ -23,19 +31,20 @@ jobs:
23
31
submodules : recursive
24
32
25
33
- name : Setup Environment
26
- env :
27
- PROTOBUF_VERSION : ' 23.3'
28
- ABSEIL_CPP_VERSION : ' 20230125.3'
29
- CXX_STANDARD : ' 14'
30
34
run : |
31
35
sudo apt update -y
32
36
sudo apt install -y --no-install-recommends --no-install-suggests \
33
37
build-essential \
34
38
cmake \
39
+ zlib1g-dev \
35
40
libssl-dev \
36
41
libcurl4-openssl-dev \
42
+ nlohmann-json3-dev \
43
+ libabsl-dev \
37
44
libprotobuf-dev \
45
+ libgrpc++-dev \
38
46
protobuf-compiler \
47
+ protobuf-compiler-grpc \
39
48
libgmock-dev \
40
49
libgtest-dev \
41
50
libbenchmark-dev
@@ -47,42 +56,43 @@ jobs:
47
56
echo "Using clang-tidy version: $(clang-tidy --version)"
48
57
echo "clang-tidy installed at: $(which clang-tidy)"
49
58
50
-
51
59
- name : Prepare CMake
52
60
env :
53
61
CC : clang
54
62
CXX : clang++
55
63
run : |
56
64
echo "Running cmake..."
57
- cmake -B build \
65
+ cmake -B build-${{ matrix.cmake_options }} \
66
+ -C ./test_common/cmake/${{ matrix.cmake_options }}.cmake \
58
67
-DCMAKE_CXX_STANDARD=14 \
59
68
-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 }}"
72
73
73
74
- name : Run clang-tidy
74
75
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
77
77
78
78
- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
79
79
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
82
82
83
83
- name : Count warnings
84
84
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
87
98
88
- # TODO: include WITH_OTLP_GRPC flags.
0 commit comments