Skip to content

Commit

Permalink
Add how to obtain test coverage reports to the README (#60)
Browse files Browse the repository at this point in the history
Co-authored-by: Supernovahs.eth <91280922+supernovahs@users.noreply.github.com>
  • Loading branch information
dralves and supernovahs authored Aug 1, 2024
1 parent 9873a72 commit 27df5ca
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
debug/
target/

coverage
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ List of crates in the repository :-
- [eigen-services](https://github.com/supernovahs/eigen-rs/tree/main/crates/services) - Spawn tokio services for operators info , bls aggregation
- [eigen-types](https://github.com/supernovahs/eigen-rs/tree/main/crates/types) - Common types
- [eigen-utils](https://github.com/supernovahs/eigen-rs/tree/main/crates/utils) - Publicly exportable `m2-mainnet` compatible alloy bindings.
- [eigen-testing-utils](https://github.com/supernovahs/eigen-rs/tree/main/testing/testing-utils) - Contains publicly exportable anvil , holesky , mainnet addresses for eigen contracts .
- [eigen-testing-utils](https://github.com/supernovahs/eigen-rs/tree/main/testing/testing-utils) - Contains publicly exportable anvil , holesky , mainnet addresses for eigen contracts .


## Examples

You can run any [example](https://github.com/supernovahs/eigen-rs/tree/main/examples) using the command cargo run --example <example-name>

Example :

```
cargo run --example get_quorum_count
```
Expand All @@ -36,12 +37,34 @@ We are actively looking for contributors. Thank you for your interest. We have s

To test locally and raise a PR :-

You need `foundry` , `docker` and `make` and `nightly rust` to successfully run it. Also, the `docker` engine has to be running for all the tests to execute correctly.

You need `foundry` , `docker` and `make` and `nightly rust` to successfully run it. Also, the `docker` engine has to be running for all the tests to execute correctly.
```
make pr
```

Test coverage should aim to be around 80%.

Here's how to generate test coverage reports:

Install llvm tools:
```
rustup component add llvm-tools-preview
```

Run the tests with coverage instrumentations:
```
cargo clean && mkdir -p coverage/ && rm -r coverage/*
CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='coverage/cargo-test-%p-%m.profraw' cargo test --no-fail-fast
```

Install coverage report tool and run it:
```
cargo install grcov
grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/
```

## Supported Rust Version

Rolling `MSRV` policy of 6 months. The current `MSRV` is 1.79
Expand Down

0 comments on commit 27df5ca

Please sign in to comment.