Skip to content

ci: run DB-backed tests against a Postgres service - #22

Merged
OriginDevIT merged 1 commit into
mainfrom
ci/postgres-service
Aug 30, 2026
Merged

ci: run DB-backed tests against a Postgres service#22
OriginDevIT merged 1 commit into
mainfrom
ci/postgres-service

Conversation

@OriginDevIT

Copy link
Copy Markdown
Owner

Closes #18

handle.test.ts's 11 cases skip in CI because there's no Postgres to connect to.

Change (.github/workflows/ci.yml only)

  • Add a postgis/postgis:16-3.4 service container to the build job with a pg_isready -U osds health check (5s interval, 10 retries).
  • Set OSDS_TEST_DATABASE_URL=postgresql://osds:osds@localhost:5432/postgres on the pnpm test step. The DB-backed suite connects there, creates a uniquely-named scratch database, runs the @osds/db migrations against it, and drops it afterward.

Unchanged, deliberately

  • Trigger stays pull_request — not pull_request_target.
  • permissions: contents: read — untouched.

Verification

act isn't available locally, so I ran the exact mechanism the CI step uses:

OSDS_TEST_DATABASE_URL=postgresql://osds:...@localhost:5432/postgres pnpm test
→ Test Files  3 passed (3)
→ Tests  168 passed (168)      # was 157 passed | 11 skipped

No leftover scratch databases. This PR's own CI run is the CI-side confirmation.

🤖 Generated with Claude Code

handle.test.ts's 11 cases skipped in CI because no Postgres was
reachable. Add a postgis/postgis:16-3.4 service container to the build
job with a pg_isready health check, and point OSDS_TEST_DATABASE_URL at
its maintenance database so the suite creates its per-run scratch DB
there instead of skipping.

Unchanged: trigger stays `pull_request` (never pull_request_target),
`permissions: contents: read`.

Verified locally by running `pnpm test` with
OSDS_TEST_DATABASE_URL=postgresql://osds:...@localhost:5432/postgres -
168 passed, 0 skipped, no leftover scratch databases.

Closes #18

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Puf9jhj137U3iswf4GWZkG
Signed-off-by: Matthew Wren <info@origindev.com>
@OriginDevIT
OriginDevIT merged commit f420698 into main Aug 30, 2026
1 check passed
@OriginDevIT
OriginDevIT deleted the ci/postgres-service branch August 30, 2026 22:00
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.

ci: add Postgres service so DB-backed tests actually run

1 participant