|
| 1 | +# ******************************************************************************* |
| 2 | +# Copyright (c) 2026 Contributors to the Eclipse Foundation |
| 3 | +# |
| 4 | +# See the NOTICE file(s) distributed with this work for additional |
| 5 | +# information regarding copyright ownership. |
| 6 | +# |
| 7 | +# This program and the accompanying materials are made available under the |
| 8 | +# terms of the Apache License Version 2.0 which is available at |
| 9 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# SPDX-License-Identifier: Apache-2.0 |
| 12 | +# ******************************************************************************* |
| 13 | +name: Code Coverage |
| 14 | +on: |
| 15 | + pull_request: |
| 16 | + types: [opened, reopened, synchronize] |
| 17 | + push: |
| 18 | + branches: |
| 19 | + - main |
| 20 | + merge_group: |
| 21 | + types: [checks_requested] |
| 22 | +jobs: |
| 23 | + coverage-report: |
| 24 | + runs-on: ubuntu-22.04 |
| 25 | + permissions: |
| 26 | + contents: read |
| 27 | + steps: |
| 28 | + - name: Checkout Repository |
| 29 | + uses: actions/checkout@v6 |
| 30 | + - name: Install lcov |
| 31 | + run: | |
| 32 | + sudo apt-get update |
| 33 | + sudo apt-get install -y lcov |
| 34 | + - name: Setup Bazel |
| 35 | + uses: bazel-contrib/[email protected] |
| 36 | + with: |
| 37 | + bazelisk-cache: true |
| 38 | + disk-cache: ${{ github.workflow }} |
| 39 | + repository-cache: true |
| 40 | + cache-save: ${{ github.event_name != 'pull_request' }} |
| 41 | + - name: Run Bazel Coverage |
| 42 | + run: | |
| 43 | + bazel coverage --config=bl-x86_64-linux -- //score/... \ |
| 44 | + -//score/language/safecpp/aborts_upon_exception:abortsuponexception_toolchain_test |
| 45 | + - name: Generate HTML Coverage Report |
| 46 | + run: | |
| 47 | + genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat" \ |
| 48 | + -o=cpp_coverage \ |
| 49 | + --show-details \ |
| 50 | + --legend \ |
| 51 | + --function-coverage \ |
| 52 | + --branch-coverage |
| 53 | + shell: bash |
| 54 | + - name: Upload Coverage Artifacts |
| 55 | + uses: actions/upload-artifact@v6 |
| 56 | + with: |
| 57 | + name: ${{ github.event.repository.name }}_coverage_report |
| 58 | + path: cpp_coverage/ |
| 59 | + retention-days: 30 |
0 commit comments