Skip to content

Commit d9ab69a

Browse files
committed
ci: new coverage workflow only for push event
The current ones only work for PRs.
1 parent f4ce2a6 commit d9ab69a

File tree

3 files changed

+57
-4
lines changed

3 files changed

+57
-4
lines changed

.github/workflows/coverage.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
coverage:
13+
name: Generate and Upload Coverage Report
14+
environment: coverage
15+
runs-on: ubuntu-latest
16+
env:
17+
CARGO_INCREMENTAL: "0"
18+
RUSTFLAGS: "-Cinstrument-coverage"
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Install LLVM tools
25+
run: sudo apt-get update && sudo apt-get install -y llvm
26+
27+
- id: setup
28+
name: Setup Toolchain
29+
uses: dtolnay/rust-toolchain@nightly
30+
with:
31+
toolchain: nightly
32+
components: llvm-tools-preview
33+
34+
- id: cache
35+
name: Enable Workflow Cache
36+
uses: Swatinem/rust-cache@v2
37+
38+
- id: tools
39+
name: Install Tools
40+
uses: taiki-e/install-action@v2
41+
with:
42+
tool: grcov,cargo-llvm-cov
43+
44+
- id: coverage
45+
name: Generate Coverage Report
46+
run: |
47+
cargo test
48+
cargo llvm-cov --lcov --output-path=./lcov.info
49+
50+
- name: Upload coverage to Codecov
51+
uses: codecov/codecov-action@v5
52+
with:
53+
verbose: true
54+
token: ${{ secrets.CODECOV_TOKEN }}
55+
files: ${{ github.workspace }}/lcov.info
56+
fail_ci_if_error: true

.github/workflows/generate_coverage_pr.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: Generate Coverage Report (PR)
22

33
on:
4-
push:
5-
branches:
6-
- develop
74
pull_request:
85
branches:
96
- develop

.github/workflows/upload_coverage_pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
path: repo_root
103103

104104
- name: Upload coverage to Codecov
105-
uses: codecov/codecov-action@v4
105+
uses: codecov/codecov-action@v5
106106
with:
107107
verbose: true
108108
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)