Skip to content

Commit e09d014

Browse files
committed
For #457. How does GitHub show coverage report?
1 parent ca91076 commit e09d014

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.github/workflows/ci-earthly-gradle.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,11 @@ jobs:
7070
name: coverage-report
7171
if-no-files-found: error
7272
path: build/reports/jacoco/test/
73+
74+
# Experiment if GitHub automatically shows coverage directly for run result
75+
- name: Show coverage in GitHub action run result page
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: jacoco-summary
79+
if-no-files-found: error
80+
path: build/reports/jacoco/test/jacocoTestReport.csv

Earthfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ run-with-gradle:
2222
SAVE ARTIFACT --keep-ts build/reports/jacoco/test/ AS LOCAL build/reports/jacoco/test/
2323
# Javadocs and jars
2424
SAVE ARTIFACT --keep-ts build/libs/modern-java-practices-0-javadoc.jar
25-
SAVE ARTIFACT --keep-ts build/docs/javadoc/ AS LOCAL build/docs/javadoc/
25+
SAVE ARTIFACT --keep-ts build/docs/javadoc/test/ AS LOCAL build/docs/javadoc/test/
2626

2727
# Test coverage and badge for Gradle:
2828
# You need to PICK ONE from Gradle or Maven for your build.
@@ -32,7 +32,9 @@ run-with-gradle:
3232
# Gradle.
3333
# After this enabling this, you still need to update the GitHub action steps
3434
# to generate the badge using a custom path to the CVS report.
35-
# SAVE ARTIFACT --save-ts build/reports/jacoco/test/jacocoTestReport.csv AS LOCAL build/reports/jacoco/test/jacocoTestReport.csv
35+
SAVE ARTIFACT --save-ts build/reports/jacoco/test/jacocoTestReport.csv AS LOCAL build/reports/jacoco/test/jacocoTestReport.csv
36+
# Experiment if GitHub shows test coverage from these reports:
37+
SAVE ARTIFACT --keep-ts build/reports/jacoco/test/jacocoTestReport.csv build/reports/jacoco/test/jacocoTestReport.csv
3638

3739
build-with-maven:
3840
COPY mvnw .
@@ -55,6 +57,9 @@ build-with-maven:
5557
# See above comments on enabling for Gradle.
5658
# Note that ONLY the Maven containerized build updates the README frontpage
5759
# badge for coverage. This is to avoid multiple updating.
60+
#
61+
# ALSO NOTE: This seems to enable GitHub action to show coverage directly in
62+
# an action build run.
5863
SAVE ARTIFACT --keep-ts target/site/jacoco/jacoco.csv AS LOCAL target/site/jacoco/jacoco.csv
5964

6065
run-with-maven:

0 commit comments

Comments
 (0)