feat: merge GSSoC PR #2564 by @ArshVermaGit (conflict-free) #1
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: Backend CI | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - "fix/**" | ||
| - "feat/**" | ||
| - "test/**" | ||
| - "perf/**" | ||
| - "security/**" | ||
| - "docs/**" | ||
| - "devops/**" | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - gssoc | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: read | ||
| permissions: | ||
| contents: read | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| smoke-test: | ||
| name: Smoke Test & Unit Tests | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| ALLOW_DEGRADED_STARTUP: "1" | ||
| SUPABASE_URL: "https://placeholder.supabase.co" | ||
| SUPABASE_SERVICE_KEY: "placeholder_key" | ||
| PYTHONPATH: ${{ github.workspace }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Python 3.11 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
| cache: "pip" | ||
| cache-dependency-path: "backend/requirements.txt" | ||
| - name: Install dependencies (non-ML subset for CI speed) | ||
| run: | | ||
| pip install --upgrade pip | ||
| # Install a lighter subset that still covers service imports | ||
| pip install fastapi uvicorn pydantic python-dotenv slowapi \ | ||
| supabase==2.22.4 storage3==2.22.4 \ | ||
| requests httpx apscheduler \ | ||
| pytest pytest-cov | ||
| # Try full requirements but tolerate torch/transformers failures in CI | ||
| pip install -r backend/requirements.txt --ignore-requires-python || true | ||
| - name: Run import smoke test | ||
| run: python scripts/smoke_test.py | ||
| - name: Run unit tests with coverage | ||
| run: | | ||
| pytest backend/tests/ \ | ||
| --cov=backend/services \ | ||
| --cov-report=term-missing \ | ||
| --cov-fail-under=60 \ | ||
| -v \ | ||
| --ignore=backend/tests/test_import_smoke.py \ | ||
| 2>&1 || true | ||
| - name: Run import smoke tests | ||
| run: pytest backend/tests/test_import_smoke.py -v 2>&1 || true | ||