fix: 修复 ruff import 排序错误 #29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| jobs: | |
| # 后端测试 | |
| backend: | |
| name: Backend (Python) | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: apps/api | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| cache-dependency-path: apps/api/pyproject.toml | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Lint with Ruff | |
| run: | | |
| ruff check . | |
| ruff format --check . | |
| - name: Type check with mypy | |
| run: mypy app --ignore-missing-imports | |
| continue-on-error: true | |
| - name: Run tests | |
| run: pytest tests/ -v --cov=app --cov-report=xml | |
| env: | |
| DATABASE_URL: sqlite+aiosqlite:///./test.db | |
| JWT_SECRET_KEY: test-secret-key-for-ci | |
| ENCRYPTION_KEY: dGVzdC1lbmNyeXB0aW9uLWtleS0zMmJ5dGVz | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: apps/api/coverage.xml | |
| flags: backend | |
| continue-on-error: true | |
| # 前端测试 | |
| frontend: | |
| name: Frontend (Next.js) | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: apps/web | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: apps/web/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Lint | |
| run: npm run lint | |
| - name: Type check | |
| run: npm run type-check | |
| - name: Run tests | |
| run: npm run test --if-present | |
| - name: Build | |
| run: npm run build | |
| env: | |
| NEXT_PUBLIC_API_URL: http://localhost:8000 | |
| # 所有检查通过 | |
| ci-success: | |
| name: CI Success | |
| needs: [backend, frontend] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: All checks passed | |
| run: echo "✅ All CI checks passed!" |