Skip to content

Commit 48d28da

Browse files
committed
Updated target to print results in GitHub actions page
1 parent 3cd4409 commit 48d28da

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Lab3/Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,11 @@ coverage: run
3636
coverage ./coverage/trace.bin \
3737
--binary Lab3.elf \
3838
--sources ./src/checksum.c | \
39-
awk -F',' '/DA:/ {found++; if($$2>0) hit++} END \
40-
{printf "\nTotal Coverage: %.2f%% (%d/%d lines hit)\n", (hit/found)*100, hit, found}'
39+
awk -F',' '/DA:/ {found++; if($$2>0) hit++} END { \
40+
percent = (found > 0) ? (hit/found)*100 : 0; \
41+
msg = sprintf("\nTotal Coverage: %.2f%% (%d/%d lines hit)\n", percent, hit, found); \
42+
print msg; \
43+
if (ENVIRON["GITHUB_STEP_SUMMARY"] != "") { \
44+
printf "### 📊 Coverage Report\n- **Status:** %s\n- **Percentage:** %.2f%%\n- **Details:** %d out of %d lines executed\n", (percent == 100 ? "✅ Pass" : "⚠️ Partial"), percent, hit, found >> ENVIRON["GITHUB_STEP_SUMMARY"]; \
45+
} \
46+
}'

0 commit comments

Comments
 (0)