Skip to content

Commit ff2a73d

Browse files
update workflow
1 parent 4167518 commit ff2a73d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

.github/workflows/unit-testing.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ jobs:
4040
exit 1
4141
fi
4242
43-
INSTRUCTION=$(grep -A2 "Total" target/site/jacoco/index.html | grep -m1 "%" | sed -E 's/.*>([0-9]+\.[0-9]+)%<.*/\1/')
44-
BRANCH=$(grep -A3 "Total" target/site/jacoco/index.html | grep -m2 "%" | tail -n1 | sed -E 's/.*>([0-9]+\.[0-9]+)%<.*/\1/')
43+
# Extract coverage percentages (handles both whole numbers and decimals)
44+
INSTRUCTION=$(grep -A4 "Total" target/site/jacoco/index.html | grep -E 'class="ctr2"' | sed -n '1p' | sed -E 's/.*>([0-9]+)%<.*/\1/')
45+
BRANCH=$(grep -A4 "Total" target/site/jacoco/index.html | grep -E 'class="ctr2"' | sed -n '2p' | sed -E 's/.*>([0-9]+)%<.*/\1/')
4546
46-
echo "📘 Instruction Coverage: ${INSTRUCTION:-0}"
47-
echo "🌿 Branch Coverage: ${BRANCH:-0}"
47+
echo "📘 Instruction Coverage: ${INSTRUCTION:-0}%"
48+
echo "🌿 Branch Coverage: ${BRANCH:-0}%"
4849
4950
echo "instruction=${INSTRUCTION:-0}" >> $GITHUB_OUTPUT
5051
echo "branch=${BRANCH:-0}" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)