Fix project form initialization issue #34
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: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| backend: ${{ steps.filter.outputs.backend }} | |
| frontend: ${{ steps.filter.outputs.frontend }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Detect changed paths | |
| id: filter | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| backend: | |
| - 'backend/**' | |
| - 'backend/requirements*.txt' | |
| frontend: | |
| - 'frontend/**' | |
| backend-tests: | |
| needs: changes | |
| if: needs.changes.outputs.backend == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| env: | |
| FLASK_ENV: testing | |
| PYTHONUNBUFFERED: "1" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| id: setup-python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| cache-dependency-path: | | |
| backend/requirements.txt | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r backend/requirements.txt pytest-cov pytest-xdist | |
| - name: Run backend tests | |
| run: | | |
| pytest backend/tests \ | |
| -n auto \ | |
| -x \ | |
| ${{ github.ref == 'refs/heads/main' && '--cov=backend/src --cov-report=term-missing --cov-report=xml:backend/coverage.xml --cov-fail-under=80' || '-q' }} | |
| - name: Upload backend coverage artifact | |
| if: github.ref == 'refs/heads/main' && always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: backend-coverage | |
| path: backend/coverage.xml | |
| if-no-files-found: ignore | |
| backend-image-build: | |
| needs: changes | |
| if: needs.changes.outputs.backend == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build backend container image | |
| run: docker build -t devsync-backend-ci ./backend | |
| frontend-tests: | |
| needs: changes | |
| if: needs.changes.outputs.frontend == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node | |
| id: setup-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 | |
| working-directory: frontend | |
| run: | | |
| if [ "${{ github.ref }}" = "refs/heads/main" ]; then | |
| CI=true npm test -- \ | |
| --watchAll=false \ | |
| --coverage \ | |
| --coverageReporters=text-summary \ | |
| --coverageReporters=lcov \ | |
| --maxWorkers=50% \ | |
| --coverageThreshold='{"global":{"branches":79,"functions":80,"lines":80,"statements":80}}' | |
| else | |
| CI=true npm test -- \ | |
| --watchAll=false \ | |
| --maxWorkers=50% | |
| fi | |
| - name: Build frontend production bundle | |
| if: github.ref == 'refs/heads/main' | |
| working-directory: frontend | |
| run: npm run build | |
| - name: Upload frontend coverage artifact | |
| if: github.ref == 'refs/heads/main' && always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: frontend-coverage | |
| path: frontend/coverage/ | |
| if-no-files-found: ignore |