diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eeb2c34..fec5241 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,3 +65,59 @@ jobs: tags: edict:test cache-from: type=gha cache-to: type=gha,mode=max + + edict-backend: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:16-alpine + env: + POSTGRES_DB: edict + POSTGRES_USER: edict + POSTGRES_PASSWORD: edict_dev_2024 + ports: + - 5432:5432 + options: >- + --health-cmd "pg_isready -U edict" + --health-interval 5s + --health-timeout 5s + --health-retries 5 + redis: + image: redis:7-alpine + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 5s + --health-timeout 5s + --health-retries 5 + env: + DATABASE_URL: postgresql+asyncpg://edict:edict_dev_2024@localhost:5432/edict + REDIS_URL: redis://localhost:6379/0 + steps: + - uses: actions/checkout@v6 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: 'pip' + cache-dependency-path: edict/backend/requirements.txt + + - name: Install backend dependencies + run: pip install -r edict/backend/requirements.txt + + - name: Syntax check (py_compile) + run: | + find edict/backend -name '*.py' | while read f; do + echo " checking $f" + python3 -m py_compile "$f" + done + + - name: Run Alembic migrations + working-directory: edict + run: python -m alembic upgrade head + + - name: Verify FastAPI app imports + working-directory: edict/backend + run: python -c "from app.main import app; print(f'FastAPI app loaded: {len(app.routes)} routes')"