-
Notifications
You must be signed in to change notification settings - Fork 1
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 check to CI #78
Conversation
Setting the groundwork to add a coverage report to Cladetime. We'll want to run integration tests and unit tests at the same time to get a full report of test coverage, so do that (but not on every push).
The coverage job will fail if if code coverage is >= 80%
This doesn't give us an actual coverage percentage, but a successful workflow run does mean that coverage is at or above the stated minimum (in this case 80%, to match Hubverse standards).
This is a common pattern I've seen when looking at other python projects (and also, the workflow does more than run tests now)
uses: actions/download-artifact@v4 | ||
with: | ||
name: coverage | ||
merge-multiple: true |
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.
we're not expecting multiple coverage files yet (as we don't do any matrix-style testing), but leaving this here as a placeholder/nudge/reminder to
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.
cool! nice work. one typo found
.github/workflows/ci.yaml
Outdated
# Generate report again, this time with a fail-under threshold | ||
coverage report --fail-under=80 | ||
|
||
- name: Upload HTML report if coverage check faileds |
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.
typo
Resolves #43
Background
Thus far, Cladetime hasn't checked a test coverage metric as part of its CI process. This PR adds such a check, using a technique adopted from this writeup: https://hynek.me/articles/ditch-codecov-python/
Approach
The advantage of the above approach is that it doesn't require a third-party service such as codecov. At a high-level, the process looks like this:
Updates to the existing
run-checks
job:coverage
package to generate coverage metrics.coverage
) as a GitHub artifactNew coverage job:
Output
The coverage report is in the detailed output of the
CI / Generate Coverage Report
check below. A more human-readable output is in the action's summary: https://github.com/reichlab/cladetime/actions/runs/12588558317