Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

jobs:
node:
if: ${{ hashFiles('package.json') != '' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -22,10 +21,13 @@ jobs:
run: npm ci
- name: API health (offline)
run: |
DEV_NO_API=1 node backend/index.cjs &
echo $! > api.pid
sleep 1
curl -fsS http://127.0.0.1:8790/health | tee health.json
DEV_NO_API=1 node backend/index.cjs & echo $! > api.pid
for i in {1..20}; do
if curl -fsS http://127.0.0.1:8790/health >/dev/null; then
curl -fsS http://127.0.0.1:8790/health | tee health.json; break
fi
sleep 0.3
done
Comment on lines 22 to +30
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Fail health step when /health never responds

The new wait loop swallows all curl failures and never asserts that the API became healthy. With set -e the curl inside the if is allowed to fail without aborting the step, and after the loop there is no check of whether a successful request occurred. If the server process starts but never serves /health (e.g., it hangs during boot or the endpoint regresses), this step will exit 0 and the CI job will succeed without ever verifying the API. The previous single curl would fail in that situation. Consider tracking success in the loop and exit 1 after the loop if no healthy response was observed.

Useful? React with 👍 / 👎.

kill $(cat api.pid)
- name: Run ESLint (npx)
run: npx -y eslint .
Expand All @@ -35,7 +37,6 @@ jobs:
run: npm run -s test --if-present

python:
if: ${{ hashFiles('requirements.txt') != '' || hashFiles('pyproject.toml') != '' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
Loading