feat: add alembic migrations and PostgreSQL CI support
Some checks failed
ci/woodpecker/pr/pipeline Pipeline failed

- Add alembic dependency and initialize migration framework
- Configure async alembic env.py for SQLAlchemy 2.0
- Create initial migration for PostORM table
- Gate init_db() with SKIP_INIT_DB env var for CI/production
- Add PostgreSQL service to Woodpecker CI pipeline
- Create integration tests for migrations (TC-INT-001..002)
- Create integration tests for SQLAlchemyPostRepository (TC-INT-003..009)
- Add unit test for init_db skip behavior (TC-UNIT-901)
- All 176 tests pass, coverage 72.59%
This commit is contained in:
2026-05-09 21:11:35 +03:00
parent 5ee1decca2
commit 3956098d4b
14 changed files with 571 additions and 0 deletions

View File

@@ -2,6 +2,14 @@ when:
event: [push, pull_request]
branch: [dev, main, master]
services:
- name: postgres
image: postgres:17-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: blog_test
steps:
- name: deps
image: python:3.13
@@ -71,6 +79,21 @@ steps:
- pip install uv
- uv run --no-sync pytest tests/unit/
- name: test-integration
image: python:3.13
volumes:
- /tmp/uv-cache:/root/.cache/uv
environment:
UV_CACHE_DIR: /root/.cache/uv
UV_LINK_MODE: copy
UV_PYTHON: "3.13"
DB_URL: postgresql+asyncpg://postgres:postgres@postgres:5432/blog_test
SKIP_INIT_DB: "1"
depends_on: [deps]
commands:
- pip install uv
- uv run --no-sync pytest tests/integration/ -v
- name: test-e2e
image: python:3.13
volumes:
@@ -79,9 +102,12 @@ steps:
UV_CACHE_DIR: /root/.cache/uv
UV_LINK_MODE: copy
UV_PYTHON: "3.13"
DB_URL: postgresql+asyncpg://postgres:postgres@postgres:5432/blog_test
SKIP_INIT_DB: "1"
depends_on: [deps]
commands:
- pip install uv
- uv run --no-sync alembic upgrade head
- apt-get update && apt-get install -y libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libasound2
- uv run --no-sync playwright install chromium
- uv run --no-sync blog &