-
Notifications
You must be signed in to change notification settings - Fork 73
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
Covbadge #370
Covbadge #370
Conversation
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.
Looking good so far. Not sure why the tests are failing... Seems to be some Jinja error, see my comment for a possible culprit.
A possible solution would be to do a separate workflow for coverage. For that workflow, you can just run for one Python version (the newest, probably). The other build jobs can then just run without coverage, like before. I don't think this setup is currently integrating coverage reports from different Python versions anyway, right? So they are redundant.
@@ -11,13 +11,12 @@ | |||
| (5/5) checklist | [![workflow cii badge](https://bestpractices.coreinfrastructure.org/projects/<replace-with-created-project-identifier>/badge)](https://bestpractices.coreinfrastructure.org/projects/<replace-with-created-project-identifier>) | | |||
| howfairis | [![fair-software badge](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow)](https://fair-software.eu) | | |||
| **Other best practices** | | | |||
| Static analysis | [![workflow scq badge](https://sonarcloud.io/api/project_badges/measure?project={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}&metric=alert_status)](https://sonarcloud.io/dashboard?id={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}) | | |||
| Coverage | [![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}&metric=coverage)](https://sonarcloud.io/dashboard?id={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}) | | |||
<!-- TODO --> |
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.
Maybe make an issue for this. We could also keep SonarCloud for static analysis, but maybe you or others have other ideas?
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.
Or is the TODO a message for the user of the template to change the Coverage badge URL?
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's more for myself, the user would still need to put their gist id here. I'm not sure yet how to best do that the cookiecutter way.
coverage report >> $GITHUB_STEP_SUMMARY | ||
echo $'\n```' >> $GITHUB_STEP_SUMMARY | ||
- name: Make coverage badge | ||
if: ${{ github.ref == 'refs/heads/main' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' }} |
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 suspect this is what's tripping up Jinja in the failing tests. Try taking the &&
s out. It probably recognizes this as a Jinja expression and cannot deal with &
s apparently.
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.
Thanks, that makes sense. I didn't immediately recognize these could be jinja2 templates.
Thanks for taking the time for this! Before putting more effort in, though, let's finish the discussion in #369 that @bouweandela started. |
Description
This PR adds a workflow based on coverage.py and gists to generate a coverage badge. The advantage of this is that no third party service is needed.
Closes #369
Instructions to review the pull request
Create a
python-template-test
repo on GitHub (will be overwritten if existing)