MetOffice / dagrunner

⛔[EXPERIMENTAL] Directed acyclic graph (DAG) runner and tools
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

CI: Test coverage reporting #38

Closed cpelley closed 2 months ago

cpelley commented 2 months ago

Avoid the pitfalls of another library that dagrunner sets to replace. Mainly, that we don't end up with poor test coverage down the line. To that end, it would be ideal if we could utilise a single approach that could be used irrespective to whether our repository is public or private.

To that end, we avoid the use of external services such as codecov.

Here, we run test coverage on both the PR and base branch (main, if it hasn't run against the SHA of the base before). We then compare their total percentage test coverage and if the PR results in a total percentage reduction in coverage of greater than 1% (roundup tolerances), comment on the PR to draw attention to this reduction.

Issues

Testing

Demonstrated by the inclusion of a dummy python dummy module to expose the change in coverage (see comment: https://github.com/MetOffice/dagrunner/pull/38#issuecomment-2203166049) image

To look at the full report, simply download the uploaded artefact. For example, for the job/26943990384 job run

We can see the text summary has been recorded alongside a html report:

We can open the html report with our browser by opening the index.html:

We then have total control to analyse our coverage report, take for example when we click on the execute_graph.py module:

Note

Obviously we can add as much coverage drop context as we wish to the PR comment, but I have opted for keeping it minimal and to the point (at least in the first instance).

github-actions[bot] commented 2 months ago

The test coverage has decreased from '81%' to '71%' (commit SHA: 4bf3841f9235fa7f2b649687d72423af6d1a11cf). Please review test coverage. Report uploaded as artifact.

cpelley commented 2 months ago

Another one of likely interest to you @s-boardman for StaGE. This enabled test coverage reporting without the usage of external services. This means we can use whether our repository is public or private. Obviously one can enhance the comment indicating coverage (I just did basic working concept for this PR).