From 2908a8d3629cb4ea1f1e6a319610e9a99c905605 Mon Sep 17 00:00:00 2001 From: Piotr Korkus Date: Tue, 3 Mar 2026 14:29:23 +0100 Subject: [PATCH] cicd: use common workflows for coverage --- .github/workflows/code_coverage.yml | 95 +++++------------------------ 1 file changed, 16 insertions(+), 79 deletions(-) diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml index e237dbc7..2eb1979a 100644 --- a/.github/workflows/code_coverage.yml +++ b/.github/workflows/code_coverage.yml @@ -24,83 +24,20 @@ on: jobs: cpp: - runs-on: ubuntu-22.04 - steps: - - name: Checkout Repository - uses: actions/checkout@v6 - - - name: Install lcov - run: | - sudo apt-get update - sudo apt-get install -y lcov - - - name: Setup Bazel - uses: bazel-contrib/setup-bazel@0.18.0 - with: - bazelisk-cache: true - disk-cache: ${{ github.workflow }}-${{ github.job }} - repository-cache: true - cache-save: ${{ github.event_name == 'push' }} - - - name: Run Bazel Coverage - run: | - bazel coverage \ - --test_output=errors \ - --nocache_test_results \ - --config=x86_64-linux \ - //src/... - - - name: Generate HTML Coverage Report - shell: bash - run: | - genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat" \ - -o=cpp_coverage \ - --show-details \ - --legend \ - --function-coverage \ - --branch-coverage - - - name: Upload Coverage Artifacts - uses: actions/upload-artifact@v6 - with: - name: ${{ github.event.repository.name }}_cpp_coverage_report - path: cpp_coverage/ - retention-days: 10 + uses: eclipse-score/cicd-workflows/.github/workflows/cpp-coverage.yml@main + with: + bazel-target: "//src/..." + bazel-config: "x86_64-linux" + extra-bazel-flags: "--test_output=errors --nocache_test_results" + artifact-name-suffix: "_cpp" + retention-days: 10 + min-coverage: 76 rust: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v6 - - - name: Setup Bazel - uses: bazel-contrib/setup-bazel@0.18.0 - with: - bazelisk-cache: true - disk-cache: ${{ github.workflow }}-${{ github.job }} - repository-cache: true - cache-save: ${{ github.event_name == 'push' }} - - - name: Run Rust tests with coverage instrumentation - run: | - set -euo pipefail - bazel test \ - --config=x86_64-linux \ - --config=ferrocene-coverage \ - --nocache_test_results \ - $(bazel query 'kind(rust_test, //src/...) except attr("tags", "loom", //src/...)') - - - name: Generate Ferrocene coverage reports - run: | - set -euo pipefail - bazel run //:rust_coverage -- --min-line-coverage 66 - - - name: Locate coverage artifacts - run: | - echo "COVERAGE_DIR=$(bazel info bazel-bin)/coverage/rust-tests" >> "${GITHUB_ENV}" - - - name: Upload coverage HTML - uses: actions/upload-artifact@v4 - with: - name: ${{ github.event.repository.name }}_rust_coverage_report - path: ${{ env.COVERAGE_DIR }} - retention-days: 10 + uses: eclipse-score/cicd-workflows/.github/workflows/rust-coverage.yml@main + with: + bazel-test-targets: "//src/..." + bazel-test-config-flags: "--config=x86_64-linux --config=ferrocene-coverage" + bazel-test-args: "--test_output=errors --nocache_test_results" + coverage-target: "//:rust_coverage" + coverage-artifact-name: "rust-coverage-html" + min-coverage: 93