Skip to content

Commit e6f1336

Browse files
committed
Add JaCoCo coverage report as PR comment
Add Madrapps/jacoco-report action (pinned to commit SHA for supply chain safety) to post a sticky coverage summary comment on PRs. The action runs only in the matrix job that generates the JaCoCo report and updates the same comment on each new commit. https://claude.ai/code/session_01R1nvwA9Gc7gv8Uxwyvy83u
1 parent 67dc320 commit e6f1336

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/workflows/pull_request.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
strategy:
2222
matrix:
23-
gradle-argument: [ 'assemble && ./gradlew check -x test','testWithJava11', 'testWithJava17','testWithJava21', 'test -x testWithJava11 -x testWithJava17 -x testWithJava21' ]
23+
gradle-argument: [ 'assemble && ./gradlew check -x test','testWithJava11', 'testWithJava17','testWithJava21', 'test -x testWithJava11 -x testWithJava17 -x testWithJava21 jacocoTestReport' ]
2424
steps:
2525
- uses: actions/checkout@v6
2626
- uses: gradle/actions/wrapper-validation@v5
@@ -31,6 +31,18 @@ jobs:
3131
distribution: 'corretto'
3232
- name: build and test
3333
run: ./gradlew ${{matrix.gradle-argument}} --info --stacktrace
34+
- name: Publish Coverage Report
35+
uses: Madrapps/jacoco-report@50d3aff4548aa991e6753342d9ba291084e63848 # v1.7.2
36+
if: >
37+
always() &&
38+
github.event_name == 'pull_request' &&
39+
contains(matrix.gradle-argument, 'jacocoTestReport')
40+
with:
41+
paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
min-coverage-overall: 0
44+
min-coverage-changed-files: 0
45+
update-comment: true
3446
- name: Publish Test Results
3547
uses: EnricoMi/publish-unit-test-result-action@v2.23.0
3648
if: always()

0 commit comments

Comments
 (0)