binkley / modern-java-practices

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

Add dashboard and reports #607

Open binkley opened 1 month ago

binkley commented 1 month ago

This card broken out from #506. Related to #457.

Current plugins needing configuration, and YML build needs to save more artifacts and/or reports for Action runs:

The general pattern for plugin reports:

  1. Are reports HTML? This this the key goal.
  2. Are reports available as SARIF or XML (or other formats such as JSON)? Add these for flexibility with integration to other tools and dashboards.
  3. Does the tool generate a directory? Then save the directory during CI build to create a ZIP artifact.
  4. Does the tool generate just files? Then save the files directly during CI builds as artifacts.

Existing reports as artifacts

We are getting a JaCoCo coverage summary for free on Action runs from the coverage badge generator: image

We have some reports being saved already as CI build artifacts: image

binkley commented 1 month ago

As part of this card, I updated Earthfile to save all "locally" build output for Gradle and Maven (build/ and target/ directories, respectively). This avoids needing to edit multiple files for a simple change. An example is adding more reporting artifacts to GitHub actions (such as Javadocs). Without this change, you need to whitelist what files are copied from inside the Earthly build container, and also update GitHub actions to save these artifacts:

  1. Just edit the GitHub action to save a particular artifact for the run to show in the GitHub page of a particular build.
  2. Locally, a containerized build updates your local build/ and target/ directories just as would a local direct build with ./gradlew or ./mvnw.

Internally, GitHub actions calling Earthly are a "container within a container". So you should trust GitHub actions that you selected, and avoid adding a 2nd layer of configuration between the two containers. We do this by having Earthfile call SAVE ARTIFACT for the complete build/ and target/ directories, and only the CI Yaml files need to pick/choose what to save as artifacts, or to reuse in actions. Previously, you'd have to configure each saved file twice: once in Earthfile and a 2nd time in the GitHub action.

binkley commented 1 month ago

Latest GitHub artifacts for the Gradle build on branch gradle-coverage-report: Image