New tests+ci/cd #2
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: Test Suite | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| - ready_for_review | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| backend-tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| env: | |
| FLASK_ENV: testing | |
| PYTHONUNBUFFERED: "1" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| cache-dependency-path: requirements.txt | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest-cov | |
| - name: Run backend tests with coverage gate | |
| run: | | |
| pytest backend/tests -v \ | |
| --cov=backend/src \ | |
| --cov-report=term-missing \ | |
| --cov-report=xml:backend/coverage.xml \ | |
| --cov-fail-under=80 | |
| - name: Upload backend coverage artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: backend-coverage | |
| path: backend/coverage.xml | |
| if-no-files-found: ignore | |
| frontend-tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Run frontend tests with coverage gate | |
| working-directory: frontend | |
| run: | | |
| CI=true npm test -- --watchAll=false --coverage --coverageReporters=text-summary --coverageReporters=lcov \ | |
| --coverageThreshold='{"global":{"branches":79,"functions":80,"lines":80,"statements":80}}' | |
| - name: Build frontend production bundle | |
| working-directory: frontend | |
| run: npm run build | |
| - name: Upload frontend coverage artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: frontend-coverage | |
| path: frontend/coverage/ | |
| if-no-files-found: ignore |