diff --git a/.bazelrc b/.bazelrc index 7bd1a8d..aaf9466 100644 --- a/.bazelrc +++ b/.bazelrc @@ -73,17 +73,12 @@ build:x86_64-linux --extra_toolchains=@score_toolchains_rust//toolchains/ferroce -# With this instrumentation filter for our two main components, we ensure that `bazel coverage //...` is yielding the correct results +# Coverage configuration for C++ coverage --config=x86_64-linux coverage --instrumentation_filter="^//score/datarouter[/:],^//score/mw/log[/:],-//score/mw/.*/test[/:]" -coverage --experimental_generate_llvm_lcov -coverage --experimental_use_llvm_covmap + +# GCC-based coverage configuration coverage --combined_report=lcov -coverage --coverage_report_generator=@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main coverage --test_env=COVERAGE_GCOV_OPTIONS=-bcu -# TODO set toolchain feature once possible -# These compile time options are required to cover abnormal termination cases. In GCC one can use `__gcc_dump()`, but this does not work with LLVM -# LLVM provided these compile-time options in combination with a specific profile setting which is enabled in bazel via `LLVM_PROFILE_CONTINUOUS_MODE` -coverage --test_env=LLVM_PROFILE_CONTINUOUS_MODE=1 -coverage --cxxopt -mllvm -coverage --cxxopt -runtime-counter-relocation +coverage --features=coverage +coverage --cache_test_results=no diff --git a/.github/workflows/coverage_report.yml b/.github/workflows/coverage_report.yml new file mode 100644 index 0000000..95d37cd --- /dev/null +++ b/.github/workflows/coverage_report.yml @@ -0,0 +1,29 @@ +# ******************************************************************************* +# Copyright (c) 2026 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +name: CPP/C++ + +on: + pull_request: + types: [opened, reopened, synchronize] + push: + branches: + - main + merge_group: + types: [checks_requested] + +jobs: + coverage-report: + uses: eclipse-score/cicd-workflows/.github/workflows/cpp-coverage.yml@main + with: + bazel-target: "//..." diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index c17fb8c..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,42 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -name: Bazel Tests - -on: - pull_request: - types: [opened, reopened, synchronize] - merge_group: - types: [checks_requested] -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -jobs: - setup-and-run-tests: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4.2.2 - - - name: Setup Bazel with shared caching - uses: bazel-contrib/setup-bazel@0.15.0 - with: - bazelisk-version: 1.26.0 - disk-cache: true - repository-cache: true - bazelisk-cache: true - - - name: Run Tests via Bazel - run: | - echo "Running: bazel test //score/..." - bazel test --config x86_64-linux //score/...