Skip to content
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 code coverage tracking #366

Merged
merged 7 commits into from
Jul 14, 2024
Merged

👷 Add code coverage tracking #366

merged 7 commits into from
Jul 14, 2024

Conversation

JMicheli
Copy link
Collaborator

This is a redo of a previous pull request attempt that failed because I made it from a fork (#364). I have since closed the pull request, but its text is reproduced below:

This is a very simple pull request that adds CodeCov-based automated code coverage tracking. It will require some repository owner intervention to get fully functional.

I've added an action that runs cargo-llvm-cov. This runs all tests in release mode and generates lcov.info, which contains coverage data (NB: if you're using a coverage tracking extension then you can use visualize this file in your IDE, very helpful for designing tests).

The next action uploads this data to codecov.io, which offers free code coverage hosting for open source projects. To get this working, you'll need to create an account on that website and write the API token to the secrets.CODECOV_TOKEN variable. You'll also want to set up their GitHub app and give it permission to access this repository. Once that's done, there should be a handy little bot on each pull request that tracks coverage.

On that front, I've added a bot config file at .github/codecov.yml which currently sets no expectations (target: 0%). You can increase this percentage to set minimum coverage goals for the project, and I imagine that someday you will want to begin ratcheting it up to prevent regressions in coverage. A bot-initiated task tests coverage against this target on each pull request and can block merge if it's below target.

If you want, you can also copy the badge codecov gives you markdown code for into the readme for a live readout on the repo front page (or maybe wait to do that until the coverage is higher).

Finally, I've re-enabled running tests in the ci (though the integration tests do still need fixing). I think this is a good idea - I've noticed that two of the rar tests currently fail, which they did not when I wrote them. This is a regression that running tests before merge would have caught. I'm going to try and figure out why it's happening and fix it before this merges, because right now the ci should be blocking merge on account of this failing test.

@JMicheli JMicheli changed the title Add material from fork branch; make coverage conditional. 👷 Add code coverage tracking Jul 12, 2024
Copy link

codecov bot commented Jul 12, 2024

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

Copy link
Collaborator

@aaronleopold aaronleopold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@JMicheli JMicheli merged commit 5fa2695 into develop Jul 14, 2024
5 checks passed
@JMicheli JMicheli deleted the upgrade-ci branch July 14, 2024 04:48
@aaronleopold aaronleopold mentioned this pull request Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants