@@ -56,40 +56,32 @@ jobs:
5656 run : ./mvnw -B -q -ff -ntp test jacoco:report
5757 - name : Publish code coverage
5858 if : ${{ matrix.release_build && github.event_name != 'pull_request' }}
59- uses : codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5.5.3
59+ uses : codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
6060 with :
6161 token : ${{ secrets.CODECOV_TOKEN }}
6262 files : ./target/site/jacoco/jacoco.xml
6363 flags : unittests
6464 - name : Upload coverage report as artifact
6565 if : ${{ matrix.release_build && github.event_name != 'pull_request' }}
66- uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
66+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
6767 with :
6868 name : jacoco-report
6969 path : target/site/jacoco/jacoco.csv
7070 retention-days : 30
7171 - name : Download base branch coverage
7272 if : ${{ matrix.release_build && github.event_name == 'pull_request' }}
73- uses : dawidd6/action-download-artifact@8a338493df3d275e4a7a63bcff3b8fe97e51a927 # v19
73+ uses : dawidd6/action-download-artifact@8305c0f1062bb0d184d09ef4493ecb9288447732 # v20
7474 continue-on-error : true
7575 with :
7676 workflow : main.yml
7777 branch : ${{ github.event.pull_request.base.ref }}
7878 name : jacoco-report
7979 path : base-coverage/
80- - name : Generate coverage summary
81- if : ${{ matrix.release_build && github.event_name == 'pull_request' }}
82- id : jacoco
83- uses : cicirello/jacoco-badge-generator@72266185b7ee48a6fd74eaf0238395cc8b14fef8 # v2.12.1
84- with :
85- jacoco-csv-file : target/site/jacoco/jacoco.csv
86- generate-coverage-badge : false
87- generate-branches-badge : false
88- generate-summary : true
8980 - name : Generate coverage comment
9081 if : ${{ matrix.release_build && github.event_name == 'pull_request' }}
9182 run : |
92- # Helper functions
83+ # Parse JaCoCo CSV to compute coverage percentage
84+ # Columns: GROUP,PACKAGE,CLASS,INSTRUCTION_MISSED(4),INSTRUCTION_COVERED(5),BRANCH_MISSED(6),BRANCH_COVERED(7),...
9385 parse_coverage() {
9486 local csv_file=$1 col_missed=$2 col_covered=$3
9587 awk -F',' -v m="$col_missed" -v c="$col_covered" \
@@ -121,9 +113,9 @@ jobs:
121113 }'
122114 }
123115
124- # Convert decimal to percentage and round to 1 decimal place
125- COVERAGE=$(awk -v cov="${{ steps. jacoco.outputs.coverage }}" 'BEGIN { printf "%.2f", cov * 100 }' )
126- BRANCHES=$(awk -v br="${{ steps. jacoco.outputs.branches }}" 'BEGIN { printf "%.2f", br * 100 }' )
116+ # Compute current coverage from JaCoCo CSV
117+ COVERAGE=$(parse_coverage "target/site/ jacoco/jacoco.csv" 4 5 )
118+ BRANCHES=$(parse_coverage "target/site/ jacoco/jacoco.csv" 6 7 )
127119
128120 # Check if base coverage artifact was downloaded and calculate deltas
129121 HAS_DELTA=false
@@ -174,7 +166,7 @@ jobs:
174166 echo "$COMMENT_BODY" > pr-comment/comment-body.txt
175167 - name : Upload PR comment
176168 if : ${{ matrix.release_build && github.event_name == 'pull_request' }}
177- uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
169+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
178170 with :
179171 name : pr-comment
180172 path : pr-comment/
0 commit comments