Skip to content

Commit 13149e4

Browse files
committed
add testing matrix to iwyu and clang-tidy jobs. Move cmake options to scripts in test_common
1 parent 24a5123 commit 13149e4

11 files changed

+154
-59
lines changed

.github/workflows/clang-tidy.yaml

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ permissions:
1212
jobs:
1313
clang-tidy:
1414
runs-on: ubuntu-24.04
15+
strategy:
16+
matrix:
17+
include:
18+
- options_preset: all-options-abiv1-preview
19+
warning_limit: 0
20+
- options_preset: all-options-abiv2-preview
21+
warning_limit: 216
1522
steps:
1623
- name: Harden the runner (Audit all outbound calls)
1724
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
@@ -59,52 +66,36 @@ jobs:
5966
CXX: clang++
6067
run: |
6168
echo "Running cmake..."
62-
cmake -B build \
69+
cmake -B build-${{ matrix.options_preset }} \
70+
-C ./test_common/cmake/${{ matrix.options_preset }}.cmake \
6371
-DCMAKE_CXX_STANDARD=14 \
6472
-DWITH_STL=CXX14 \
65-
-DWITH_ABI_VERSION_1=OFF \
66-
-DWITH_ABI_VERSION_2=ON \
67-
-DWITH_HTTP_CLIENT_CURL=ON \
68-
-DWITH_THREAD_INSTRUMENTATION_PREVIEW=ON \
69-
-DWITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON \
70-
-DWITH_OTLP_GRPC_CREDENTIAL_PREVIEW=ON \
71-
-DWITH_OTLP_RETRY_PREVIEW=ON \
72-
-DWITH_OTLP_GRPC=ON \
73-
-DWITH_OTLP_HTTP=ON \
74-
-DWITH_OTLP_FILE=ON \
75-
-DWITH_PROMETHEUS=ON \
76-
-DWITH_ZIPKIN=ON \
77-
-DWITH_ELASTICSEARCH=ON \
78-
-DWITH_OTLP_HTTP_COMPRESSION=ON \
79-
-DWITH_EXAMPLES=ON \
80-
-DWITH_EXAMPLES_HTTP=ON \
81-
-DBUILD_W3CTRACECONTEXT_TEST=ON \
82-
-DWITH_METRICS_EXEMPLAR_PREVIEW=ON \
83-
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
8473
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
8574
8675
- name: Run clang-tidy
8776
run: |
88-
cmake --build build --target opentelemetry_proto
89-
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
77+
cmake --build build-${{ matrix.options_preset }} --target opentelemetry_proto
78+
jq -r .[].file build-${{ matrix.options_preset }}/compile_commands.json | grep -vE '/(generated|third_party)/' | xargs -P $(nproc) -n 1 clang-tidy --quiet -p build-${{ matrix.options_preset }} 2>&1 | tee -a clang-tidy-${{ matrix.options_preset }}.log
9079
9180
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
9281
with:
9382
name: Logs (clang-tidy)
94-
path: ./clang-tidy.log
83+
path: ./clang-tidy-${{ matrix.options_preset }}.log
9584

9685
- name: Count warnings
9786
run: |
9887
clang-tidy --version
99-
COUNT=$(grep -c "warning:" clang-tidy.log)
100-
echo "clang-tidy reported ${COUNT} warning(s)"
101-
readonly WARNING_LIMIT=216
88+
COUNT=$(grep -c "warning:" clang-tidy-${{ matrix.options_preset }}.log)
89+
echo "clang-tidy reported ${COUNT} warning(s) with cmake options preset '${{ matrix.options_preset }}'"
90+
91+
readonly WARNING_LIMIT=${{ matrix.warning_limit }}
92+
10293
# FAIL the build if COUNT > WARNING_LIMIT
10394
if [ $COUNT -gt $WARNING_LIMIT ] ; then
104-
echo "clang-tidy reported ${COUNT} warning(s) exceeding the existing warning limit of ${WARNING_LIMIT}"
95+
echo "clang-tidy reported ${COUNT} warning(s) exceeding the existing warning limit of ${WARNING_LIMIT} with cmake options preset '${{ matrix.options_preset }}'"
10596
exit 1
10697
# WARN in annotations if COUNT > 0
10798
elif [ $COUNT -gt 0 ] ; then
108-
echo "::warning::clang-tidy reported ${COUNT} warning(s)"
99+
echo "::warning::clang-tidy reported ${COUNT} warning(s) with cmake options preset '${{ matrix.options_preset }}'"
109100
fi
110101

