Spaces:
Sleeping
Sleeping
| name: CI (Lint & Test) | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| backend-lint-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Cache pip packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
| restore-keys: ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| # Install CPU-only torch to avoid heavy CUDA downloads in CI | |
| pip install torch --index-url https://download.pytorch.org/whl/cpu | |
| pip install -r requirements.txt | |
| pip install black isort | |
| - name: Lint — black (format check) | |
| run: black --check --config pyproject.toml backend/app | |
| - name: Lint — isort (import order) | |
| run: isort --check-only --settings-path pyproject.toml backend/app | |
| - name: Run tests | |
| run: pytest backend/tests -v --tb=short | |
| env: | |
| APP_STAGE: testing | |
| LOG_LEVEL: ERROR | |
| ADMIN_SECRET: ci_test_secret_32chars_xxxxxxxxxxxxxxxx | |
| CLEANUP_SECRET: ci_test_secret_32chars_xxxxxxxxxxxxxxxx | |