Skip to content

style: format app/main.py #7

style: format app/main.py

style: format app/main.py #7

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: pgvector/pgvector:pg16
env:
POSTGRES_USER: documind
POSTGRES_PASSWORD: documind
POSTGRES_DB: documind
ports: ["5432:5432"]
options: >-
--health-cmd "pg_isready -U documind"
--health-interval 5s
--health-timeout 5s
--health-retries 20
env:
ENVIRONMENT: ci
DATABASE_URL: postgresql+asyncpg://documind:documind@localhost:5432/documind
# Tests never call a provider — anything that would is skipped. A real key
# here would mean a pull request could spend money.
OPENAI_API_KEY: sk-test-not-a-real-key
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: |
requirements.txt
requirements-dev.txt
- name: Install dependencies
# requirements-dev.txt pulls in requirements.txt and adds pinned test
# and lint tooling. torch is excluded: it is a multi-minute install for
# tests that do not exercise it.
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Lint
run: ruff check app scripts tests
- name: Format check
run: ruff format --check app scripts tests
- name: Verify the Vercel bundle stays importable without local extras
# Guards the actual deployment contract: if anything in the import graph
# starts requiring torch, Vercel breaks at runtime, not at build time.
run: python -c "from app.main import create_app; create_app()"
- name: Migrate
run: alembic upgrade head
- name: Test
run: pytest -q --tb=short
- name: Validate the golden set
run: |
python - <<'PY'
from app.evals.golden import load_golden_set, category_counts
questions = load_golden_set("evals/golden_set.jsonl")
counts = category_counts(questions)
print(f"{len(questions)} questions: {counts}")
expected = {"factual": 10, "multi-hop": 8, "unanswerable": 5,
"exact-term": 4, "ambiguous": 3}
assert counts == expected, f"category mix drifted: {counts} != {expected}"
PY