@@ -27,12 +27,19 @@ jobs:
2727 strategy :
2828 fail-fast : false
2929 matrix :
30- java : [21]
3130 project : [persistence-it, webapp-it]
3231 parallel : [0, 2]
3332 pre-start : [false, true]
33+ java : [21]
34+ include :
35+ - project : webapp-it
36+ jacoco : true
37+ video : true
38+ name : " run-integration-tests (${{matrix.project}}, ${{matrix.parallel}}, ${{matrix.pre-start}}, ${{matrix.java}})"
3439 runs-on : ubuntu-latest
3540 if : ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'renovate/')) }}
41+ permissions :
42+ checks : write # JaCoCo Coverage Report check
3643 steps :
3744 - uses : actions/checkout@v6
3845
@@ -55,21 +62,54 @@ jobs:
5562 run : |
5663 ./mvnw -B test \
5764 -pl "advanced-demo/integration-tests/${{ matrix.project }}" -am \
58- -P run-it \
65+ -P run-it${{ matrix.jacoco && ',jacoco' || '' }} \
5966 ${{ matrix.pre-start && '-Dinfra-pre-start.enabled=1 ' || '' }} \
6067 ${{ matrix.parallel > 0 && format('-Djunit.jupiter.execution.parallel.enabled=true -Djunit.jupiter.execution.parallel.mode.default=concurrent -Djunit.jupiter.execution.parallel.mode.classes.default=concurrent -Djunit.jupiter.execution.parallel.config.strategy=fixed -Djunit.jupiter.execution.parallel.config.fixed.parallelism=2 -Djunit.jupiter.execution.parallel.config.fixed.max-pool-size={0} ', matrix.parallel) || '' }}
6168
6269 # Replace '/' with '-'
6370 - name : Normalize project name
64- if : failure()
6571 env :
6672 PROJECT : ${{ matrix.project }}
6773 run : echo PROJECT_NORMALIZED=${PROJECT/\//-} >> $GITHUB_ENV
6874
6975 - name : Upload videos of test failures
70- if : failure()
76+ if : ${{ matrix.video && failure() }}
7177 uses : actions/upload-artifact@v6
7278 with :
7379 name : test-fail-videos-${{ matrix.java }}-${{ env.PROJECT_NORMALIZED }}-${{ matrix.parallel }}-${{ matrix.pre-start }}
7480 path : advanced-demo/integration-tests/${{ matrix.project }}/target/records
7581 if-no-files-found : ignore
82+
83+ - name : Aggregate WebApp JaCoCo report
84+ if : ${{ matrix.jacoco && !cancelled() }}
85+ # Important: Also run compile (if not already done) so that we have all class files - otherwise the report will be incomplete
86+ run : |
87+ ./mvnw -B compile jacoco-aggregator:report-aggregate-all -pl "advanced-demo/webapp" -am -T2C
88+
89+ - name : Upload WebApp JaCoCo report
90+ if : ${{ matrix.jacoco && !cancelled() }}
91+ uses : actions/upload-artifact@v6
92+ with :
93+ name : webapp-jacoco-report-${{ matrix.java }}-${{ env.PROJECT_NORMALIZED }}-${{ matrix.parallel }}-${{ matrix.pre-start }}
94+ path : advanced-demo/target/site/jacoco-aggregate
95+ if-no-files-found : ignore
96+
97+ - name : WebApp JaCoCo Code Coverage Report
98+ if : ${{ matrix.jacoco && !cancelled() }}
99+ id : jacoco_reporter
100+ uses : PavanMudigonda/jacoco-reporter@4fc6bf270fe893e8dda5467e432253a6961345b8 # v5.0
101+ with :
102+ coverage_results_path : advanced-demo/target/site/jacoco-aggregate/jacoco.xml
103+ coverage_report_name : WebApp Coverage (${{matrix.parallel}}, ${{matrix.pre-start}}, ${{matrix.java}})
104+ coverage_report_title : JaCoCo
105+ github_token : ${{ secrets.GITHUB_TOKEN }}
106+
107+ - name : Add WebApp JaCoCo report to workflow run summary
108+ if : ${{ matrix.jacoco && !cancelled() }}
109+ run : |
110+ echo "| Outcome | Value |" >> $GITHUB_STEP_SUMMARY
111+ echo "| --- | --- |" >> $GITHUB_STEP_SUMMARY
112+ echo "| Code Coverage % | ${{ steps.jacoco_reporter.outputs.coverage_percentage }} |" >> $GITHUB_STEP_SUMMARY
113+ echo "| :heavy_check_mark: Number of Lines Covered | ${{ steps.jacoco_reporter.outputs.covered_lines }} |" >> $GITHUB_STEP_SUMMARY
114+ echo "| :x: Number of Lines Missed | ${{ steps.jacoco_reporter.outputs.missed_lines }} |" >> $GITHUB_STEP_SUMMARY
115+ echo "| Total Number of Lines | ${{ steps.jacoco_reporter.outputs.total_lines }} |" >> $GITHUB_STEP_SUMMARY
0 commit comments