Skip to content

Commit ecf90dd

Browse files
committed
Increase code cov precision
1 parent 53cb8cf commit ecf90dd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
awk -F',' -v m="$col_missed" -v c="$col_covered" \
116116
'NR>1 && $1=="Jackson-core" {
117117
missed=$m; covered=$c;
118-
if (missed + covered > 0) printf "%.1f", (covered * 100.0) / (missed + covered)
118+
if (missed + covered > 0) printf "%.2f", (covered * 100.0) / (missed + covered)
119119
}' "$csv_file" | head -1
120120
}
121121
@@ -137,9 +137,9 @@ jobs:
137137
}'
138138
}
139139
140-
# Convert decimal to percentage and round to 1 decimal place
141-
COVERAGE=$(awk -v cov="${{ steps.jacoco.outputs.coverage }}" 'BEGIN { printf "%.1f", cov * 100 }')
142-
BRANCHES=$(awk -v br="${{ steps.jacoco.outputs.branches }}" 'BEGIN { printf "%.1f", br * 100 }')
140+
# Convert decimal to percentage and round to 2 decimal places
141+
COVERAGE=$(awk -v cov="${{ steps.jacoco.outputs.coverage }}" 'BEGIN { printf "%.2f", cov * 100 }')
142+
BRANCHES=$(awk -v br="${{ steps.jacoco.outputs.branches }}" 'BEGIN { printf "%.2f", br * 100 }')
143143
144144
# Check if base coverage artifact was downloaded and calculate deltas
145145
HAS_DELTA=false
@@ -149,8 +149,8 @@ jobs:
149149
BASE_BRANCHES=$(parse_coverage "base-coverage/jacoco.csv" 6 7)
150150
151151
if [ -n "$BASE_COVERAGE" ] && [ -n "$BASE_BRANCHES" ]; then
152-
COV_DELTA=$(awk -v curr="$COVERAGE" -v base="$BASE_COVERAGE" 'BEGIN { printf "%.1f", curr - base }')
153-
BR_DELTA=$(awk -v curr="$BRANCHES" -v base="$BASE_BRANCHES" 'BEGIN { printf "%.1f", curr - base }')
152+
COV_DELTA=$(awk -v curr="$COVERAGE" -v base="$BASE_COVERAGE" 'BEGIN { printf "%.3f", curr - base }')
153+
BR_DELTA=$(awk -v curr="$BRANCHES" -v base="$BASE_BRANCHES" 'BEGIN { printf "%.3f", curr - base }')
154154
155155
IFS='|' read -r COV_DELTA_STR COV_DELTA_EMOJI <<< "$(format_delta "$COV_DELTA")"
156156
IFS='|' read -r BR_DELTA_STR BR_DELTA_EMOJI <<< "$(format_delta "$BR_DELTA")"

0 commit comments

Comments
 (0)