-
Notifications
You must be signed in to change notification settings - Fork 41
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
Update github workflow to upload test coverage reports #759
Conversation
@sea212 @lsaether Is it okay to use and sign up on https://docs.codecov.com/docs#step-1-sign-up-for-codecov ? I have no admin access to the repository to integrate Codecov.
|
Codecov Report
@@ Coverage Diff @@
## main #759 +/- ##
=======================================
Coverage ? 92.23%
=======================================
Files ? 80
Lines ? 14062
Branches ? 0
=======================================
Hits ? 12970
Misses ? 1092
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
It looks fine to me. I hope total turn around time is not increased much. Also I am wondering why grcov is used instead of llvm-cov. llvm-cov is available and it makes commands much simple with this cargo wrapper https://github.com/taiki-e/cargo-llvm-cov
however I am not able to find any comparison of grcov vs llvm-cov , only thing is that grcov is written in rust.
Just a dumb question: The report says 92.37% coverage. What exactly does that number mean? There seem to be two different workflows running, one for unit tests and one for fuzz tests, so I would have expected at least two numbers... right? Also, doesn't this number seem surprisingly high? Can we get a complete list of lines of code reached/not reached? |
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.
Does CodeCov still need access to our repository?
.github/workflows/rust.yml
Outdated
- name: Download grcov | ||
run: | | ||
mkdir -p "${HOME}/.local/bin" | ||
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.11/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin" | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH |
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.
Can we use the grcov GH action instead?
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 tried it. When running the grcov
github action it always returns the following error.
Error: Unable to find any coverage files, was `cargo test` executed correctly?
Although I executed cargo test
as step before the grcov
github action. I don't really know how to solve this.
In the example they use a github action for cargo test, but we use a script instead. But shouldn't be the result the same?
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 couldn't find an example for grcov GH action for source-based coverage.
.github/workflows/rust.yml
Outdated
- name: Upload to codecov.io | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: /misc/tests.lcov |
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.
Might want to use /tmp/tests.lcov instead to avoid potential permission issues.
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.
addressed in eb06f35
That's a good question. I don't really know. I would assume no, because Codecov could comment on this PR, so I think it has been already added by Logan. |
@maltekliemann I did use the I would assume, that we need codecov on
|
https://rust-fuzz.github.io/book/cargo-fuzz/coverage.html Fuzz test coverage is extremely slow with the current version. I don't know how to solve this. The fuzz coverage is outdated. Unfortunately I can't append my own compiler flags to get the result of code coverage for fuzz tests. rust-fuzz/cargo-fuzz#320 For the fuzz tests, the proposed way of When I run For the normal tests I think the result is reasonable. I know, that there are some bugs like you Malte found out, but I think it's the fault of the current Substrate environment. At least we can detect paths, which are not covered at all from the tests. That's useful. |
@@ -15,5 +15,6 @@ test_package_with_feature() { | |||
local features=$2 | |||
|
|||
/bin/echo -e "\e[0;33m***** Testing '$package' with features '$features' *****\e[0m\n" | |||
cargo test --features $features --manifest-path $package/Cargo.toml --no-default-features --release |
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.
We should avoid profile release for tests, so that debug_assert!
macros are activated and we can see, that something is not as expected.
https://doc.rust-lang.org/cargo/reference/profiles.html#release
I tried https://github.com/taiki-e/cargo-llvm-cov out @vivekvpandya . It had exactly the same result as we got with the current solution. Thanks for your investigation! I think it's fine as it is. With using |
We got a slightly better time for the current fuzz workflow. It's now |
Fixes #263.
https://blog.rust-lang.org/inside-rust/2020/11/12/source-based-code-coverage.html