diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bdd672799..70b3d82238 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1085,7 +1085,7 @@ jobs: code_coverage: name: Code coverage - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Harden the runner (Audit all outbound calls) uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0 @@ -1096,15 +1096,16 @@ jobs: with: submodules: 'recursive' - name: setup - env: - CC: /usr/bin/gcc-10 - CXX: /usr/bin/g++-10 run: | sudo -E ./ci/setup_ci_environment.sh + - name: install dependencies + run: | + sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file third_party_release - name: run tests and generate report env: - CC: /usr/bin/gcc-10 - CXX: /usr/bin/g++-10 + CC: /usr/bin/gcc-13 + CXX: /usr/bin/g++-13 + OTELCPP_CMAKE_BUILD_ARGS: "--parallel 2" # Limit parallelism to avoid hitting runner limits run: ./ci/do_ci.sh code.coverage - name: upload report uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f6631ae1d..bf304f6681 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,15 @@ Increment the: * Enable ENABLE_OTLP_RETRY_PREVIEW for bazel [#4010](https://github.com/open-telemetry/opentelemetry-cpp/pull/4010) +* [CI] Build third-party dependencies in release with ninja + [#3995](https://github.com/open-telemetry/opentelemetry-cpp/pull/3995) + +* [CI] Update ci scripts and documentation + [#4000](https://github.com/open-telemetry/opentelemetry-cpp/pull/4000) + +* [CI] Update code.coverage job to report on all components and features + [#4002](https://github.com/open-telemetry/opentelemetry-cpp/pull/4002) + Important changes: * Enable WITH_OTLP_RETRY_PREVIEW by default diff --git a/ci/README.md b/ci/README.md index 8e03f24c12..afe04bb7ec 100644 --- a/ci/README.md +++ b/ci/README.md @@ -48,7 +48,7 @@ BUILD_DIR=$HOME/build BUILD_TYPE=Debug|Release|RelWithDebInfo|MinSizeRel CXX_STANDARD=14|17|20|23 BUILD_SHARED_LIBS=ON|OFF -OTELCPP_CMAKE_VERBOSE_BUILD=ON|OFF +OTELCPP_CMAKE_BUILD_ARGS= OTELCPP_CMAKE_CACHE_FILE= ``` @@ -56,6 +56,13 @@ OTELCPP_CMAKE_CACHE_FILE= `test_common/cmake`, for example `all-options-abiv1-preview.cmake` or `all-options-abiv2.cmake`. +`OTELCPP_CMAKE_BUILD_ARGS` overrides the default `cmake --build` arguments +(`--parallel`). For example, to limit parallelism and enable verbose output: + +```sh +OTELCPP_CMAKE_BUILD_ARGS="--parallel 2 --verbose" ./ci/do_ci.sh code.coverage +``` + ## Targets ### Formatting and coverage diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 4f48d6b68a..4686f68257 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -87,10 +87,10 @@ fi CMAKE_OPTIONS+=("-DCMAKE_CXX_STANDARD_REQUIRED=ON") CMAKE_OPTIONS+=("-DCMAKE_CXX_EXTENSIONS=OFF") -CMAKE_BUILD_ARGS=(--parallel) - -if [[ "${OTELCPP_CMAKE_VERBOSE_BUILD:-OFF}" =~ ^(1|ON|on|TRUE|true|YES|yes)$ ]]; then - CMAKE_BUILD_ARGS+=(--verbose) +if [ -n "${OTELCPP_CMAKE_BUILD_ARGS}" ]; then + read -ra CMAKE_BUILD_ARGS <<< "${OTELCPP_CMAKE_BUILD_ARGS}" +else + CMAKE_BUILD_ARGS=(--parallel) fi if command -v ninja >/dev/null 2>&1; then @@ -618,14 +618,29 @@ elif [[ "$1" == "code.coverage" ]]; then cd "${BUILD_DIR}" rm -rf * cmake "${CMAKE_OPTIONS[@]}" \ - -DCMAKE_CXX_FLAGS="-Werror --coverage $CXXFLAGS" \ + -DCMAKE_CXX_FLAGS="-Werror --coverage -fprofile-update=atomic $CXXFLAGS" \ + -C "${SRC_DIR}/test_common/cmake/all-options-abiv2-preview.cmake" \ + -DWITH_EXAMPLES=OFF \ + -DWITH_EXAMPLES_HTTP=OFF \ + -DWITH_BENCHMARK=OFF \ "${SRC_DIR}" + cmake --build . "${CMAKE_BUILD_ARGS[@]}" ctest --output-on-failure - lcov --directory $PWD --capture --output-file coverage.info - # removing test http server coverage from the total coverage. We don't use this server completely. - lcov --remove coverage.info '*/ext/http/server/*'> tmp_coverage.info 2>/dev/null - cp tmp_coverage.info coverage.info + + lcov --directory "$PWD" --capture \ + --include "${SRC_DIR}/*" \ + --exclude "${SRC_DIR}/third_party/*" \ + --exclude "${SRC_DIR}/test_common/*" \ + --exclude "${SRC_DIR}/*/test/*" \ + --exclude "${SRC_DIR}/functional/*" \ + --exclude "${SRC_DIR}/semconv/*" \ + --exclude "${SRC_DIR}/examples/*" \ + --ignore-errors unused \ + --output-file coverage.info + + echo "Code coverage output file generated at ${BUILD_DIR}/coverage.info. To generate an HTML report run:" + echo "genhtml ${BUILD_DIR}/coverage.info -o coverage_html" exit 0 fi