diff --git a/.github/workflows/ci-earthly-gradle.yml b/.github/workflows/ci-earthly-gradle.yml index fa5d34b2..bc8ffc32 100644 --- a/.github/workflows/ci-earthly-gradle.yml +++ b/.github/workflows/ci-earthly-gradle.yml @@ -70,3 +70,11 @@ jobs: name: coverage-report if-no-files-found: error path: build/reports/jacoco/test/ + +# Experiment if GitHub automatically shows coverage directly for run result + - name: Show coverage in GitHub action run result page + uses: actions/upload-artifact@v4 + with: + name: jacoco-summary + if-no-files-found: error + path: build/reports/jacoco/test/jacocoTestReport.csv diff --git a/Earthfile b/Earthfile index 716b4242..4ab8b58d 100644 --- a/Earthfile +++ b/Earthfile @@ -22,7 +22,7 @@ run-with-gradle: SAVE ARTIFACT --keep-ts build/reports/jacoco/test/ AS LOCAL build/reports/jacoco/test/ # Javadocs and jars SAVE ARTIFACT --keep-ts build/libs/modern-java-practices-0-javadoc.jar - SAVE ARTIFACT --keep-ts build/docs/javadoc/ AS LOCAL build/docs/javadoc/ + SAVE ARTIFACT --keep-ts build/docs/javadoc/test/ AS LOCAL build/docs/javadoc/test/ # Test coverage and badge for Gradle: # You need to PICK ONE from Gradle or Maven for your build. @@ -32,7 +32,9 @@ run-with-gradle: # Gradle. # After this enabling this, you still need to update the GitHub action steps # to generate the badge using a custom path to the CVS report. - # SAVE ARTIFACT --save-ts build/reports/jacoco/test/jacocoTestReport.csv AS LOCAL build/reports/jacoco/test/jacocoTestReport.csv + SAVE ARTIFACT --save-ts build/reports/jacoco/test/jacocoTestReport.csv AS LOCAL build/reports/jacoco/test/jacocoTestReport.csv +# Experiment if GitHub shows test coverage from these reports: + SAVE ARTIFACT --keep-ts build/reports/jacoco/test/jacocoTestReport.csv build/reports/jacoco/test/jacocoTestReport.csv build-with-maven: COPY mvnw . @@ -55,6 +57,9 @@ build-with-maven: # See above comments on enabling for Gradle. # Note that ONLY the Maven containerized build updates the README frontpage # badge for coverage. This is to avoid multiple updating. +# +# ALSO NOTE: This seems to enable GitHub action to show coverage directly in +# an action build run. SAVE ARTIFACT --keep-ts target/site/jacoco/jacoco.csv AS LOCAL target/site/jacoco/jacoco.csv run-with-maven: