ci: add GitHub Actions workflow and ESLint v9 config
Adds two-job CI (backend + frontend) running ruff, pytest (unit only - skipping heavy ML deps), docker compose config validation for both dev and prod overlays, plus npm ci -> eslint -> tsc -> vite build for the frontend. ESLint config uses the v9 flat-config format that the project was already on (eslint v9 dropped .eslintrc support); replaces the broken 'eslint . --ext' invocation and adds @typescript-eslint, react-hooks, and react-refresh plugins. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
86
.github/workflows/ci.yml
vendored
Normal file
86
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
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@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
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
|
||||
working-directory: legacy-knowledge-indexer
|
||||
run: ruff check app scripts tests
|
||||
|
||||
- name: Compile
|
||||
working-directory: legacy-knowledge-indexer
|
||||
run: python -m compileall -q app scripts tests
|
||||
|
||||
- name: Pytest (unit only — heavy deps excluded)
|
||||
working-directory: legacy-knowledge-indexer
|
||||
run: |
|
||||
pytest tests/test_hashing.py tests/test_quality.py \
|
||||
tests/test_chunker.py tests/test_duplicates.py \
|
||||
tests/test_hybrid_search.py -q
|
||||
|
||||
- name: docker compose config
|
||||
working-directory: legacy-knowledge-indexer
|
||||
run: docker compose config --quiet
|
||||
|
||||
- name: docker compose config (prod overlay)
|
||||
working-directory: legacy-knowledge-indexer
|
||||
run: |
|
||||
test -f docker-compose.prod.yml && \
|
||||
docker compose -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: legacy-knowledge-indexer/frontend
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: "npm"
|
||||
cache-dependency-path: legacy-knowledge-indexer/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
|
||||
Reference in New Issue
Block a user