.github/workflows/iwyu.yml

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ permissions:
1313
jobs:
1414
iwyu:
1515
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
include:
19+
- options_preset: all-options-abiv1
20+
warning_limit: 0
21+
- options_preset: all-options-abiv1-preview
22+
warning_limit: 24
23+
- options_preset: all-options-abiv2-preview
24+
warning_limit: 48
25+
1626
steps:
1727
- name: Harden the runner (Audit all outbound calls)
1828
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
@@ -48,59 +58,40 @@ jobs:
4858
- name: Prepare CMake
4959
run: |
5060
TOPDIR=`pwd`
51-
mkdir build && cd build
61+
mkdir -p build-${{ matrix.options_preset }} && cd build-${{ matrix.options_preset }}
5262
CC="clang" CXX="clang++" cmake \
63+
-C ${TOPDIR}/test_common/cmake/${{ matrix.options_preset }}.cmake \
5364
-DCMAKE_CXX_STANDARD=14 \
5465
-DWITH_STL=CXX14 \
5566
-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-w;-Xiwyu;--mapping_file=${TOPDIR}/.iwyu.imp;" \
56-
-DBUILD_TESTING=ON \
57-
-DWITH_EXAMPLES=ON \
58-
-DWITH_EXAMPLES_HTTP=ON \
59-
-DBUILD_W3CTRACECONTEXT_TEST=ON \
60-
-DWITH_OTLP_GRPC=ON \
61-
-DWITH_OTLP_HTTP=ON \
62-
-DWITH_OTLP_FILE=ON \
63-
-DWITH_OPENTRACING=ON \
64-
-DWITH_OTLP_HTTP_COMPRESSION=ON \
65-
-DWITH_ZIPKIN=ON \
66-
-DWITH_PROMETHEUS=ON \
67-
-DWITH_ELASTICSEARCH=ON \
68-
-DWITH_HTTP_CLIENT_CURL=ON \
69-
-DWITH_ABI_VERSION_1=OFF \
70-
-DWITH_ABI_VERSION_2=ON \
71-
-DWITH_METRICS_EXEMPLAR_PREVIEW=ON \
72-
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
73-
-DWITH_THREAD_INSTRUMENTATION_PREVIEW=ON \
74-
-DWITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON \
75-
-DWITH_OTLP_GRPC_CREDENTIAL_PREVIEW=ON \
76-
-DWITH_OTLP_RETRY_PREVIEW=ON \
7767
..
7868
7969
- name: iwyu_tool
8070
run: |
81-
cd build
82-
make -k 2>&1 | tee -a iwyu.log
71+
cd build-${{ matrix.options_preset }}
72+
make -k 2>&1 | tee -a iwyu-${{ matrix.options_preset }}.log
8373
8474
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
8575
if: success() || failure()
8676
with:
87-
name: Logs (include-what-you-use)
88-
path: ./build/*.log
77+
name: Logs-${{ matrix.options_preset }} (include-what-you-use)
78+
path: ./build-${{ matrix.options_preset }}/*.log
8979

9080
- name: count warnings
9181
run: |
9282
set +e
9383
echo "include-what-you-use version:"
9484
include-what-you-use --version
95-
cd build
96-
readonly WARNING_COUNT=`grep -c "include-what-you-use reported diagnostics:" iwyu.log`
97-
echo "include-what-you-use reported ${WARNING_COUNT} warning(s)"
85+
cd build-${{ matrix.options_preset }}
86+
readonly WARNING_COUNT=`grep -c "include-what-you-use reported diagnostics:" iwyu-${{ matrix.options_preset }}.log`
87+
echo "include-what-you-use reported ${WARNING_COUNT} warning(s) with cmake options preset '${{ matrix.options_preset }}'"
9888
# Acceptable limit, to decrease over time down to 0
99-
readonly WARNING_LIMIT=48
89+
readonly WARNING_LIMIT=${{ matrix.warning_limit }}
10090
# FAIL the build if WARNING_COUNT > WARNING_LIMIT
10191
if [ $WARNING_COUNT -gt $WARNING_LIMIT ] ; then
92+
echo "include-what-you-use reported ${WARNING_COUNT} warning(s) exceeding the existing warning limit of ${WARNING_LIMIT} with cmake options preset '${{ matrix.options_preset }}'"
10293
exit 1
10394
# WARN in annotations if WARNING_COUNT > 0
10495
elif [ $WARNING_COUNT -gt 0 ] ; then
105-
echo "::warning::include-what-you-use reported ${WARNING_COUNT} warning(s)"
96+
echo "::warning::include-what-you-use reported ${WARNING_COUNT} warning(s) with cmake options preset '${{ matrix.options_preset }}'"
10697
fi
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This script enables ABI V1 with preview features
5+
6+
set(WITH_ABI_VERSION_1 ON CACHE BOOL "" FORCE)
7+
set(WITH_ABI_VERSION_2 OFF CACHE BOOL "" FORCE)
8+
9+
set(ENABLE_PREVIEW ON)
10+
include(${CMAKE_CURRENT_LIST_DIR}/all-options.cmake)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This script enables ABI V1 with all options except preview features
5+
6+
set(WITH_ABI_VERSION_1 ON CACHE BOOL "" FORCE)
7+
set(WITH_ABI_VERSION_2 OFF CACHE BOOL "" FORCE)
8+
9+
set(ENABLE_PREVIEW OFF)
10+
include(${CMAKE_CURRENT_LIST_DIR}/all-options.cmake)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This script enables ABI V2 with all options and with preview features
5+
6+
set(WITH_ABI_VERSION_1 OFF CACHE BOOL "" FORCE)
7+
set(WITH_ABI_VERSION_2 ON CACHE BOOL "" FORCE)
8+
9+
set(ENABLE_PREVIEW ON)
10+
include(${CMAKE_CURRENT_LIST_DIR}/all-options.cmake)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This script enables ABI V2 with all options except preview features
5+
6+
set(WITH_ABI_VERSION_1 OFF CACHE BOOL "" FORCE)
7+
set(WITH_ABI_VERSION_2 ON CACHE BOOL "" FORCE)
8+
9+
set(ENABLE_PREVIEW OFF)
10+
include(${CMAKE_CURRENT_LIST_DIR}/all-options.cmake)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
include(${CMAKE_CURRENT_LIST_DIR}/component-options.cmake)
5+
include(${CMAKE_CURRENT_LIST_DIR}/example-options.cmake)
6+
include(${CMAKE_CURRENT_LIST_DIR}/testing-options.cmake)
7+
include(${CMAKE_CURRENT_LIST_DIR}/preview-options.cmake)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Enable all components in the OpenTelemetry C++ SDK.
5+
6+
if(NOT DEFINED ENABLE_COMPONENTS)
7+
set(ENABLE_COMPONENTS ON)
8+
endif()
9+
10+
set(WITH_OTLP_GRPC ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE)
11+
set(WITH_OTLP_HTTP ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE)
12+
set(WITH_OTLP_FILE ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE)
13+
14+
set(WITH_OTLP_HTTP_COMPRESSION ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE)
15+
set(WITH_CURL_LOGGING ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE)
16+
17+
set(WITH_PROMETHEUS ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE)
18+
set(WITH_ZIPKIN ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE)
19+
set(WITH_ELASTICSEARCH ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE)
20+
21+
if(WIN32)
22+
set(WITH_ETW ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE)
23+
endif()
24+
25+
if(WITH_ABI_VERSION_1)
26+
set(WITH_OPENTRACING ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE)
27+
endif()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Enable all examples in the OpenTelemetry C++ SDK.
5+
6+
if(NOT DEFINED ENABLE_EXAMPLES)
7+
set(ENABLE_EXAMPLES ON)
8+
endif()
9+
10+
set(WITH_EXAMPLES ${ENABLE_EXAMPLES} CACHE BOOL "" FORCE)
11+
set(WITH_EXAMPLES_HTTP ${ENABLE_EXAMPLES} CACHE BOOL "" FORCE)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This script enables preview features in the OpenTelemetry C++ SDK.
5+
6+
if(NOT DEFINED ENABLE_PREVIEW)
7+
set(ENABLE_PREVIEW ON)
8+
endif()
9+
10+
set(WITH_METRICS_EXEMPLAR_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE)
11+
set(WITH_ASYNC_EXPORT_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE)
12+
set(WITH_THREAD_INSTRUMENTATION_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE)
13+
set(WITH_OTLP_GRPC_SSL_MTLS_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE)
14+
set(WITH_OTLP_GRPC_CREDENTIAL_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE)
15+
set(WITH_OTLP_RETRY_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE)

0 commit comments

Comments
 (0)