You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ci): switch e2e to PostgreSQL service + harden dev env precedence
The previous e2e job pointed the Astro dev server at SQLite
(`file:./test.db`) while every Drizzle schema in src/db/schema uses
`pgTable` and emits Postgres-specific SQL (json_build_array, btree
index types, etc). On a fresh CI worker the sqlite driver silently fell
back to Neon because the .env DATABASE_DRIVER=postgres was still in
scope, producing ECONNREFUSED from pg-pool and 500s on /api/search,
/explore, /test/test-repo/compare, /test/test-repo/settings/webhooks,
/orgs/new, /api/repos/.../releases.
Changes:
- .github/workflows/ci.yml: e2e now uses the same postgres:16-alpine
service as the unit-test stage, with bunx drizzle-kit push --force
to materialise the schema before Playwright starts.
- src/db/index.ts: getDbConfig() now reads process.env first, then
import.meta.env, so the explicit CI env wins over .env. Also infers
the driver from the URL prefix (file:/libsql:/https:/postgres:/postgresql:)
so callers only have to set DATABASE_URL.
- src/lib/auth.ts + src/lib/git.ts: same process.env -> import.meta.env
precedence for JWT_SECRET and SITE_URL (installHooks) so CI's
explicit values win.
- playwright.config.ts: webServer.env now spreads process.env and
adds CSRF_SKIP_DEV/RATE_LIMIT_SKIP_DEV/SITE_URL/INTERNAL_HOOK_SECRET
so the dev server inherits CI env (incl. DATABASE_URL/JWT_SECRET).
- scripts/security/audit.mjs: lockfile regen now retries with
--ignore-scripts --legacy-peer-deps and falls back to the existing
lockfile on persistent 'Cannot read properties of null' failures
rather than exiting 2; audit JSON is parsed even on non-zero exit.
Verified locally: typecheck/lint clean, 546/546 unit tests pass, and
all 66 Playwright e2e tests pass against the local postgres:16-alpine
container with the same env vars the CI workflow now sets.
0 commit comments