Skip to content

Commit

Permalink
Add code coverage (#13)
Browse files Browse the repository at this point in the history
* Add code coverage

* Rerun CI

* Use v3

* Use codecov token

* Fix cargo-tarpaulin proc-macro issue

---------

Co-authored-by: Michael Sproul <[email protected]>
  • Loading branch information
macladson and michaelsproul authored Jul 8, 2024
1 parent b710ad9 commit d172c48
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,19 @@ jobs:
run: cargo test --release
- name: Check all examples, binaries, etc
run: cargo check --all-targets
coverage:
runs-on: ubuntu-latest
name: cargo-tarpaulin
steps:
- uses: actions/checkout@v3
- name: Get latest version of stable Rust
run: rustup update stable
- name: Install cargo-tarpaulin
uses: taiki-e/install-action@cargo-tarpaulin
- name: Check code coverage with cargo-tarpaulin
run: make coverage
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Cargo.lock
target
cobertura.xml
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# These hacks are required for the test binaries depending on the dynamic library libstd-*.so
# See: https://github.com/rust-lang/cargo/issues/4651
coverage:
env LD_LIBRARY_PATH="$(shell rustc --print sysroot)/lib" \
cargo-tarpaulin --workspace --all-features --out xml

.PHONY: coverage

0 comments on commit d172c48

Please sign in to comment.