Skip to content

Commit 1284f5e

Browse files
authored
Merge pull request #12 from cryptape/feature/coverage
Coverage Workflow
2 parents 44b6f7f + 38e59d6 commit 1284f5e

File tree

3 files changed

+452
-401
lines changed

3 files changed

+452
-401
lines changed

.github/workflows/cov.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches: [ "main", "develop" ]
6+
pull_request:
7+
branches: [ "main", "develop" ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
unit-tests-coverage:
14+
name: Unit Tests Coverage
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions-rs/toolchain@v1
20+
with:
21+
toolchain: nightly
22+
override: true
23+
- name: Install deps
24+
run: |
25+
rustup component add llvm-tools-preview
26+
grcov --version || cargo install --locked grcov
27+
- name: Run tests
28+
run: |
29+
rm -rf target/coverage
30+
mkdir -p target/coverage
31+
cargo test --verbose
32+
env:
33+
CARGO_INCREMENTAL: '0'
34+
RUSTFLAGS: '-Cinstrument-coverage'
35+
RUSTDOCFLAGS: '-Cinstrument-coverage'
36+
LLVM_PROFILE_FILE: 'target/coverage/unittests-%p-%m.profraw'
37+
- name: Collect Report
38+
run: |
39+
grcov target/coverage --binary-path "target/debug/" \
40+
-s src -t lcov --branch --ignore-not-existing \
41+
--ignore "*/tests/*" \
42+
--ignore "*/tests.rs" \
43+
-o coverage-report.info
44+
- name: Codecov
45+
uses: codecov/codecov-action@v5
46+
env:
47+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
48+
with:
49+
# Repository upload token - get it from codecov.io. Required only for private repositories
50+
# token: # optional
51+
# Specify whether the Codecov output should be verbose
52+
verbose: true
53+
fail_ci_if_error: true

0 commit comments

Comments
 (0)