Skip to content

Commit f3ff757

Browse files
committed
Added code coverage checks
1 parent 5771b95 commit f3ff757

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/cargo-build-and-test.yaml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,27 @@ jobs:
1616
- uses: actions-rs/toolchain@v1
1717
with:
1818
toolchain: stable
19+
target: x86_64-unknown-linux-musl
1920
override: true
21+
components: llvm-tools-preview
22+
- name: Download grcov
23+
run: |
24+
mkdir -p "${HOME}/.local/bin"
25+
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin"
26+
echo "$HOME/.local/bin" >> $GITHUB_PATH
2027
- uses: actions-rs/cargo@v1
2128
name: cargo update
2229
with:
2330
command: update
24-
- uses: actions-rs/cargo@v1
25-
name: cargo test
31+
- name: cargo test
32+
run: |
33+
CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='cargo-test-%p-%m.profraw' cargo test
34+
grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/tests.lcov
35+
- name: Check test coverage
36+
uses: terencetcf/github-actions-lcov-minimum-coverage-checker@v1
2637
with:
27-
command: test
38+
coverage-file: ./target/coverage/tests.lcov
39+
minimum-coverage: 90
2840

2941
publish_to_crates_io:
3042
name: "Publish to crates.io"

0 commit comments

Comments
 (0)