Skip to content

Commit 7d9dfca

Browse files
update workflow
1 parent 9bd99fe commit 7d9dfca

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/unit-testing.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,14 @@ jobs:
4040
exit 1
4141
fi
4242
43-
# Extract coverage percentages (filter for ctr2 elements with % symbol only)
44-
INSTRUCTION=$(grep -A10 '<td>Total</td>' target/site/jacoco/index.html | grep -E 'class="ctr2".*%' | sed -n '1p' | sed -E 's/.*>([0-9]+)%<.*/\1/')
45-
BRANCH=$(grep -A10 '<td>Total</td>' target/site/jacoco/index.html | grep -E 'class="ctr2".*%' | sed -n '2p' | sed -E 's/.*>([0-9]+)%<.*/\1/')
43+
# Extract coverage percentages using awk for more reliable extraction
44+
COVERAGE_VALUES=$(grep -A10 '<td>Total</td>' target/site/jacoco/index.html | grep -E 'class="ctr2".*[0-9]+%' | sed -E 's/.*>([0-9]+)%<.*/\1/')
45+
46+
echo "Debug: All coverage values found:"
47+
echo "$COVERAGE_VALUES"
48+
49+
INSTRUCTION=$(echo "$COVERAGE_VALUES" | awk 'NR==1')
50+
BRANCH=$(echo "$COVERAGE_VALUES" | awk 'NR==2')
4651
4752
echo "📘 Instruction Coverage: ${INSTRUCTION:-0}%"
4853
echo "🌿 Branch Coverage: ${BRANCH:-0}%"

0 commit comments

Comments
 (0)