Skip to content

Commit 40d1901

Browse files
committed
Collect JaCoCo Reports
1 parent 56a5a82 commit 40d1901

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/build.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,42 @@ jobs:
7575
run: chmod +x ./gradlew
7676
- name: Gradle Test
7777
run: ./gradlew test
78+
- name: Collect JaCoCo Report
79+
if: ${{ github.event_name != 'pull_request' }}
80+
id: jacoco_reporter
81+
uses: PavanMudigonda/[email protected]
82+
with:
83+
coverage_results_path: build/jacoco.xml
84+
coverage_report_name: Code Coverage
85+
github_token: ${{ secrets.GITHUB_TOKEN }}
86+
skip_check_run: false
87+
minimum_coverage: 85
88+
fail_below_threshold: false
89+
publish_only_summary: false
90+
- name: Print JaCoCo Report
91+
if: ${{ github.event_name != 'pull_request' }}
92+
run: |
93+
echo "| Outcome | Value |" >> $GITHUB_STEP_SUMMARY
94+
echo "| --- | --- |" >> $GITHUB_STEP_SUMMARY
95+
echo "| Code Coverage % | ${{ steps.jacoco_reporter.outputs.coverage_percentage }} |" >> $GITHUB_STEP_SUMMARY
96+
echo "| :heavy_check_mark: Number of Lines Covered | ${{ steps.jacoco_reporter.outputs.covered_lines }} |" >> $GITHUB_STEP_SUMMARY
97+
echo "| :x: Number of Lines Missed | ${{ steps.jacoco_reporter.outputs.missed_lines }} |" >> $GITHUB_STEP_SUMMARY
98+
echo "| Total Number of Lines | ${{ steps.jacoco_reporter.outputs.total_lines }} |" >> $GITHUB_STEP_SUMMARY
99+
- name: Upload Code Coverage Artifacts (Push)
100+
if: ${{ github.event_name != 'pull_request' }}
101+
uses: actions/upload-artifact@v4
102+
with:
103+
name: coverage-report
104+
path: "*/coverage-results.md"
105+
- name: Upload Code Coverage Artifacts (Pull Request)
106+
if: ${{ github.event_name == 'pull_request' }}
107+
uses: madrapps/[email protected]
108+
with:
109+
paths: build/jacoco.xml
110+
token: ${{ secrets.GITHUB_TOKEN }}
111+
pass-emoji:
112+
min-coverage-overall: 85
113+
min-coverage-changed-files: 90
78114

79115
deploy:
80116
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)