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:
Vadim Malanov
2026-05-13 16:44:04 +03:00
parent 7f72171572
commit 54714b5757
4 changed files with 6296 additions and 1 deletions

86
.github/workflows/ci.yml vendored Normal file
View 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

56
frontend/eslint.config.js Normal file
View File

@@ -0,0 +1,56 @@
import js from "@eslint/js";
import tsParser from "@typescript-eslint/parser";
import tsPlugin from "@typescript-eslint/eslint-plugin";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
export default [
{ ignores: ["dist", "node_modules", "public", "*.config.js", "*.config.ts"] },
js.configs.recommended,
{
files: ["src/**/*.{ts,tsx}"],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: { jsx: true },
},
globals: {
window: "readonly",
document: "readonly",
console: "readonly",
navigator: "readonly",
localStorage: "readonly",
setTimeout: "readonly",
clearTimeout: "readonly",
crypto: "readonly",
KeyboardEvent: "readonly",
Event: "readonly",
HTMLInputElement: "readonly",
HTMLButtonElement: "readonly",
HTMLDivElement: "readonly",
HTMLParagraphElement: "readonly",
HTMLSpanElement: "readonly",
},
},
plugins: {
"@typescript-eslint": tsPlugin,
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...tsPlugin.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
"@typescript-eslint/no-explicit-any": "off",
"no-undef": "off",
"no-empty": ["error", { allowEmptyCatch: true }],
},
},
];

6148
frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@
"dev": "vite",
"build": "tsc -b && vite build",
"preview": "vite preview --port 4173",
"lint": "eslint . --ext .ts,.tsx",
"lint": "eslint .",
"format": "prettier --write \"src/**/*.{ts,tsx,css}\""
},
"dependencies": {
@@ -41,12 +41,17 @@
"zustand": "^4.5.5"
},
"devDependencies": {
"@eslint/js": "^9.39.4",
"@types/node": "^22.7.4",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^8.59.3",
"@typescript-eslint/parser": "^8.59.3",
"@vitejs/plugin-react": "^4.3.2",
"autoprefixer": "^10.4.20",
"eslint": "^9.11.1",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.26",
"postcss": "^8.4.47",
"prettier": "^3.3.3",
"tailwindcss": "^3.4.13",