name: CI on: push: branches: [main, master] pull_request: branches: [main, master] jobs: backend: name: 后端测试 runs-on: ubuntu-latest services: postgres: image: postgres:16 env: POSTGRES_USER: postgres POSTGRES_DB: mcp POSTGRES_HOST_AUTH_METHOD: trust ports: - 5432:5432 options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.12' - name: 安装系统依赖(Tesseract OCR) run: | sudo apt-get update sudo apt-get install -y tesseract-ocr tesseract-ocr-chi-sim poppler-utils - name: 安装 Python 依赖 run: | pip install --upgrade pip pip install fastapi uvicorn pydantic python-dotenv psycopg2-binary pdfplumber python-docx pytesseract Pillow httpx - name: 初始化数据库 env: DATABASE_URL: host=localhost port=5432 dbname=mcp user=postgres run: python3 db_init.py - name: 后端测试 env: DATABASE_URL: host=localhost port=5432 dbname=mcp user=postgres KIMI_API_KEY: test-key-placeholder run: python3 -m unittest test_bossai test_api test_adversarial test_burn_after_reading test_disaster_recovery test_release_checklist test_regulation -v frontend: name: 前端构建 runs-on: ubuntu-latest defaults: run: working-directory: web steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' cache-dependency-path: web/package-lock.json - name: 安装依赖 run: npm ci - name: 类型检查 run: npm run typecheck - name: 构建 run: npm run build