binkley / modern-java-practices

Modern Java/JVM Build Practices
Other
933 stars 69 forks source link

Publish coverage reports for Gradle and Maven #457

Closed binkley closed 2 weeks ago

binkley commented 4 months ago

See epic #506. See epic #607.

PR needs revolving by pulling from master. Move to done when complete and in happy state. @binkley

Both Gradle and Maven produce coverage reports for unit testing (JaCoCo) and mutation testing (PITest). "Magically" the Maven JaCoCo reports shows up in the Actions build reports (https://github.com/binkley/modern-java-practices/actions/runs/10043381529). To add the same Action run coverage report, use the same badge coverage action configuration for the Gradle build.

Save these as build artifacts in GitHub CI pipeline actions, and research how to show these sensibly. Update the documentation to give advice on how to do this.

Notes

ONLY the Maven build actually creates a badge image for coverage, and commits it to the repo for the front page to display. To avoid file git conflicts as the Gradle and Maven builds run in parallel, the Maven build commits the image file. However, the Gradle run still shows a coverage summary on each Action run page without committing to git.

binkley commented 3 weeks ago

Coverage report for Gradle uploaded to CI build as an artifact. Image

binkley commented 3 weeks ago

The whitelist of what to copy out of the containerized build for GitHub was complicated and error prone.

binkley commented 2 weeks ago

Enabling the coverage badge generator is what makes the nice graphic on the Action run page:

Image

binkley commented 2 weeks ago

See https://github.com/cicirello/jacoco-badge-generator/issues/148 for improving the docs of the badge generator action.