Repository navigation
66 lines (58 loc) · 2.17 KB
/
Copy pathcode-coverage.yml
File metadata and controls
66 lines (58 loc) · 2.17 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
# *******************************************************************************
# 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: Test / Code Coverage (>=85)
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- main
merge_group:
types: [checks_requested]
jobs:
code-coverage:
runs-on: ubuntu-24.04
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Setup Bazel
uses: eclipse-score/cicd-actions/setup-bazel-cache@212bbf86267e9381da9d2daf962d12f6feafbc90 # v0.0.2
with:
unique-cache-name: ${{ github.workflow }}-${{ github.job }}
- name: Run coverage (LLVM source-based, @score_coverage)
run: |
set -euo pipefail
bazel coverage --lockfile_mode=error --config=llvm_cov \
//score/... --build_tests_only
- name: Generate coverage report and enforce threshold
env:
COVERAGE_THRESHOLD: "85"
run: |
set -euo pipefail
bazel run --lockfile_mode=error @score_coverage//:generate_coverage_html -- \
--testlogs-subdir score \
--archive-dir coverage_artifact \
--yaml tools/coverage/coverage_justifications.yaml
# upload-artifact zips its input itself; the script assembles an
# unzipped directory (--archive-dir) to avoid a zip inside a zip.
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}_coverage_report_cpp
path: coverage_artifact
retention-days: 10