Skip to content

Commit cfdc0c7

Browse files
committed
fix(ci): keep the compliance summary alive when the runner dies early
The step runs under `bash -e`, so `TOTAL=$(field Total)` aborts the whole step when the tally line is absent — which is precisely the case where the runner crashed before printing it and the summary is the only thing left to read. Verified with the tally line missing: the block now completes and reports zeros.
1 parent 82ff126 commit cfdc0c7

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

.github/workflows/smart-compliance-tests.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,15 +1321,18 @@ jobs:
13211321
# also matched the per-poll progress lines and could not see the tests
13221322
# that never reached a verdict.
13231323
SUMMARY_LINE=$(grep -E "^Total: [0-9]+ \| Passed:" inferno-output.log | tail -1 || true)
1324+
# `|| true` on every extraction: under `bash -e` a failed grep would
1325+
# abort this step, losing the summary in exactly the case (runner died
1326+
# before printing its tally) where it is most needed.
13241327
field() {
1325-
echo "$SUMMARY_LINE" | tr '|' '\n' | grep -iE "^ *$1:" | sed 's/.*: *//' | tr -d ' ' | head -1
1328+
echo "$SUMMARY_LINE" | tr '|' '\n' | grep -iE "^ *$1:" | sed 's/.*: *//' | tr -d ' ' | head -1 || true
13261329
}
1327-
TOTAL=$(field Total); TOTAL=${TOTAL:-0}
1328-
PASSED=$(field Passed); PASSED=${PASSED:-0}
1329-
FAILED=$(field Failed); FAILED=${FAILED:-0}
1330-
INCOMPLETE=$(field Incomplete); INCOMPLETE=${INCOMPLETE:-0}
1331-
OMITTED=$(field Omitted); OMITTED=${OMITTED:-0}
1332-
ERRORS=$(field Errors); ERRORS=${ERRORS:-0}
1330+
TOTAL=$(field Total || true); TOTAL=${TOTAL:-0}
1331+
PASSED=$(field Passed || true); PASSED=${PASSED:-0}
1332+
FAILED=$(field Failed || true); FAILED=${FAILED:-0}
1333+
INCOMPLETE=$(field Incomplete || true); INCOMPLETE=${INCOMPLETE:-0}
1334+
OMITTED=$(field Omitted || true); OMITTED=${OMITTED:-0}
1335+
ERRORS=$(field Errors || true); ERRORS=${ERRORS:-0}
13331336
13341337
# Write summary
13351338
echo "" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)