Add scripts/report_module_sizes.py - report-only LOC bands per layer from the TeamHUB module-size guardrail (CONVENTIONS.md, module contract p.6). Always exits 0: split-review stays a human decision. Wire it into CI as a non-blocking step and into the AGENTS.md baseline checks. Document data/input + data/work as the deliberate compatibility exception to the var/ rule of 18_REPO_LAYOUT_STANDARD.md in docs/structure-map.md (compose mounts and APP_*_DIR depend on the paths) and ignore var/ for new local runtime output. Verified: script runs clean on the repo (159 files in scope, zero flagged); ruff and compileall pass; adversarial review fixed two classification bugs (frontend shell under frontend/src/app/, app/api/security.py as infra helper). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
89 lines
2.6 KiB
YAML
89 lines
2.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
backend:
|
|
name: Backend (lint + tests + compose)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version: "3.11"
|
|
cache: "pip"
|
|
|
|
- name: Install (light deps only, skip ocrmypdf/docling/torch)
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install \
|
|
"pydantic>=2.7" "pydantic-settings>=2.4" \
|
|
"sqlalchemy>=2.0.30" "psycopg[binary]>=3.2" \
|
|
"alembic>=1.13" "minio>=7.2.7" \
|
|
"opensearch-py>=2.6" "qdrant-client>=1.10" \
|
|
"celery>=5.4" "redis>=5.0" \
|
|
"fastapi>=0.115" "uvicorn[standard]>=0.30" \
|
|
"structlog>=24.2" "tenacity>=8.5" "langdetect>=1.0.9" \
|
|
"regex>=2024.5.15" "click>=8.1.7" \
|
|
"pytest>=8.2" "pytest-asyncio>=0.23" \
|
|
ruff
|
|
|
|
- name: Ruff
|
|
run: ruff check app scripts tests
|
|
|
|
- name: Compile
|
|
run: python -m compileall -q app scripts tests
|
|
|
|
- name: Module size report (report-only guardrail)
|
|
run: python scripts/report_module_sizes.py
|
|
|
|
- name: Pytest (unit only — heavy deps excluded)
|
|
# test_chunker.py skips here: it needs the pinned document recognition
|
|
# engine (private TeamHUB_Engines repo, no PAT secret configured).
|
|
# It runs in the Docker image and in dev envs with the engine installed.
|
|
run: |
|
|
pytest tests/test_hashing.py tests/test_quality.py \
|
|
tests/test_chunker.py tests/test_duplicates.py \
|
|
tests/test_hybrid_search.py -q -rs
|
|
|
|
- name: docker compose config
|
|
run: docker compose config --quiet
|
|
|
|
- name: docker compose config (prod overlay)
|
|
run: |
|
|
test -f docker-compose.prod.yml && \
|
|
docker compose --env-file .env.prod.example \
|
|
-f docker-compose.yml -f docker-compose.prod.yml config --quiet || \
|
|
echo "prod overlay absent, skipping"
|
|
|
|
frontend:
|
|
name: Frontend (lint + type-check + build)
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: frontend
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- uses: actions/setup-node@v5
|
|
with:
|
|
node-version: "20"
|
|
cache: "npm"
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- run: npm ci
|
|
|
|
- name: ESLint
|
|
run: npm run lint
|
|
|
|
- name: TypeScript
|
|
run: npx tsc --noEmit
|
|
|
|
- name: Build
|
|
run: npx vite build
|