Skip to content

Commit

Permalink
chore: add coverage badge and script
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinGimbel committed Apr 25, 2023
1 parent 273495d commit f8cb654
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
> Markdown Table of Content generator
![](https://github.com/kevingimbel/mktoc/workflows/Clippy%20check/badge.svg)
![Coverage](assets/coverage/flat.svg)

# Table of Contents
<!-- BEGIN mktoc {"min_depth":2} -->

- [About](#about)
- [Installation](#installation)
- [Cargo](#cargo)
Expand Down
23 changes: 23 additions & 0 deletions assets/coverage/flat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions helpers/coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
export LLVM_PROFILE_FILE="fd-%p-%m.profraw"
export RUSTFLAGS="-Cinstrument-coverage"

# build project
cargo build

# run tests to create the profraw files needed by grcov
cargo test

# run grcov with "defaults", this is straight up taken from their README
grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage/

# copy badge to asset directory
cp target/debug/coverage/badges/flat.svg assets/coverage

# cleanup
rm ./*.profraw

0 comments on commit f8cb654

Please sign in to comment.