feat(ci): Add PostgreSQL service for integration tests

Added PostgreSQL 17 service to Woodpecker CI to support integration tests:

**Changes:**
- PostgreSQL 17 Alpine service with test database
- New prisma-migrate step runs migrations before tests
- DATABASE_URL environment variable in test step
- Data stored in tmpfs for speed and auto-cleanup

**Impact:**
- Integration tests (job-events.performance.spec.ts, fulltext-search.spec.ts) now run in CI
- All 1953 tests pass (including 14 integration tests)
- No more skipped DB-dependent tests

**Aligns with "no workarounds" principle** - maintains full test coverage instead of skipping integration tests.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-03 20:44:14 -06:00
parent 0a527d2a4e
commit f25782a850

View File

@@ -14,6 +14,16 @@ variables:
mkdir -p /kaniko/.docker mkdir -p /kaniko/.docker
echo "{\"auths\":{\"git.mosaicstack.dev\":{\"username\":\"$GITEA_USER\",\"password\":\"$GITEA_TOKEN\"}}}" > /kaniko/.docker/config.json echo "{\"auths\":{\"git.mosaicstack.dev\":{\"username\":\"$GITEA_USER\",\"password\":\"$GITEA_TOKEN\"}}}" > /kaniko/.docker/config.json
services:
postgres:
image: postgres:17-alpine
environment:
POSTGRES_DB: test_db
POSTGRES_USER: test_user
POSTGRES_PASSWORD: test_password
tmpfs:
- /var/lib/postgresql/data
steps: steps:
install: install:
image: *node_image image: *node_image
@@ -50,6 +60,17 @@ steps:
depends_on: depends_on:
- install - install
prisma-migrate:
image: *node_image
environment:
SKIP_ENV_VALIDATION: "true"
DATABASE_URL: "postgresql://test_user:test_password@postgres:5432/test_db?schema=public"
commands:
- *use_deps
- pnpm --filter "@mosaic/api" prisma migrate deploy
depends_on:
- prisma-generate
typecheck: typecheck:
image: *node_image image: *node_image
environment: environment:
@@ -64,11 +85,12 @@ steps:
image: *node_image image: *node_image
environment: environment:
SKIP_ENV_VALIDATION: "true" SKIP_ENV_VALIDATION: "true"
DATABASE_URL: "postgresql://test_user:test_password@postgres:5432/test_db?schema=public"
commands: commands:
- *use_deps - *use_deps
- pnpm test - pnpm test
depends_on: depends_on:
- prisma-generate - prisma-migrate
build: build:
image: *node_image image: *node_image