ci: test #117
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: Frontend CI | |
| on: | |
| push: | |
| branches: ["main"] | |
| paths: | |
| - 'frontend/**' | |
| - '.github/workflows/frontend-ci.yml' | |
| pull_request: | |
| branches: ["**"] | |
| paths: | |
| - 'frontend/**' | |
| - '.github/workflows/frontend-ci.yml' | |
| jobs: | |
| frontend-checks: | |
| name: React/Vite Check | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| issues: write | |
| pull-requests: write | |
| defaults: | |
| run: | |
| working-directory: ./frontend | |
| strategy: | |
| matrix: | |
| node-version: [24.x] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Lint (ESLint) | |
| run: npm run lint | |
| - name: Format Check | |
| run: npx prettier --check . | |
| - name: Build (TypeCheck & Vite) | |
| run: npm run build | |
| - name: Test with Coverage | |
| run: npm run test:cov:ci | |
| - name: Fetch base branch | |
| env: | |
| BASE_BRANCH: ${{ github.base_ref || 'main' }} | |
| BASE_REPOSITORY: ${{ github.event.pull_request.base.repo.full_name || github.repository }} | |
| run: | | |
| git fetch --no-tags --prune origin "+refs/heads/${BASE_BRANCH}:refs/remotes/origin/${BASE_BRANCH}" || \ | |
| git fetch --no-tags --prune "https://github.com/${BASE_REPOSITORY}.git" "+refs/heads/${BASE_BRANCH}:refs/remotes/origin/${BASE_BRANCH}" | |
| git rev-parse --verify "refs/remotes/origin/${BASE_BRANCH}" | |
| echo "DIFF_COVER_COMPARE_BRANCH=refs/remotes/origin/${BASE_BRANCH}" >> "$GITHUB_ENV" | |
| - name: Check diff coverage | |
| working-directory: . | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: npm exec --prefix frontend -- diff-cov-guard --threshold 90 --lcov frontend/coverage/lcov.info --root-dir frontend --fail-on-empty |