- 
                Notifications
    You must be signed in to change notification settings 
- Fork 8
ci: Add coverage.yml workflow #9
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
Conversation
| - name: Make coverage directory | ||
| run: mkdir coverage | ||
| - name: Run grcov | ||
| run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore '/*' --ignore '**/tests/**' --ignore '**/examples/**' -o ./coverage/lcov.info | 
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.
Do you have in mind a second use of the lcov.info file other than source it to genhtml? Why not using -t 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.
Giving a second look at this, I think lcov.info may be useful to generate diffs between master and the merging branch, but I've not found a good tool to display reports from these diffs.
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.
Also, I would remove the --branch flag. I don't know if your are getting any results there, but from my experience the matching column for those is usually 0/0, so not giving useful information. It seems to be not supported actually: mozilla/grcov#520
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 have been testing grcov for bdk-sp and explored different combinations of flag to get the most of coverage reports:
- --excl-start "#\[cfg\(test\)\]": In all the- bdkrepositories I have seen unit test are placed at the end of files, and not in the middle like some projects (correct me if I'm wrong). So I think this flag is useful in this case. I wouldn't use- --excl-br-line "^\s*#\[cfg\(test\)\].*"for these cases because I've experimented with it, and it ignores all- #[test]tagged functions, but the utility functions inside the test module are not ignored, altering the final report numbers.
- --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()": In this case I'm not so sure about the- debug_assertand- assertvariations, as it may be used in some parts of the target code with actual implications in main logic of the program, but I don't have much of these in the code I have been using to test. In the case of- deriveI think is useful to exclude them in the case of default derivations. That code is boilerplate and cannot unless implemented manually, in which case the lines will be considered by the coverage report.
- --excl-line "^\s*\S+\s*(=>)?\s*unreachable!.*": I have some actually legit cases to use- unreachable, so as long as the macro is not used lightly, I think is a good way to improve the signal of the report.
| After adding docstrings to  | 
| Thank you @nymius I'll do some more research on cargo-llvm-cov. | 
A recent CI run can be found here https://github.com/bitcoindevkit/bdk-tx/actions/runs/15537664175/job/43740556358.