Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,11 @@ jobs:
branch: ${{ github.event.pull_request.base.ref }}
name: jacoco-report
path: base-coverage/
- name: Generate coverage summary
if: ${{ matrix.release_build && github.event_name == 'pull_request' }}
id: jacoco
uses: cicirello/jacoco-badge-generator@72266185b7ee48a6fd74eaf0238395cc8b14fef8 # v2.12.1
with:
jacoco-csv-file: target/site/jacoco/jacoco.csv
generate-coverage-badge: false
generate-branches-badge: false
generate-summary: true
- name: Generate coverage comment
if: ${{ matrix.release_build && github.event_name == 'pull_request' }}
run: |
# Helper functions
# Parse JaCoCo CSV to compute coverage percentage
# Columns: GROUP,PACKAGE,CLASS,INSTRUCTION_MISSED(4),INSTRUCTION_COVERED(5),BRANCH_MISSED(6),BRANCH_COVERED(7),...
parse_coverage() {
local csv_file=$1 col_missed=$2 col_covered=$3
awk -F',' -v m="$col_missed" -v c="$col_covered" \
Expand Down Expand Up @@ -139,9 +131,9 @@ jobs:
}'
}

# Convert decimal to percentage and round to 2 decimal places
COVERAGE=$(awk -v cov="${{ steps.jacoco.outputs.coverage }}" 'BEGIN { printf "%.2f", cov * 100 }')
BRANCHES=$(awk -v br="${{ steps.jacoco.outputs.branches }}" 'BEGIN { printf "%.2f", br * 100 }')
# Compute current coverage from JaCoCo CSV
COVERAGE=$(parse_coverage "target/site/jacoco/jacoco.csv" 4 5)
BRANCHES=$(parse_coverage "target/site/jacoco/jacoco.csv" 6 7)

# Check if base coverage artifact was downloaded and calculate deltas
HAS_DELTA=false
Expand Down
Loading