Repository navigation
test(frontend): add Vitest + React Testing Library suite (#9) #199
Workflow file for this run
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] | |
| # Allow this workflow to be called by deploy.yml as a reusable "test" gate. | |
| workflow_call: | |
| jobs: | |
| python: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| # LFS disabled: the repo's LFS bandwidth budget is exhausted and the | |
| # 254MB flood model isn't needed for tests (code falls back to the | |
| # synthetic/demo model path, same as production). | |
| lfs: false | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgl1 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install -e . | |
| - name: Lint with flake8 | |
| run: | | |
| flake8 src/ --count --select=E9,F63,F7,F82 --show-source --statistics | |
| flake8 src/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| - name: Test with pytest | |
| run: | | |
| pytest tests/ -v --tb=short | |
| frontend: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Type check and build | |
| run: npm run build | |
| - name: Run unit tests | |
| run: npm test | |
| docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: false | |
| target: api | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Aggregator job used as a required status check named "ci" | |
| ci: | |
| needs: [python, frontend, docker] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: All checks passed | |
| run: echo "CI passed" |