Merge pull request #1 from Sowaiba-01/perf/batched-mc #32
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] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: Lint & test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| cache-dependency-path: requirements-ci.txt | |
| # torch from the CPU wheel index: ~200 MB instead of the ~2.5 GB CUDA | |
| # build that requirements.txt would pull. The runner has no GPU, so the | |
| # CUDA build is pure download cost — and was timing out the job. | |
| - name: Install CPU torch | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu | |
| - name: Install test dependencies | |
| run: pip install -r requirements-ci.txt | |
| - name: Lint (ruff) | |
| run: ruff check . --select=E,F,W --ignore=E501 | |
| - name: Run tests | |
| run: pytest tests/ -v --tb=short --junitxml=junit.xml | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: junit-results | |
| path: junit.xml | |
| frontend: | |
| name: Frontend typecheck & build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Type check | |
| working-directory: frontend | |
| run: npm run type-check | |
| - name: Build | |
| working-directory: frontend | |
| run: npm run build | |
| env: | |
| NEXTAUTH_SECRET: dummy-secret-for-build-only | |
| NEXTAUTH_URL: http://localhost:3000 | |
| build-docker: | |
| name: Build image | |
| runs-on: ubuntu-latest | |
| needs: [test, frontend] | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build Docker image | |
| run: docker build -f docker/Dockerfile -t chestai:${{ github.sha }} . | |
| deploy-spaces: | |
| name: Deploy to HF Spaces | |
| runs-on: ubuntu-latest | |
| needs: build-docker | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Push to HuggingFace Spaces | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| pip install huggingface_hub | |
| python scripts/deploy_spaces.py |