Integrate Coveralls with .Net Core to display badge in GitHub README
Today, I want to know code coverage about my dot net project, and also want to check it in GitHub directly.
I try to use
Coveralls to get code coverage.
Install Nuget packages
dotnet add package coverlet.collector
dotnet add package coverlet.msbuild
Register in Coveralls.io
Sign up with GitHub account to link GitHub repositories with coveralls.io.
After login, add the repository that you need and click
Modify Actions yaml file
Add a step for generate coverage report in yaml file after run test
You don’t need to create
GITHUB_TOKENsecret, because GitHub automatically create it at the start of each workflow run.
Could check GitHub Docs to get more information.
Push code and yaml file to GitHub
Get code coverage badge for README
Coveralls.io and choose
REPOS in menu bar.
Embed drop down list and copy
Finally, past it to README
Unfortunately, it isn’t updated immediately because of browser cache.
Need to clear browser cache, after the action complete.