fix: improve React quiz questions quality #53
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/CD Pipeline | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| quality: | |
| name: Code Quality & Linting | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Run ESLint | |
| run: pnpm lint | |
| - name: Check formatting | |
| run: pnpm format:check | |
| - name: TypeScript type check | |
| run: pnpm type-check | |
| test: | |
| name: Test Suite | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [18, 20] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Run tests | |
| run: pnpm test:coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| if: matrix.node-version == 20 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/coverage-final.json | |
| fail_ci_if_error: false | |
| build: | |
| name: Build & Bundle Analysis | |
| runs-on: ubuntu-latest | |
| needs: [quality, test] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Build application | |
| run: pnpm build | |
| - name: Analyze bundle size | |
| run: | | |
| echo "📦 Bundle Size Analysis:" | |
| du -sh dist/ | |
| echo "" | |
| echo "📊 Asset Breakdown:" | |
| ls -lh dist/assets/ | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-${{ github.sha }} | |
| path: dist/ | |
| retention-days: 7 | |
| lighthouse: | |
| name: Lighthouse Performance Audit | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Build | |
| run: pnpm build | |
| - name: Run Lighthouse | |
| uses: treosh/lighthouse-ci-action@v11 | |
| with: | |
| urls: | | |
| http://localhost:4173 | |
| uploadArtifacts: true | |
| temporaryPublicStorage: true | |
| runs: 3 | |
| security: | |
| name: Security Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Run security audit | |
| run: pnpm audit --audit-level=moderate | |
| continue-on-error: true | |
| - name: Check for outdated dependencies | |
| run: pnpm outdated || true | |
| deploy-preview: | |
| name: Deploy Preview (PR) | |
| runs-on: ubuntu-latest | |
| needs: [quality, test, build] | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Build | |
| run: pnpm build | |
| - name: Deploy to Vercel Preview | |
| uses: amondnet/vercel-action@v25 | |
| if: env.VERCEL_TOKEN != '' | |
| with: | |
| vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
| vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | |
| vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} | |
| scope: ${{ secrets.VERCEL_ORG_ID }} | |
| env: | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| deploy-production: | |
| name: Deploy to Production | |
| runs-on: ubuntu-latest | |
| needs: [quality, test, build, security] | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| environment: | |
| name: production | |
| url: https://frontend-interview-prep.vercel.app | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Build | |
| run: pnpm build | |
| - name: Deploy to Vercel Production | |
| uses: amondnet/vercel-action@v25 | |
| if: env.VERCEL_TOKEN != '' | |
| with: | |
| vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
| vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | |
| vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} | |
| vercel-args: "--prod" | |
| scope: ${{ secrets.VERCEL_ORG_ID }} | |
| env: | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} |