spawn/.github/workflows/test.yml
Ahmed Abushagur b4abe8012f
fix(ci): propagate mock test exit code and fix broken pipe in summary (#1032)
* fix(ci): propagate mock test exit code and fix broken pipe in summary

The test workflow had three issues:
- mock.sh exit code was swallowed by tee (no pipefail), so the check
  always passed even with 165 failures
- grep|head pipe caused "write error: Broken pipe" in post summary
- Summary was noisy with 100+ individual result lines

Now uses PIPESTATUS[0] to capture the real exit code, shows a clean
results line plus collapsible failures list, and fails the check when
tests fail.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(ci): report test results without blocking PRs

Pre-existing failures (165) shouldn't block unrelated PRs. The summary
still shows pass/fail counts and a collapsible failures list so the bot
can see the results.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* perf(ci): increase QA cycle frequency from daily to every 4 hours

Daily runs meant breakage could go undetected for up to 24 hours.
Every 4 hours gives 6 runs/day (00:00, 04:00, 08:00, 12:00, 16:00,
20:00 UTC) with a max 4-hour feedback loop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(ci): add missing Check results step to fail on test errors

Addresses review feedback:
- The exit code was captured via PIPESTATUS[0] into GITHUB_OUTPUT but
  no subsequent step consumed it, so the workflow always passed even
  when tests failed. Added a "Check results" step that reads the
  captured exit code and fails the job accordingly.
- Reverted QA cron schedule change (every 4 hours back to daily at
  06:00 UTC) as it was unrelated to the test exit code fix and should
  be proposed separately if desired.

Agent: pr-maintainer
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
2026-02-13 20:46:45 -05:00

53 lines
1.6 KiB
YAML

name: Test
on:
pull_request:
branches: [main]
concurrency:
group: test-${{ github.head_ref }}
cancel-in-progress: true
jobs:
mock-tests:
name: Mock Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run mock tests
id: tests
env:
NO_COLOR: 1
run: |
set +e
bash test/mock.sh 2>&1 | tee /tmp/mock-output.log
echo "exit_code=${PIPESTATUS[0]}" >> "$GITHUB_OUTPUT"
- name: Post summary
if: always()
run: |
echo '## Mock Test Results' >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
grep -E 'Results:' /tmp/mock-output.log >> "$GITHUB_STEP_SUMMARY" || true
echo '```' >> "$GITHUB_STEP_SUMMARY"
FAILURES=$(grep '✗' /tmp/mock-output.log | head -50)
if [[ -n "$FAILURES" ]]; then
echo '' >> "$GITHUB_STEP_SUMMARY"
echo '<details><summary>Failures (first 50)</summary>' >> "$GITHUB_STEP_SUMMARY"
echo '' >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
printf '%s\n' "$FAILURES" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo '</details>' >> "$GITHUB_STEP_SUMMARY"
fi
- name: Check results
if: always()
run: |
if [[ "${{ steps.tests.outputs.exit_code }}" != "0" ]]; then
echo "Mock tests failed (exit code ${{ steps.tests.outputs.exit_code }})"
exit 1
fi