-
-
Notifications
You must be signed in to change notification settings - Fork 159
60 lines (47 loc) · 1.52 KB
/
Copy pathcode_coverage.yml
File metadata and controls
60 lines (47 loc) · 1.52 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
name: Code Coverage
# Generates code coverage reports using cargo-llvm-cov and uploads results to Codecov.
# Uploads coverage data to Codecov for tracking and produces an HTML report artifact for download.
on:
push:
branches: [ master ]
paths:
- '**/*.rs'
- '.github/workflows/code_coverage.yml'
pull_request:
branches: [ master ]
paths:
- '**/*.rs'
- '.github/workflows/code_coverage.yml'
permissions:
contents: read
pull-requests: write
jobs:
Coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- run: rustup toolchain install stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.8
- name: Install deps
run: sudo apt update && sudo apt install -y libdbus-1-dev pkg-config
- name: Install cargo-llvm-cov
run: cargo +stable install cargo-llvm-cov
- name: Generate HTML coverage report
run: cargo +stable llvm-cov --all-features --workspace --html
- name: Generate coverage data
run: cargo +stable llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: coverage-report
path: target/llvm-cov/html
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: lcov.info
flags: rust
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true