-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add coverage workflow #1217
Add coverage workflow #1217
Conversation
I think we can definitely not run this on every PR. I'm trying to run it locally but it's taking ages. For the CI to work we need to either run it with nix (then you get all the dependencies) or install some missing dependencies (at least foundry). |
I have these two tests failing locally
Fails at
If we're lucky it's just a timing issue and we can retry. |
If I run them individually with this coverage configuration they both pass relatively quickly (about 10s) but running together they take 100 seconds. 🤔 |
Hotshot actually runs the coverage workflow with tokio, not async_std. |
Yes, I've tried both w/out success. I'm just trying things 🤞 |
@tbro roughly how long does it take for you when you run this locally? The test |
flake.nix
Outdated
@@ -253,6 +254,28 @@ | |||
]; | |||
inherit RUST_LOG RUST_BACKTRACE RUSTFLAGS CARGO_TARGET_DIR; | |||
}; | |||
devShells.coverage = | |||
let | |||
toolchain = pkgs.rust-bin.nightly.latest.minimal.override { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be the same as just pkgs.rust-bin.nightly.latest.minimal
without override.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed 5011948
justfile
Outdated
echo "Running code coverage" | ||
nix develop .#coverage -c cargo test --all-features --no-fail-fast --release --workspace -- --skip service::test::test_ | ||
grcov . -s . --binary-path $CARGO_TARGET_DIR/debug/ -t html --branch --ignore-not-existing -o $CARGO_TARGET_DIR/coverage/ | ||
open $CARGO_TARGET_DIR/coverage/index.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only have xdg-open
😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shoot I thought I had found a command that would work across linux/mac. In that case I think its probably better to just output a message containing the location of the HTML, and the caller can open it as they like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed 407d66b
c49472c
to
49cafc3
Compare
Hopefully last request. Can we add a coverage badge to the readme? |
Should do the trick |
I haven't timed it yet, but it does complete which is more than it used to do. The |
real 22m7.089s |
added the badge in 49cafc3 |
Adds coverage.yaml and ads coverage shell to flake. also adds code-coverage command to justfile. NOTE: for rational of `-Cdebuginfo=2` see: rust-lang/rust#72974 Closes #683
5a790ff
to
e6eccc3
Compare
The bindings files are auto generated and the contracts directory only contains rust code to test the smart contracts.
@tbro I added ignoring of files in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🥳
Adds coverage.yaml and ads coverage shell to flake. also addes code-coverage command to
justfile
.Closes #683