forked from bytedance/sonic-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (76 loc) · 2.27 KB
/
Copy pathtest_coverage.yml
File metadata and controls
90 lines (76 loc) · 2.27 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
# yaml-language-server: $schema=https://json-schema.org/draft-07/schema#
name: Test Coverage
permissions:
contents: read
actions: write
id-token: write
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
push:
branches: [ master ]
pull_request:
jobs:
test-coverage:
name: bazel coverage
runs-on: ubuntu-24.04
timeout-minutes: 60
env:
GCC_VERSION: 12
steps:
- name: Checkout codebase
uses: actions/checkout@v4
- name: Read Bazel version
run: |
echo "BAZEL_VERSION=$(cat .bazelversion)" >> "$GITHUB_ENV"
- name: Cache Bazel
uses: actions/cache@v4
with:
path: |
~/.cache/bazel
~/.cache/bazelisk
key: ${{ runner.os }}-bazel-${{ env.BAZEL_VERSION }}-${{ hashFiles('MODULE.bazel.lock', 'WORKSPACE.bzlmod', 'BUILD.bazel') }}
restore-keys: |
${{ runner.os }}-bazel-${{ env.BAZEL_VERSION }}-
${{ runner.os }}-bazel-
- name: Setup bazel
uses: jwlawson/actions-setup-bazel@v2
with:
bazel-version: "${{ env.BAZEL_VERSION }}"
- name: Setup GCC
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends gcc-12 g++-12
- name: Install lcov
run: |
sudo apt-get install -y --no-install-recommends lcov
- name: Coverage
run: |
bash ./scripts/run_coverage.sh
genhtml --output bazel-coverage-html ./coverage.dat
- name: upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage
path: |
bazel-coverage-html
coverage.dat
- name: Upload pull request coverage to CodeCov
if: github.event_name == 'pull_request'
uses: codecov/codecov-action@v4
with:
files: coverage.dat
verbose: true
fail_ci_if_error: true
- name: Upload push coverage to CodeCov
if: github.event_name == 'push'
uses: codecov/codecov-action@v4
with:
use_oidc: true
files: coverage.dat
verbose: true
fail_ci_if_error: true