Skip to content

Commit 6ca7238

Browse files
authored
Create codecov.yml
1 parent 5c02361 commit 6ca7238

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/codecov.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Code Coverage
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
coverage:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Install Rust
18+
uses: actions-rs/toolchain@v1
19+
with:
20+
toolchain: stable
21+
components: llvm-tools-preview
22+
override: true
23+
24+
- name: Install grcov
25+
run: cargo install grcov
26+
27+
- name: Generate code coverage
28+
env:
29+
CARGO_INCREMENTAL: "0"
30+
RUSTFLAGS: "-Cinstrument-coverage"
31+
RUSTDOCFLAGS: "-Cinstrument-coverage"
32+
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
33+
run: |
34+
cargo test --workspace --all-targets
35+
grcov . \
36+
--binary-path ./target/debug/ \
37+
-s . \
38+
-t cobertura \
39+
--branch \
40+
--ignore-not-existing \
41+
--ignore "/*" \
42+
-o coverage.xml
43+
44+
- name: Upload coverage to Codecov
45+
uses: codecov/codecov-action@v3
46+
with:
47+
files: coverage.xml
48+
fail_ci_if_error: true

0 commit comments

Comments
 (0)