From 7044771cda5087a128e857a9685e2d42d36f23ef Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Mon, 9 Jun 2025 13:16:34 -0600 Subject: [PATCH 01/10] add more code coverage to iwyu and clang-tidy ci jobs --- .github/workflows/clang-tidy.yaml | 14 +++++++++++++- .github/workflows/iwyu.yml | 11 ++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/clang-tidy.yaml b/.github/workflows/clang-tidy.yaml index 93a8cd86d8..70ebe02e89 100644 --- a/.github/workflows/clang-tidy.yaml +++ b/.github/workflows/clang-tidy.yaml @@ -32,10 +32,15 @@ jobs: sudo apt install -y --no-install-recommends --no-install-suggests \ build-essential \ cmake \ + zlib1g-dev \ libssl-dev \ libcurl4-openssl-dev \ + nlohmann-json3-dev \ + libabsl-dev \ libprotobuf-dev \ + libgrpc++-dev \ protobuf-compiler \ + protobuf-compiler-grpc \ libgmock-dev \ libgtest-dev \ libbenchmark-dev @@ -57,6 +62,14 @@ jobs: cmake -B build \ -DCMAKE_CXX_STANDARD=14 \ -DWITH_STL=CXX14 \ + -DWITH_ABI_VERSION_1=OFF \ + -DWITH_ABI_VERSION_2=ON \ + -DWITH_HTTP_CLIENT_CURL=ON \ + -DWITH_THREAD_INSTRUMENTATION_PREVIEW=ON \ + -DWITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON \ + -DWITH_OTLP_GRPC_CREDENTIAL_PREVIEW=ON \ + -DWITH_OTLP_RETRY_PREVIEW=ON \ + -DWITH_OTLP_GRPC=ON \ -DWITH_OTLP_HTTP=ON \ -DWITH_OTLP_FILE=ON \ -DWITH_PROMETHEUS=ON \ @@ -85,4 +98,3 @@ jobs: COUNT=$(grep -c "warning:" clang-tidy.log) echo "clang-tidy reported ${COUNT} warning(s)" -# TODO: include WITH_OTLP_GRPC flags. diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index b55d1c971e..64f1dd0d86 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -62,9 +62,18 @@ jobs: -DWITH_OTLP_FILE=ON \ -DWITH_OPENTRACING=ON \ -DWITH_OTLP_HTTP_COMPRESSION=ON \ - -DWITH_THREAD_INSTRUMENTATION=ON \ -DWITH_ZIPKIN=ON \ -DWITH_PROMETHEUS=ON \ + -DWITH_ELASTICSEARCH=ON \ + -DWITH_HTTP_CLIENT_CURL=ON \ + -DWITH_ABI_VERSION_1=OFF \ + -DWITH_ABI_VERSION_2=ON \ + -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ + -DWITH_ASYNC_EXPORT_PREVIEW=ON \ + -DWITH_THREAD_INSTRUMENTATION_PREVIEW=ON \ + -DWITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON \ + -DWITH_OTLP_GRPC_CREDENTIAL_PREVIEW=ON \ + -DWITH_OTLP_RETRY_PREVIEW=ON \ .. - name: iwyu_tool From 100b30c8c0bb3f78cedbe9dbdd7dc6a1b4fc5915 Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Mon, 9 Jun 2025 14:32:36 -0600 Subject: [PATCH 02/10] add warning limit and failure condition for the clang-tidy job. Update the warning limit for iwyu --- .github/workflows/clang-tidy.yaml | 9 +++++++++ .github/workflows/iwyu.yml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/clang-tidy.yaml b/.github/workflows/clang-tidy.yaml index 70ebe02e89..c1eb854628 100644 --- a/.github/workflows/clang-tidy.yaml +++ b/.github/workflows/clang-tidy.yaml @@ -97,4 +97,13 @@ jobs: run: | COUNT=$(grep -c "warning:" clang-tidy.log) echo "clang-tidy reported ${COUNT} warning(s)" + readonly WARNING_LIMIT=216 + # FAIL the build if COUNT > WARNING_LIMIT + if [ $COUNT -gt $WARNING_LIMIT ] ; then + echo "clang-tidy reported ${COUNT} warning(s) exceeding the existing warning limit of ${WARNING_LIMIT}" + exit 1 + # WARN in annotations if COUNT > 0 + elif [ $COUNT -gt 0 ] ; then + echo "clang-tidy reported ${COUNT} warning(s)" + fi diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index bfc0666d97..6d2902ed04 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -96,7 +96,7 @@ jobs: readonly WARNING_COUNT=`grep -c "include-what-you-use reported diagnostics:" iwyu.log` echo "include-what-you-use reported ${WARNING_COUNT} warning(s)" # Acceptable limit, to decrease over time down to 0 - readonly WARNING_LIMIT=0 + readonly WARNING_LIMIT=48 # FAIL the build if WARNING_COUNT > WARNING_LIMIT if [ $WARNING_COUNT -gt $WARNING_LIMIT ] ; then exit 1 From 24a5123b0054e3ca49a52da0e9f5fc4a520f8632 Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Mon, 9 Jun 2025 15:20:00 -0600 Subject: [PATCH 03/10] annotate the clang-tidy count warning for the github workflow job --- .github/workflows/clang-tidy.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/clang-tidy.yaml b/.github/workflows/clang-tidy.yaml index c1eb854628..356945fb94 100644 --- a/.github/workflows/clang-tidy.yaml +++ b/.github/workflows/clang-tidy.yaml @@ -95,6 +95,7 @@ jobs: - name: Count warnings run: | + clang-tidy --version COUNT=$(grep -c "warning:" clang-tidy.log) echo "clang-tidy reported ${COUNT} warning(s)" readonly WARNING_LIMIT=216 @@ -104,6 +105,6 @@ jobs: exit 1 # WARN in annotations if COUNT > 0 elif [ $COUNT -gt 0 ] ; then - echo "clang-tidy reported ${COUNT} warning(s)" + echo "::warning::clang-tidy reported ${COUNT} warning(s)" fi From 13149e4aafe7d3f3ebee52daebb4d2a60b3486da Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Tue, 10 Jun 2025 22:01:03 -0600 Subject: [PATCH 04/10] add testing matrix to iwyu and clang-tidy jobs. Move cmake options to scripts in test_common --- .github/workflows/clang-tidy.yaml | 47 +++++++--------- .github/workflows/iwyu.yml | 53 ++++++++----------- .../cmake/all-options-abiv1-preview.cmake | 10 ++++ test_common/cmake/all-options-abiv1.cmake | 10 ++++ .../cmake/all-options-abiv2-preview.cmake | 10 ++++ test_common/cmake/all-options-abiv2.cmake | 10 ++++ test_common/cmake/all-options.cmake | 7 +++ test_common/cmake/component-options.cmake | 27 ++++++++++ test_common/cmake/example-options.cmake | 11 ++++ test_common/cmake/preview-options.cmake | 15 ++++++ test_common/cmake/testing-options.cmake | 13 +++++ 11 files changed, 154 insertions(+), 59 deletions(-) create mode 100644 test_common/cmake/all-options-abiv1-preview.cmake create mode 100644 test_common/cmake/all-options-abiv1.cmake create mode 100644 test_common/cmake/all-options-abiv2-preview.cmake create mode 100644 test_common/cmake/all-options-abiv2.cmake create mode 100644 test_common/cmake/all-options.cmake create mode 100644 test_common/cmake/component-options.cmake create mode 100644 test_common/cmake/example-options.cmake create mode 100644 test_common/cmake/preview-options.cmake create mode 100644 test_common/cmake/testing-options.cmake diff --git a/.github/workflows/clang-tidy.yaml b/.github/workflows/clang-tidy.yaml index 356945fb94..324e35273c 100644 --- a/.github/workflows/clang-tidy.yaml +++ b/.github/workflows/clang-tidy.yaml @@ -12,6 +12,13 @@ permissions: jobs: clang-tidy: runs-on: ubuntu-24.04 + strategy: + matrix: + include: + - options_preset: all-options-abiv1-preview + warning_limit: 0 + - options_preset: all-options-abiv2-preview + warning_limit: 216 steps: - name: Harden the runner (Audit all outbound calls) uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 @@ -59,52 +66,36 @@ jobs: CXX: clang++ run: | echo "Running cmake..." - cmake -B build \ + cmake -B build-${{ matrix.options_preset }} \ + -C ./test_common/cmake/${{ matrix.options_preset }}.cmake \ -DCMAKE_CXX_STANDARD=14 \ -DWITH_STL=CXX14 \ - -DWITH_ABI_VERSION_1=OFF \ - -DWITH_ABI_VERSION_2=ON \ - -DWITH_HTTP_CLIENT_CURL=ON \ - -DWITH_THREAD_INSTRUMENTATION_PREVIEW=ON \ - -DWITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON \ - -DWITH_OTLP_GRPC_CREDENTIAL_PREVIEW=ON \ - -DWITH_OTLP_RETRY_PREVIEW=ON \ - -DWITH_OTLP_GRPC=ON \ - -DWITH_OTLP_HTTP=ON \ - -DWITH_OTLP_FILE=ON \ - -DWITH_PROMETHEUS=ON \ - -DWITH_ZIPKIN=ON \ - -DWITH_ELASTICSEARCH=ON \ - -DWITH_OTLP_HTTP_COMPRESSION=ON \ - -DWITH_EXAMPLES=ON \ - -DWITH_EXAMPLES_HTTP=ON \ - -DBUILD_W3CTRACECONTEXT_TEST=ON \ - -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ - -DWITH_ASYNC_EXPORT_PREVIEW=ON \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Run clang-tidy run: | - 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 + cmake --build build-${{ matrix.options_preset }} --target opentelemetry_proto + 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 - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: Logs (clang-tidy) - path: ./clang-tidy.log + path: ./clang-tidy-${{ matrix.options_preset }}.log - name: Count warnings run: | clang-tidy --version - COUNT=$(grep -c "warning:" clang-tidy.log) - echo "clang-tidy reported ${COUNT} warning(s)" - readonly WARNING_LIMIT=216 + COUNT=$(grep -c "warning:" clang-tidy-${{ matrix.options_preset }}.log) + echo "clang-tidy reported ${COUNT} warning(s) with cmake options preset '${{ matrix.options_preset }}'" + + readonly WARNING_LIMIT=${{ matrix.warning_limit }} + # FAIL the build if COUNT > WARNING_LIMIT if [ $COUNT -gt $WARNING_LIMIT ] ; then - echo "clang-tidy reported ${COUNT} warning(s) exceeding the existing warning limit of ${WARNING_LIMIT}" + echo "clang-tidy reported ${COUNT} warning(s) exceeding the existing warning limit of ${WARNING_LIMIT} with cmake options preset '${{ matrix.options_preset }}'" exit 1 # WARN in annotations if COUNT > 0 elif [ $COUNT -gt 0 ] ; then - echo "::warning::clang-tidy reported ${COUNT} warning(s)" + echo "::warning::clang-tidy reported ${COUNT} warning(s) with cmake options preset '${{ matrix.options_preset }}'" fi diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index 6d2902ed04..a0adaff24b 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -13,6 +13,16 @@ permissions: jobs: iwyu: runs-on: ubuntu-latest + strategy: + matrix: + include: + - options_preset: all-options-abiv1 + warning_limit: 0 + - options_preset: all-options-abiv1-preview + warning_limit: 24 + - options_preset: all-options-abiv2-preview + warning_limit: 48 + steps: - name: Harden the runner (Audit all outbound calls) uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 @@ -48,59 +58,40 @@ jobs: - name: Prepare CMake run: | TOPDIR=`pwd` - mkdir build && cd build + mkdir -p build-${{ matrix.options_preset }} && cd build-${{ matrix.options_preset }} CC="clang" CXX="clang++" cmake \ + -C ${TOPDIR}/test_common/cmake/${{ matrix.options_preset }}.cmake \ -DCMAKE_CXX_STANDARD=14 \ -DWITH_STL=CXX14 \ -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-w;-Xiwyu;--mapping_file=${TOPDIR}/.iwyu.imp;" \ - -DBUILD_TESTING=ON \ - -DWITH_EXAMPLES=ON \ - -DWITH_EXAMPLES_HTTP=ON \ - -DBUILD_W3CTRACECONTEXT_TEST=ON \ - -DWITH_OTLP_GRPC=ON \ - -DWITH_OTLP_HTTP=ON \ - -DWITH_OTLP_FILE=ON \ - -DWITH_OPENTRACING=ON \ - -DWITH_OTLP_HTTP_COMPRESSION=ON \ - -DWITH_ZIPKIN=ON \ - -DWITH_PROMETHEUS=ON \ - -DWITH_ELASTICSEARCH=ON \ - -DWITH_HTTP_CLIENT_CURL=ON \ - -DWITH_ABI_VERSION_1=OFF \ - -DWITH_ABI_VERSION_2=ON \ - -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ - -DWITH_ASYNC_EXPORT_PREVIEW=ON \ - -DWITH_THREAD_INSTRUMENTATION_PREVIEW=ON \ - -DWITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON \ - -DWITH_OTLP_GRPC_CREDENTIAL_PREVIEW=ON \ - -DWITH_OTLP_RETRY_PREVIEW=ON \ .. - name: iwyu_tool run: | - cd build - make -k 2>&1 | tee -a iwyu.log + cd build-${{ matrix.options_preset }} + make -k 2>&1 | tee -a iwyu-${{ matrix.options_preset }}.log - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 if: success() || failure() with: - name: Logs (include-what-you-use) - path: ./build/*.log + name: Logs-${{ matrix.options_preset }} (include-what-you-use) + path: ./build-${{ matrix.options_preset }}/*.log - name: count warnings run: | set +e echo "include-what-you-use version:" include-what-you-use --version - cd build - readonly WARNING_COUNT=`grep -c "include-what-you-use reported diagnostics:" iwyu.log` - echo "include-what-you-use reported ${WARNING_COUNT} warning(s)" + cd build-${{ matrix.options_preset }} + readonly WARNING_COUNT=`grep -c "include-what-you-use reported diagnostics:" iwyu-${{ matrix.options_preset }}.log` + echo "include-what-you-use reported ${WARNING_COUNT} warning(s) with cmake options preset '${{ matrix.options_preset }}'" # Acceptable limit, to decrease over time down to 0 - readonly WARNING_LIMIT=48 + readonly WARNING_LIMIT=${{ matrix.warning_limit }} # FAIL the build if WARNING_COUNT > WARNING_LIMIT if [ $WARNING_COUNT -gt $WARNING_LIMIT ] ; then + 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 }}'" exit 1 # WARN in annotations if WARNING_COUNT > 0 elif [ $WARNING_COUNT -gt 0 ] ; then - echo "::warning::include-what-you-use reported ${WARNING_COUNT} warning(s)" + echo "::warning::include-what-you-use reported ${WARNING_COUNT} warning(s) with cmake options preset '${{ matrix.options_preset }}'" fi diff --git a/test_common/cmake/all-options-abiv1-preview.cmake b/test_common/cmake/all-options-abiv1-preview.cmake new file mode 100644 index 0000000000..9b75097823 --- /dev/null +++ b/test_common/cmake/all-options-abiv1-preview.cmake @@ -0,0 +1,10 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +# This script enables ABI V1 with preview features + +set(WITH_ABI_VERSION_1 ON CACHE BOOL "" FORCE) +set(WITH_ABI_VERSION_2 OFF CACHE BOOL "" FORCE) + +set(ENABLE_PREVIEW ON) +include(${CMAKE_CURRENT_LIST_DIR}/all-options.cmake) \ No newline at end of file diff --git a/test_common/cmake/all-options-abiv1.cmake b/test_common/cmake/all-options-abiv1.cmake new file mode 100644 index 0000000000..ea87ebea85 --- /dev/null +++ b/test_common/cmake/all-options-abiv1.cmake @@ -0,0 +1,10 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +# This script enables ABI V1 with all options except preview features + +set(WITH_ABI_VERSION_1 ON CACHE BOOL "" FORCE) +set(WITH_ABI_VERSION_2 OFF CACHE BOOL "" FORCE) + +set(ENABLE_PREVIEW OFF) +include(${CMAKE_CURRENT_LIST_DIR}/all-options.cmake) \ No newline at end of file diff --git a/test_common/cmake/all-options-abiv2-preview.cmake b/test_common/cmake/all-options-abiv2-preview.cmake new file mode 100644 index 0000000000..7ba75ab5f3 --- /dev/null +++ b/test_common/cmake/all-options-abiv2-preview.cmake @@ -0,0 +1,10 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +# This script enables ABI V2 with all options and with preview features + +set(WITH_ABI_VERSION_1 OFF CACHE BOOL "" FORCE) +set(WITH_ABI_VERSION_2 ON CACHE BOOL "" FORCE) + +set(ENABLE_PREVIEW ON) +include(${CMAKE_CURRENT_LIST_DIR}/all-options.cmake) \ No newline at end of file diff --git a/test_common/cmake/all-options-abiv2.cmake b/test_common/cmake/all-options-abiv2.cmake new file mode 100644 index 0000000000..e5dbba03cc --- /dev/null +++ b/test_common/cmake/all-options-abiv2.cmake @@ -0,0 +1,10 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +# This script enables ABI V2 with all options except preview features + +set(WITH_ABI_VERSION_1 OFF CACHE BOOL "" FORCE) +set(WITH_ABI_VERSION_2 ON CACHE BOOL "" FORCE) + +set(ENABLE_PREVIEW OFF) +include(${CMAKE_CURRENT_LIST_DIR}/all-options.cmake) diff --git a/test_common/cmake/all-options.cmake b/test_common/cmake/all-options.cmake new file mode 100644 index 0000000000..657089afb1 --- /dev/null +++ b/test_common/cmake/all-options.cmake @@ -0,0 +1,7 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +include(${CMAKE_CURRENT_LIST_DIR}/component-options.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/example-options.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/testing-options.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/preview-options.cmake) diff --git a/test_common/cmake/component-options.cmake b/test_common/cmake/component-options.cmake new file mode 100644 index 0000000000..5a2a2a3d5d --- /dev/null +++ b/test_common/cmake/component-options.cmake @@ -0,0 +1,27 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +# Enable all components in the OpenTelemetry C++ SDK. + +if(NOT DEFINED ENABLE_COMPONENTS) + set(ENABLE_COMPONENTS ON) +endif() + +set(WITH_OTLP_GRPC ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) +set(WITH_OTLP_HTTP ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) +set(WITH_OTLP_FILE ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) + +set(WITH_OTLP_HTTP_COMPRESSION ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) +set(WITH_CURL_LOGGING ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) + +set(WITH_PROMETHEUS ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) +set(WITH_ZIPKIN ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) +set(WITH_ELASTICSEARCH ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) + +if(WIN32) + set(WITH_ETW ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) +endif() + +if(WITH_ABI_VERSION_1) + set(WITH_OPENTRACING ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) +endif() diff --git a/test_common/cmake/example-options.cmake b/test_common/cmake/example-options.cmake new file mode 100644 index 0000000000..78421a60cc --- /dev/null +++ b/test_common/cmake/example-options.cmake @@ -0,0 +1,11 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +# Enable all examples in the OpenTelemetry C++ SDK. + +if(NOT DEFINED ENABLE_EXAMPLES) + set(ENABLE_EXAMPLES ON) +endif() + +set(WITH_EXAMPLES ${ENABLE_EXAMPLES} CACHE BOOL "" FORCE) +set(WITH_EXAMPLES_HTTP ${ENABLE_EXAMPLES} CACHE BOOL "" FORCE) diff --git a/test_common/cmake/preview-options.cmake b/test_common/cmake/preview-options.cmake new file mode 100644 index 0000000000..5de8f83a23 --- /dev/null +++ b/test_common/cmake/preview-options.cmake @@ -0,0 +1,15 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +# This script enables preview features in the OpenTelemetry C++ SDK. + +if(NOT DEFINED ENABLE_PREVIEW) + set(ENABLE_PREVIEW ON) +endif() + +set(WITH_METRICS_EXEMPLAR_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) +set(WITH_ASYNC_EXPORT_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) +set(WITH_THREAD_INSTRUMENTATION_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) +set(WITH_OTLP_GRPC_SSL_MTLS_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) +set(WITH_OTLP_GRPC_CREDENTIAL_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) +set(WITH_OTLP_RETRY_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) diff --git a/test_common/cmake/testing-options.cmake b/test_common/cmake/testing-options.cmake new file mode 100644 index 0000000000..972b55183d --- /dev/null +++ b/test_common/cmake/testing-options.cmake @@ -0,0 +1,13 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +# Enable all examples in the OpenTelemetry C++ SDK. + +if(NOT DEFINED ENABLE_TESTS) + set(ENABLE_TESTS ON) +endif() + +set(BUILD_TESTING ${ENABLE_TESTS} CACHE BOOL "" FORCE) +set(BUILD_W3CTRACECONTEXT_TEST ${ENABLE_TESTS} CACHE BOOL "" FORCE) +set(WITH_BENCHMARK ${ENABLE_TESTS} CACHE BOOL "" FORCE) +set(WITH_FUNC_TESTS ${ENABLE_TESTS} CACHE BOOL "" FORCE) From e807e3b27dde775146a09c61e3341843261ce623 Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Tue, 10 Jun 2025 22:50:40 -0600 Subject: [PATCH 05/10] set fail-fast false on the strategy to get current warning counts. Clean up comments and fix issue with clang-tidy log upload --- .github/workflows/clang-tidy.yaml | 25 +++++++------- .github/workflows/iwyu.yml | 33 ++++++++++--------- .../cmake/all-options-abiv1-preview.cmake | 4 +-- test_common/cmake/all-options-abiv1.cmake | 4 +-- .../cmake/all-options-abiv2-preview.cmake | 4 +-- test_common/cmake/all-options-abiv2.cmake | 2 +- test_common/cmake/all-options.cmake | 2 ++ test_common/cmake/preview-options.cmake | 2 +- test_common/cmake/testing-options.cmake | 2 +- 9 files changed, 41 insertions(+), 37 deletions(-) diff --git a/.github/workflows/clang-tidy.yaml b/.github/workflows/clang-tidy.yaml index 324e35273c..de93a1a9ed 100644 --- a/.github/workflows/clang-tidy.yaml +++ b/.github/workflows/clang-tidy.yaml @@ -13,11 +13,12 @@ jobs: clang-tidy: runs-on: ubuntu-24.04 strategy: + fail-fast: false matrix: include: - - options_preset: all-options-abiv1-preview + - cmake_options: all-options-abiv1-preview warning_limit: 0 - - options_preset: all-options-abiv2-preview + - cmake_options: all-options-abiv2-preview warning_limit: 216 steps: - name: Harden the runner (Audit all outbound calls) @@ -66,36 +67,36 @@ jobs: CXX: clang++ run: | echo "Running cmake..." - cmake -B build-${{ matrix.options_preset }} \ - -C ./test_common/cmake/${{ matrix.options_preset }}.cmake \ + cmake -B build-${{ matrix.cmake_options }} \ + -C ./test_common/cmake/${{ matrix.cmake_options }}.cmake \ -DCMAKE_CXX_STANDARD=14 \ -DWITH_STL=CXX14 \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Run clang-tidy run: | - cmake --build build-${{ matrix.options_preset }} --target opentelemetry_proto - 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 + cmake --build build-${{ matrix.cmake_options }} + jq -r .[].file build-${{ matrix.cmake_options }}/compile_commands.json | grep -vE '/(generated|third_party)/' | xargs -P $(nproc) -n 1 clang-tidy --quiet -p build-${{ matrix.cmake_options }} 2>&1 | tee -a clang-tidy-${{ matrix.cmake_options }}.log - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: - name: Logs (clang-tidy) - path: ./clang-tidy-${{ matrix.options_preset }}.log + name: Logs-clang-tidy-${{ matrix.cmake_options }} + path: ./clang-tidy-${{ matrix.cmake_options }}.log - name: Count warnings run: | clang-tidy --version - COUNT=$(grep -c "warning:" clang-tidy-${{ matrix.options_preset }}.log) - echo "clang-tidy reported ${COUNT} warning(s) with cmake options preset '${{ matrix.options_preset }}'" + COUNT=$(grep -c "warning:" clang-tidy-${{ matrix.cmake_options }}.log) + echo "clang-tidy reported ${COUNT} warning(s) with cmake options preset '${{ matrix.cmake_options }}'" readonly WARNING_LIMIT=${{ matrix.warning_limit }} # FAIL the build if COUNT > WARNING_LIMIT if [ $COUNT -gt $WARNING_LIMIT ] ; then - echo "clang-tidy reported ${COUNT} warning(s) exceeding the existing warning limit of ${WARNING_LIMIT} with cmake options preset '${{ matrix.options_preset }}'" + echo "clang-tidy reported ${COUNT} warning(s) exceeding the existing warning limit of ${WARNING_LIMIT} with cmake options preset '${{ matrix.cmake_options }}'" exit 1 # WARN in annotations if COUNT > 0 elif [ $COUNT -gt 0 ] ; then - echo "::warning::clang-tidy reported ${COUNT} warning(s) with cmake options preset '${{ matrix.options_preset }}'" + echo "::warning::clang-tidy reported ${COUNT} warning(s) with cmake options preset '${{ matrix.cmake_options }}'" fi diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index a0adaff24b..67dcbfcb99 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -14,13 +14,14 @@ jobs: iwyu: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: include: - - options_preset: all-options-abiv1 - warning_limit: 0 - - options_preset: all-options-abiv1-preview - warning_limit: 24 - - options_preset: all-options-abiv2-preview + - cmake_options: all-options-abiv1 + warning_limit: 3 + - cmake_options: all-options-abiv1-preview + warning_limit: 48 + - cmake_options: all-options-abiv2-preview warning_limit: 48 steps: @@ -58,9 +59,9 @@ jobs: - name: Prepare CMake run: | TOPDIR=`pwd` - mkdir -p build-${{ matrix.options_preset }} && cd build-${{ matrix.options_preset }} + mkdir -p build-${{ matrix.cmake_options }} && cd build-${{ matrix.cmake_options }} CC="clang" CXX="clang++" cmake \ - -C ${TOPDIR}/test_common/cmake/${{ matrix.options_preset }}.cmake \ + -C ${TOPDIR}/test_common/cmake/${{ matrix.cmake_options }}.cmake \ -DCMAKE_CXX_STANDARD=14 \ -DWITH_STL=CXX14 \ -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-w;-Xiwyu;--mapping_file=${TOPDIR}/.iwyu.imp;" \ @@ -68,30 +69,30 @@ jobs: - name: iwyu_tool run: | - cd build-${{ matrix.options_preset }} - make -k 2>&1 | tee -a iwyu-${{ matrix.options_preset }}.log + cd build-${{ matrix.cmake_options }} + make -k 2>&1 | tee -a iwyu-${{ matrix.cmake_options }}.log - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 if: success() || failure() with: - name: Logs-${{ matrix.options_preset }} (include-what-you-use) - path: ./build-${{ matrix.options_preset }}/*.log + name: Logs-iwyu-${{ matrix.cmake_options }} + path: ./build-${{ matrix.cmake_options }}/*.log - name: count warnings run: | set +e echo "include-what-you-use version:" include-what-you-use --version - cd build-${{ matrix.options_preset }} - readonly WARNING_COUNT=`grep -c "include-what-you-use reported diagnostics:" iwyu-${{ matrix.options_preset }}.log` - echo "include-what-you-use reported ${WARNING_COUNT} warning(s) with cmake options preset '${{ matrix.options_preset }}'" + cd build-${{ matrix.cmake_options }} + readonly WARNING_COUNT=`grep -c "include-what-you-use reported diagnostics:" iwyu-${{ matrix.cmake_options }}.log` + echo "include-what-you-use reported ${WARNING_COUNT} warning(s) with cmake options preset '${{ matrix.cmake_options }}'" # Acceptable limit, to decrease over time down to 0 readonly WARNING_LIMIT=${{ matrix.warning_limit }} # FAIL the build if WARNING_COUNT > WARNING_LIMIT if [ $WARNING_COUNT -gt $WARNING_LIMIT ] ; then - 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 }}'" + echo "include-what-you-use reported ${WARNING_COUNT} warning(s) exceeding the existing warning limit of ${WARNING_LIMIT} with cmake options preset '${{ matrix.cmake_options }}'" exit 1 # WARN in annotations if WARNING_COUNT > 0 elif [ $WARNING_COUNT -gt 0 ] ; then - echo "::warning::include-what-you-use reported ${WARNING_COUNT} warning(s) with cmake options preset '${{ matrix.options_preset }}'" + echo "::warning::include-what-you-use reported ${WARNING_COUNT} warning(s) with cmake options preset '${{ matrix.cmake_options }}'" fi diff --git a/test_common/cmake/all-options-abiv1-preview.cmake b/test_common/cmake/all-options-abiv1-preview.cmake index 9b75097823..16c21c29d1 100644 --- a/test_common/cmake/all-options-abiv1-preview.cmake +++ b/test_common/cmake/all-options-abiv1-preview.cmake @@ -1,10 +1,10 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -# This script enables ABI V1 with preview features +# Enable all options with ABI V1 including preview features set(WITH_ABI_VERSION_1 ON CACHE BOOL "" FORCE) set(WITH_ABI_VERSION_2 OFF CACHE BOOL "" FORCE) set(ENABLE_PREVIEW ON) -include(${CMAKE_CURRENT_LIST_DIR}/all-options.cmake) \ No newline at end of file +include(${CMAKE_CURRENT_LIST_DIR}/all-options.cmake) diff --git a/test_common/cmake/all-options-abiv1.cmake b/test_common/cmake/all-options-abiv1.cmake index ea87ebea85..212faf4866 100644 --- a/test_common/cmake/all-options-abiv1.cmake +++ b/test_common/cmake/all-options-abiv1.cmake @@ -1,10 +1,10 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -# This script enables ABI V1 with all options except preview features +# Enable all options with ABI V1 except preview features set(WITH_ABI_VERSION_1 ON CACHE BOOL "" FORCE) set(WITH_ABI_VERSION_2 OFF CACHE BOOL "" FORCE) set(ENABLE_PREVIEW OFF) -include(${CMAKE_CURRENT_LIST_DIR}/all-options.cmake) \ No newline at end of file +include(${CMAKE_CURRENT_LIST_DIR}/all-options.cmake) diff --git a/test_common/cmake/all-options-abiv2-preview.cmake b/test_common/cmake/all-options-abiv2-preview.cmake index 7ba75ab5f3..984524a4ae 100644 --- a/test_common/cmake/all-options-abiv2-preview.cmake +++ b/test_common/cmake/all-options-abiv2-preview.cmake @@ -1,10 +1,10 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -# This script enables ABI V2 with all options and with preview features +# Enable all options with ABI V2 including preview features set(WITH_ABI_VERSION_1 OFF CACHE BOOL "" FORCE) set(WITH_ABI_VERSION_2 ON CACHE BOOL "" FORCE) set(ENABLE_PREVIEW ON) -include(${CMAKE_CURRENT_LIST_DIR}/all-options.cmake) \ No newline at end of file +include(${CMAKE_CURRENT_LIST_DIR}/all-options.cmake) diff --git a/test_common/cmake/all-options-abiv2.cmake b/test_common/cmake/all-options-abiv2.cmake index e5dbba03cc..5210b4f659 100644 --- a/test_common/cmake/all-options-abiv2.cmake +++ b/test_common/cmake/all-options-abiv2.cmake @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -# This script enables ABI V2 with all options except preview features +# Enable all options with ABI V2 except preview features set(WITH_ABI_VERSION_1 OFF CACHE BOOL "" FORCE) set(WITH_ABI_VERSION_2 ON CACHE BOOL "" FORCE) diff --git a/test_common/cmake/all-options.cmake b/test_common/cmake/all-options.cmake index 657089afb1..3144e4b90b 100644 --- a/test_common/cmake/all-options.cmake +++ b/test_common/cmake/all-options.cmake @@ -1,6 +1,8 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 +# Enable all options for opentelemetry-cpp cmake. + include(${CMAKE_CURRENT_LIST_DIR}/component-options.cmake) include(${CMAKE_CURRENT_LIST_DIR}/example-options.cmake) include(${CMAKE_CURRENT_LIST_DIR}/testing-options.cmake) diff --git a/test_common/cmake/preview-options.cmake b/test_common/cmake/preview-options.cmake index 5de8f83a23..c7b7409956 100644 --- a/test_common/cmake/preview-options.cmake +++ b/test_common/cmake/preview-options.cmake @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -# This script enables preview features in the OpenTelemetry C++ SDK. +# Enable all preview features in the OpenTelemetry C++ SDK. if(NOT DEFINED ENABLE_PREVIEW) set(ENABLE_PREVIEW ON) diff --git a/test_common/cmake/testing-options.cmake b/test_common/cmake/testing-options.cmake index 972b55183d..926870ac90 100644 --- a/test_common/cmake/testing-options.cmake +++ b/test_common/cmake/testing-options.cmake @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -# Enable all examples in the OpenTelemetry C++ SDK. +# Enable all tests in the OpenTelemetry C++ SDK. if(NOT DEFINED ENABLE_TESTS) set(ENABLE_TESTS ON) From aad7ac8f7433d63ece9cf372c25ed178a3af73d0 Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Tue, 10 Jun 2025 23:38:26 -0600 Subject: [PATCH 06/10] update iwyu warning limits. use cmake args to trigger clang-tidy. disable opentracing with clang-tidy builds until the cmake linking for that target is fixed. --- .github/workflows/clang-tidy.yaml | 14 +++++++------- .github/workflows/iwyu.yml | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/clang-tidy.yaml b/.github/workflows/clang-tidy.yaml index de93a1a9ed..c73497c614 100644 --- a/.github/workflows/clang-tidy.yaml +++ b/.github/workflows/clang-tidy.yaml @@ -13,13 +13,13 @@ jobs: clang-tidy: runs-on: ubuntu-24.04 strategy: - fail-fast: false + fail-fast: true matrix: include: - cmake_options: all-options-abiv1-preview - warning_limit: 0 + warning_limit: 236 - cmake_options: all-options-abiv2-preview - warning_limit: 216 + warning_limit: 236 steps: - name: Harden the runner (Audit all outbound calls) uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 @@ -60,7 +60,6 @@ jobs: echo "Using clang-tidy version: $(clang-tidy --version)" echo "clang-tidy installed at: $(which clang-tidy)" - - name: Prepare CMake env: CC: clang @@ -71,12 +70,13 @@ jobs: -C ./test_common/cmake/${{ matrix.cmake_options }}.cmake \ -DCMAKE_CXX_STANDARD=14 \ -DWITH_STL=CXX14 \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + -DWITH_OPENTRACING=OFF \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + -DCMAKE_CXX_CLANG_TIDY="clang-tidy;--quiet;-p;build-${{ matrix.cmake_options }}" - name: Run clang-tidy run: | - cmake --build build-${{ matrix.cmake_options }} - jq -r .[].file build-${{ matrix.cmake_options }}/compile_commands.json | grep -vE '/(generated|third_party)/' | xargs -P $(nproc) -n 1 clang-tidy --quiet -p build-${{ matrix.cmake_options }} 2>&1 | tee -a clang-tidy-${{ matrix.cmake_options }}.log + cmake --build build-${{ matrix.cmake_options }} -- -j$(nproc) 2>&1 | tee clang-tidy-${{ matrix.cmake_options }}.log - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index 67dcbfcb99..84865fc55a 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -14,13 +14,13 @@ jobs: iwyu: runs-on: ubuntu-latest strategy: - fail-fast: false + fail-fast: true matrix: include: - cmake_options: all-options-abiv1 warning_limit: 3 - cmake_options: all-options-abiv1-preview - warning_limit: 48 + warning_limit: 28 - cmake_options: all-options-abiv2-preview warning_limit: 48 From a2851c27cfc73ff082ee659578c18c4cacd65705 Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Wed, 11 Jun 2025 07:20:41 -0600 Subject: [PATCH 07/10] disable deprecation warnings with clang-tidy jobs. Disable clang-tidy for protobuf generated code. Run iwyu in parallel. --- .github/workflows/clang-tidy.yaml | 8 ++------ .github/workflows/iwyu.yml | 18 +++++++++--------- cmake/opentelemetry-proto.cmake | 8 ++++---- examples/grpc/CMakeLists.txt | 5 +++-- test_common/cmake/all-options.cmake | 2 +- test_common/cmake/component-options.cmake | 2 +- test_common/cmake/example-options.cmake | 2 +- test_common/cmake/preview-options.cmake | 2 +- test_common/cmake/testing-options.cmake | 2 +- 9 files changed, 23 insertions(+), 26 deletions(-) diff --git a/.github/workflows/clang-tidy.yaml b/.github/workflows/clang-tidy.yaml index c73497c614..79dcec0337 100644 --- a/.github/workflows/clang-tidy.yaml +++ b/.github/workflows/clang-tidy.yaml @@ -13,7 +13,7 @@ jobs: clang-tidy: runs-on: ubuntu-24.04 strategy: - fail-fast: true + fail-fast: false matrix: include: - cmake_options: all-options-abiv1-preview @@ -31,10 +31,6 @@ jobs: submodules: recursive - name: Setup Environment - env: - PROTOBUF_VERSION: '23.3' - ABSEIL_CPP_VERSION: '20230125.3' - CXX_STANDARD: '14' run: | sudo apt update -y sudo apt install -y --no-install-recommends --no-install-suggests \ @@ -71,6 +67,7 @@ jobs: -DCMAKE_CXX_STANDARD=14 \ -DWITH_STL=CXX14 \ -DWITH_OPENTRACING=OFF \ + -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DCMAKE_CXX_CLANG_TIDY="clang-tidy;--quiet;-p;build-${{ matrix.cmake_options }}" @@ -85,7 +82,6 @@ jobs: - name: Count warnings run: | - clang-tidy --version COUNT=$(grep -c "warning:" clang-tidy-${{ matrix.cmake_options }}.log) echo "clang-tidy reported ${COUNT} warning(s) with cmake options preset '${{ matrix.cmake_options }}'" diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index 84865fc55a..33102e1d82 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -14,7 +14,7 @@ jobs: iwyu: runs-on: ubuntu-latest strategy: - fail-fast: true + fail-fast: false matrix: include: - cmake_options: all-options-abiv1 @@ -57,26 +57,26 @@ jobs: run: | sudo ./ci/install_iwyu.sh - name: Prepare CMake + env: + CC: clang + CXX: clang++ run: | TOPDIR=`pwd` - mkdir -p build-${{ matrix.cmake_options }} && cd build-${{ matrix.cmake_options }} - CC="clang" CXX="clang++" cmake \ - -C ${TOPDIR}/test_common/cmake/${{ matrix.cmake_options }}.cmake \ + cmake -B build-${{ matrix.cmake_options }} \ + -C ./test_common/cmake/${{ matrix.cmake_options }}.cmake \ -DCMAKE_CXX_STANDARD=14 \ -DWITH_STL=CXX14 \ - -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-w;-Xiwyu;--mapping_file=${TOPDIR}/.iwyu.imp;" \ - .. + -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-w;-Xiwyu;--mapping_file=${TOPDIR}/.iwyu.imp;" - name: iwyu_tool run: | - cd build-${{ matrix.cmake_options }} - make -k 2>&1 | tee -a iwyu-${{ matrix.cmake_options }}.log + cmake --build build-${{ matrix.cmake_options }} -- -j$(nproc) -k 2>&1 | tee -a iwyu-${{ matrix.cmake_options }}.log - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 if: success() || failure() with: name: Logs-iwyu-${{ matrix.cmake_options }} - path: ./build-${{ matrix.cmake_options }}/*.log + path: ./iwyu-${{ matrix.cmake_options }}.log - name: count warnings run: | diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake index 60b3472845..90a95c2f59 100644 --- a/cmake/opentelemetry-proto.cmake +++ b/cmake/opentelemetry-proto.cmake @@ -318,9 +318,9 @@ target_include_directories( PUBLIC "$" "$") -# Disable include-what-you-use on generated code. +# Disable include-what-you-use and clang-tidy on generated code. set_target_properties(opentelemetry_proto PROPERTIES CXX_INCLUDE_WHAT_YOU_USE - "") + "" CXX_CLANG_TIDY "") if(NOT Protobuf_INCLUDE_DIRS AND TARGET protobuf::libprotobuf) get_target_property(Protobuf_INCLUDE_DIRS protobuf::libprotobuf INTERFACE_INCLUDE_DIRECTORIES) @@ -338,9 +338,9 @@ if(WITH_OTLP_GRPC) ${LOGS_SERVICE_GRPC_PB_CPP_FILE} ${METRICS_SERVICE_GRPC_PB_CPP_FILE}) set_target_version(opentelemetry_proto_grpc) - # Disable include-what-you-use on generated code. + # Disable include-what-you-use and clang-tidy on generated code. set_target_properties(opentelemetry_proto_grpc - PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "") + PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "" CXX_CLANG_TIDY "") list(APPEND OPENTELEMETRY_PROTO_TARGETS opentelemetry_proto_grpc) target_link_libraries(opentelemetry_proto_grpc PUBLIC opentelemetry_proto) diff --git a/examples/grpc/CMakeLists.txt b/examples/grpc/CMakeLists.txt index 4f87bc3b89..78d5f7823b 100644 --- a/examples/grpc/CMakeLists.txt +++ b/examples/grpc/CMakeLists.txt @@ -41,8 +41,9 @@ add_custom_command( add_library(example_grpc_proto ${example_grpc_srcs} ${example_grpc_hdrs} ${example_proto_srcs} ${example_proto_hdrs}) -# Disable include-what-you-use on generated code. -set_target_properties(example_grpc_proto PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "") +# Disable include-what-you-use and clang-tidy on generated code. +set_target_properties(example_grpc_proto PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "" + CXX_CLANG_TIDY "") target_include_directories( example_grpc_proto PUBLIC "$") diff --git a/test_common/cmake/all-options.cmake b/test_common/cmake/all-options.cmake index 3144e4b90b..213a28996b 100644 --- a/test_common/cmake/all-options.cmake +++ b/test_common/cmake/all-options.cmake @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -# Enable all options for opentelemetry-cpp cmake. +# All options for the opentelemetry-cpp project. include(${CMAKE_CURRENT_LIST_DIR}/component-options.cmake) include(${CMAKE_CURRENT_LIST_DIR}/example-options.cmake) diff --git a/test_common/cmake/component-options.cmake b/test_common/cmake/component-options.cmake index 5a2a2a3d5d..b248141850 100644 --- a/test_common/cmake/component-options.cmake +++ b/test_common/cmake/component-options.cmake @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -# Enable all components in the OpenTelemetry C++ SDK. +# All components options if(NOT DEFINED ENABLE_COMPONENTS) set(ENABLE_COMPONENTS ON) diff --git a/test_common/cmake/example-options.cmake b/test_common/cmake/example-options.cmake index 78421a60cc..4249f59531 100644 --- a/test_common/cmake/example-options.cmake +++ b/test_common/cmake/example-options.cmake @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -# Enable all examples in the OpenTelemetry C++ SDK. +# All examples options if(NOT DEFINED ENABLE_EXAMPLES) set(ENABLE_EXAMPLES ON) diff --git a/test_common/cmake/preview-options.cmake b/test_common/cmake/preview-options.cmake index c7b7409956..b2db0fa931 100644 --- a/test_common/cmake/preview-options.cmake +++ b/test_common/cmake/preview-options.cmake @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -# Enable all preview features in the OpenTelemetry C++ SDK. +# All preview feature options if(NOT DEFINED ENABLE_PREVIEW) set(ENABLE_PREVIEW ON) diff --git a/test_common/cmake/testing-options.cmake b/test_common/cmake/testing-options.cmake index 926870ac90..fc64493a18 100644 --- a/test_common/cmake/testing-options.cmake +++ b/test_common/cmake/testing-options.cmake @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -# Enable all tests in the OpenTelemetry C++ SDK. +# All testing options if(NOT DEFINED ENABLE_TESTS) set(ENABLE_TESTS ON) From 7ea594c7d02428fabd8876fa882fdb626887c7a2 Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Wed, 11 Jun 2025 07:53:21 -0600 Subject: [PATCH 08/10] set the clang-tidy warning limits. fix iwyu error count step --- .github/workflows/clang-tidy.yaml | 6 +++--- .github/workflows/iwyu.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/clang-tidy.yaml b/.github/workflows/clang-tidy.yaml index 79dcec0337..198c0efdaf 100644 --- a/.github/workflows/clang-tidy.yaml +++ b/.github/workflows/clang-tidy.yaml @@ -11,15 +11,15 @@ permissions: jobs: clang-tidy: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - cmake_options: all-options-abiv1-preview - warning_limit: 236 + warning_limit: 215 - cmake_options: all-options-abiv2-preview - warning_limit: 236 + warning_limit: 216 steps: - name: Harden the runner (Audit all outbound calls) uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index 33102e1d82..1f4109e6d9 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -66,6 +66,7 @@ jobs: -C ./test_common/cmake/${{ matrix.cmake_options }}.cmake \ -DCMAKE_CXX_STANDARD=14 \ -DWITH_STL=CXX14 \ + -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" \ -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-w;-Xiwyu;--mapping_file=${TOPDIR}/.iwyu.imp;" - name: iwyu_tool @@ -83,7 +84,6 @@ jobs: set +e echo "include-what-you-use version:" include-what-you-use --version - cd build-${{ matrix.cmake_options }} readonly WARNING_COUNT=`grep -c "include-what-you-use reported diagnostics:" iwyu-${{ matrix.cmake_options }}.log` echo "include-what-you-use reported ${WARNING_COUNT} warning(s) with cmake options preset '${{ matrix.cmake_options }}'" # Acceptable limit, to decrease over time down to 0 From 08a5c57a34eab9445422f925f89efd4b6cd7adaa Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Sun, 15 Jun 2025 19:57:43 +0000 Subject: [PATCH 09/10] address feedback --- test_common/cmake/component-options.cmake | 3 --- test_common/cmake/preview-options.cmake | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/test_common/cmake/component-options.cmake b/test_common/cmake/component-options.cmake index b248141850..489f84596b 100644 --- a/test_common/cmake/component-options.cmake +++ b/test_common/cmake/component-options.cmake @@ -11,9 +11,6 @@ set(WITH_OTLP_GRPC ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) set(WITH_OTLP_HTTP ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) set(WITH_OTLP_FILE ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) -set(WITH_OTLP_HTTP_COMPRESSION ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) -set(WITH_CURL_LOGGING ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) - set(WITH_PROMETHEUS ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) set(WITH_ZIPKIN ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) set(WITH_ELASTICSEARCH ${ENABLE_COMPONENTS} CACHE BOOL "" FORCE) diff --git a/test_common/cmake/preview-options.cmake b/test_common/cmake/preview-options.cmake index b2db0fa931..88acf7a187 100644 --- a/test_common/cmake/preview-options.cmake +++ b/test_common/cmake/preview-options.cmake @@ -13,3 +13,5 @@ set(WITH_THREAD_INSTRUMENTATION_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) set(WITH_OTLP_GRPC_SSL_MTLS_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) set(WITH_OTLP_GRPC_CREDENTIAL_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) set(WITH_OTLP_RETRY_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) +set(WITH_OTLP_HTTP_COMPRESSION ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) +set(WITH_CURL_LOGGING ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) From 145e455f1451f90b725af471feb1435f65426881 Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Sun, 15 Jun 2025 15:04:31 -0600 Subject: [PATCH 10/10] increase warning limit for abvi1 iwyu case to 5 --- .github/workflows/iwyu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index e4b275c24b..9aad274738 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -18,7 +18,7 @@ jobs: matrix: include: - cmake_options: all-options-abiv1 - warning_limit: 3 + warning_limit: 5 - cmake_options: all-options-abiv1-preview warning_limit: 28 - cmake_options: all-options-abiv2-preview