ci: fix malformed backend-tests.yml so backend CI actually runs#22
Conversation
The on.pull_request.paths block held job-step maps instead of path globs, so Actions found no valid jobs: block and silently skipped the workflow — no tests ran on backend PRs. Restructure with a proper jobs: section: - unit-tests: checkout, setup-node@v4 (Node 20, npm cache), npm ci, npm test. Tests use a temp SQLite db (src/test/setup.ts), so no Postgres/Redis service containers are needed. - validate-compose: docker compose config on deployment/docker-compose.yml. Verified locally: npm ci && npm test passes (89 passed, 16 skipped). Closes #2
98854ca to
943f24b
Compare
Uchechukwu-Ekezie
left a comment
There was a problem hiding this comment.
Clean fix. The root bug was real — job-step maps were nested inside on.pull_request.paths which meant GitHub Actions never saw a valid jobs: block and silently skipped the workflow on every PR.
A few things I checked:
Structure — on: block is now correct: push and pull_request both have proper paths: lists as string arrays, not mixed with step maps.
unit-tests job — setup-node@v4 with Node 20, cache-dependency-path: backend/package-lock.json is the right scope. npm ci → npm test with NODE_ENV: test is clean. Coverage artifact with if-no-files-found: ignore is safe.
No Postgres/Redis services — the explanation in the PR description is correct. If src/test/setup.ts configures a SQLite temp DB, adding real service containers would be noise. That's the right call.
validate-compose — docker compose -f deployment/docker-compose.yml config is a dry-run parse, not a docker compose up. Correct choice for a CI validation step.
All three CI checks pass: Unit & Integration Tests ✓, Validate Docker Compose ✓, Playwright E2E ✓.
Good work @dadadave80.
Closes #2
Problem
.github/workflows/backend-tests.ymlhad job-step maps (- name: Upload test results, …) nested insideon.pull_request.pathswhere path globs belong. GitHub Actions parsed the file, found no validjobs:block, and silently skipped the workflow — so no backend tests ran on any PR or push.Fix
Restructured the file with a proper
jobs:section, using the correctly-formattede2e-tests.ymlas reference:unit-tests—checkout→setup-node@v4(Node 20, npm cache keyed onbackend/package-lock.json) →npm ci→npm test, with coverage uploaded viaupload-artifact@v4(if-no-files-found: ignore).validate-compose— runsdocker compose -f deployment/docker-compose.yml config.Note on service containers
The issue's proposed fix added Postgres + Redis service containers. The backend test suite doesn't need them —
backend/src/test/setup.tspoints the DB at a temporary SQLite file, so the tests are fully self-contained. I left the services out to keep CI fast and the config honest; happy to add them if there's a planned suite that requires a real Postgres/Redis.Verification
Workflow YAML validated: valid
jobs:block (unit-tests,validate-compose),pathsis a list of globs.