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

[Question]: How to get the badge of actual coverage? #28

Open
3 tasks done
kmwagnera opened this issue Oct 2, 2023 · 3 comments
Open
3 tasks done

[Question]: How to get the badge of actual coverage? #28

kmwagnera opened this issue Oct 2, 2023 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@kmwagnera
Copy link

What is your question?

Hello,
do you have a example how to show the actual test coverage as badge in the top of the README?
Thank you!

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.
@kmwagnera kmwagnera added the question Further information is requested label Oct 2, 2023
@cicdguy
Copy link
Contributor

cicdguy commented Oct 2, 2023

Hi! Thanks for the question.

You can add the following markdown badge to show the code coverage in your repo:

![Code Coverage](https://raw.githubusercontent.com/$OWNER/$REPO/_xml_coverage_reports/data/main/badge.svg)

Make sure to substitute $OWNER and $REPO above with your organization/username and repository name respectively.

Also, main can be replaced with the whichever branch that you want to display the coverage badge for. For instance, if your coverage report has been generated for the master branch, then the raw URL would be:

https://raw.githubusercontent.com/$OWNER/$REPO/_xml_coverage_reports/data/master/badge.svg


As an example, for the {tern} project, the badge would look like this:

Code Coverage

Hope this helps!

@kmwagnera
Copy link
Author

kmwagnera commented Oct 3, 2023

Hi,
thank you for your answer I tested it and had to adjust it a little bit, but than it works!
![Code Coverage](https://github.com/$OWNER/$REPO/blob/_xml_coverage_reports/data/main/badge.svg)

Is it possible to change the text of the badge? "Test Coverage"
We use multiple projects in one repo. so we would like to have for example three different badges

  • Test Project1 95%
  • Test Project 2 82%
  • ...

And is it possible to calculate one badge for all available projects of the repo.?

  • Test Overall 88,5%

Thank you!

@cicdguy
Copy link
Contributor

cicdguy commented Oct 3, 2023

Is it possible to change the text of the badge? "Test Coverage"

Yes, but it'll have to be a new feature. We don't currently support this. Do you mind logging in a feature request for this?

And is it possible to calculate one badge for all available projects of the repo.?

Not at the moment. You might need multiple invocations of this action in your workflow and a post-step to combine them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants