Skip to content

Commit ec2feb0

Browse files
committed
Add C++ coverage configuration and workflow
1 parent fe74ff3 commit ec2feb0

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-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: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
14+
name: Code Coverage
15+
on:
16+
pull_request:
17+
types: [opened, reopened, synchronize]
18+
push:
19+
branches:
20+
- main
21+
merge_group:
22+
types: [checks_requested]
23+
24+
jobs:
25+
coverage-report:
26+
runs-on: ubuntu-22.04
27+
28+
permissions:
29+
contents: read
30+
31+
steps:
32+
- name: Checkout Repository
33+
uses: actions/checkout@v6
34+
35+
- name: Install lcov
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y lcov
39+
40+
- name: Setup Bazel
41+
uses: bazel-contrib/[email protected]
42+
with:
43+
bazelisk-cache: true
44+
disk-cache: ${{ github.workflow }}
45+
repository-cache: true
46+
cache-save: ${{ github.event_name != 'pull_request' }}
47+
48+
- name: Run Bazel Coverage
49+
run: |
50+
bazel coverage --config=bl-x86_64-linux -- //score/... \
51+
-//score/language/safecpp/aborts_upon_exception:abortsuponexception_toolchain_test
52+
53+
- name: Generate HTML Coverage Report
54+
run: |
55+
genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat" \
56+
-o=cpp_coverage \
57+
--show-details \
58+
--legend \
59+
--function-coverage \
60+
--branch-coverage
61+
shell: bash
62+
63+
- name: Upload Coverage Artifacts
64+
uses: actions/upload-artifact@v6
65+
with:
66+
name: ${{ github.event.repository.name }}_coverage_report
67+
path: cpp_coverage/

0 commit comments

Comments
 (0)