Skip to content

Commit 1d729f0

Browse files
committed
Add C++ coverage configuration and workflow
1 parent efc0613 commit 1d729f0

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

.bazelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,8 @@ build:bl-aarch64-qnx --incompatible_strict_action_env
6363
build:bl-aarch64-qnx --platforms=@score_bazel_platforms//:aarch64-qnx-sdp_8.0.0-posix
6464
build:bl-aarch64-qnx --extra_toolchains=@score_qcc_aarch64_toolchain//:aarch64-qnx-sdp_8.0.0-posix
6565
test:bl-aarch64-qnx --config=bl_common
66+
67+
# Coverage configuration for C++
68+
coverage --features=coverage
69+
coverage --combined_report=lcov
70+
coverage --cache_test_results=no
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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

Comments
 (0)