Skip to content

Commit 3842af1

Browse files
committed
ci: add coverage.yml workflow
1 parent f071ce3 commit 3842af1

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Code Coverage
2+
3+
on:
4+
push:
5+
branches: [ "develop" ]
6+
pull_request:
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
coverage:
13+
name: Code Coverage
14+
runs-on: ubuntu-latest
15+
env:
16+
RUSTFLAGS: "-Cinstrument-coverage"
17+
RUSTDOCFLAGS: "-Cinstrument-coverage"
18+
LLVM_PROFILE_FILE: "./target/coverage/%p-%m.profraw"
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
persist-credentials: false
25+
- name: Install Rust toolchain
26+
uses: dtolnay/rust-toolchain@v1
27+
with:
28+
toolchain: stable
29+
components: llvm-tools-preview
30+
- name: Rust Cache
31+
uses: Swatinem/rust-cache@v2.7.8
32+
- name: Install grcov
33+
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi
34+
- name: Test
35+
run: cargo test --all-features
36+
- name: Run grcov
37+
run: grcov . --binary-path ./target/debug/ -s . -t markdown --ignore-not-existing --excl-start "#\[cfg\(test\)\]" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()" --excl-line "^\s*\S+\s*(=>)?\s*unreachable!.*" --ignore="**/example-crates/*" --ignore="**/tests/*" --ignore '/*' --ignore '**/examples/*'

0 commit comments

Comments
 (0)