@@ -75,10 +75,45 @@ jobs:
7575 - uses : ./.github/actions/setup-java
7676
7777 - name : Run Unit tests
78- run : ./gradlew test
78+ run : ./gradlew test testCodeCoverage
7979 env :
8080 DEVELOCITY_ACCESS_KEY : ${{ secrets.DEVELOCITY_API_TOKEN }}
8181
82+ # uploads the jacoco report as artifact
83+ - name : Upload JaCoCo Coverage Report
84+ uses : actions/upload-artifact@v4
85+ with :
86+ name : JaCoCo coverage-report
87+ path : build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
88+ retention-days : 1
89+
90+ # generates coverage-report.md
91+ - name : JaCoCo Code Coverage Report
92+ id : jacoco_reporter
93+ uses : PavanMudigonda/jacoco-reporter@v5.0
94+ with :
95+ coverage_results_path : build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
96+ skip_check_run : true
97+ github_token : ${{ secrets.GITHUB_TOKEN }}
98+
99+ # Publish Coverage Job Summary
100+ - name : Output KPIs from JaCoCo report
101+ run : |
102+ echo "| Outcome | Value |" >> $GITHUB_STEP_SUMMARY
103+ echo "| --- | --- |" >> $GITHUB_STEP_SUMMARY
104+ echo "| Code Coverage % | ${{ steps.jacoco_reporter.outputs.coverage_percentage }} |" >> $GITHUB_STEP_SUMMARY
105+ echo "| :heavy_check_mark: Number of Lines Covered | ${{ steps.jacoco_reporter.outputs.covered_lines }} |" >> $GITHUB_STEP_SUMMARY
106+ echo "| :x: Number of Lines Missed | ${{ steps.jacoco_reporter.outputs.missed_lines }} |" >> $GITHUB_STEP_SUMMARY
107+ echo "| Total Number of Lines | ${{ steps.jacoco_reporter.outputs.total_lines }} |" >> $GITHUB_STEP_SUMMARY
108+
109+ # uploads the coverage-report.md artifact
110+ - name : Upload Code Coverage Markdown Report
111+ uses : actions/upload-artifact@v4
112+ with :
113+ name : code-coverage-report-markdown
114+ path : " */coverage-results.md"
115+ retention-days : 1
116+
82117 integration-tests :
83118 runs-on : ubuntu-latest
84119 steps :
0 commit comments