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:
@@ -14,6 +14,16 @@ variables:
|
||||
mkdir -p /kaniko/.docker
|
||||
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:
|
||||
install:
|
||||
image: *node_image
|
||||
@@ -50,6 +60,17 @@ steps:
|
||||
depends_on:
|
||||
- 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:
|
||||
image: *node_image
|
||||
environment:
|
||||
@@ -64,11 +85,12 @@ steps:
|
||||
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 test
|
||||
depends_on:
|
||||
- prisma-generate
|
||||
- prisma-migrate
|
||||
|
||||
build:
|
||||
image: *node_image
|
||||
|
||||
Reference in New Issue
Block a user