Skip to content

ci: show vite server logs only on failure#899

Open
kitsuyui wants to merge 1 commit into
mainfrom
fix/audit-ci-trap-logs-on-success-001
Open

ci: show vite server logs only on failure#899
kitsuyui wants to merge 1 commit into
mainfrom
fix/audit-ci-trap-logs-on-success-001

Conversation

@kitsuyui

Copy link
Copy Markdown
Member

Summary

Fix the CI EXIT trap in test.yml and octocov.yml so that the vite server log is only shown when the workflow fails, not on every run.

Problem

Both workflows had this trap:

trap 'kill $vite_pid; cat /tmp/gitignore-in-website-vite.log' EXIT

The cat runs unconditionally — on success and failure alike. Diagnostic logs should help debug failures, not appear as noise when tests pass. On a successful run, the vite log output adds clutter without value.

Change

Split the log display into a separate step using GitHub Actions' if: failure():

- name: E2E Test
  run: |
    ...
    trap 'kill $vite_pid' EXIT   # cleanup only
    ...

- name: Show vite server logs
  if: failure()
  run: cat /tmp/gitignore-in-website-vite.log

This is the idiomatic GitHub Actions pattern for failure-only diagnostics. The trap now only handles cleanup; the log display is conditional.

Applied the same fix to both test.yml (E2E Test step) and octocov.yml (Test with coverage step), which had the identical pattern.

Verification

  • On success: vite server is killed by the trap; log step is skipped.
  • On failure: vite server is killed by the trap; log step runs and displays the vite output for debugging.

The EXIT trap was unconditionally printing the vite server log on both
success and failure, polluting CI output with diagnostic noise on
successful runs. Diagnostic logs should aid debugging on failure only.

Split the log display into a separate step with `if: failure()`, which
is the GitHub Actions idiomatic pattern for failure-only diagnostics.
The trap now only handles cleanup (killing the vite process).

Applies the same fix to both test.yml and octocov.yml which had the
identical pattern.
@github-actions

Copy link
Copy Markdown

Code Metrics Report

main (2c70363) #899 (208a25c) +/-
Coverage 0.0% 0.0% 0.0%
Code to Test Ratio 1:0.6 1:0.6 0.0
Test Execution Time 18s 1s -17s
Details
  |                     | main (2c70363) | #899 (208a25c) | +/-  |
  |---------------------|----------------|----------------|------|
  | Coverage            |           0.0% |           0.0% | 0.0% |
  |   Files             |              0 |              0 |    0 |
  |   Lines             |              0 |              0 |    0 |
  |   Covered           |              0 |              0 |    0 |
  | Code to Test Ratio  |          1:0.6 |          1:0.6 |  0.0 |
  |   Code              |             19 |             19 |    0 |
  |   Test              |             13 |             13 |    0 |
+ | Test Execution Time |            18s |             1s | -17s |

Reported by octocov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant