forked from eclipse-score/lifecycle
-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (126 loc) · 4.06 KB
/
code_coverage.yml
File metadata and controls
141 lines (126 loc) · 4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# *******************************************************************************
# 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: Code Coverage
on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- main
merge_group:
types: [checks_requested]
release:
types: [created]
jobs:
cpp:
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Install dependencies
uses: eclipse-score/apt-install@main
with:
packages: lcov fakechroot
cache: false
- 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/... //tests/...
- 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
- name: Upload test logs
if: always()
uses: actions/upload-artifact@v4
with:
name: bazel-testlogs-cpp
path: |
bazel-testlogs/**/test.xml
bazel-testlogs/**/test.log
retention-days: 10
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/...)')"
- 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
- name: Upload test logs
if: always()
uses: actions/upload-artifact@v4
with:
name: bazel-testlogs-rust
path: |
bazel-testlogs/**/test.xml
bazel-testlogs/**/test.log
retention-days: 10
merge-testlogs:
needs: [cpp, rust]
if: always()
runs-on: ubuntu-latest
steps:
- name: Merge test log artifacts
uses: actions/upload-artifact/merge@v4
with:
name: bazel-testlogs
pattern: bazel-testlogs-*
delete-merged: true
retention-days: 10