feat: implement reputation system for contributors #82
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: Frontend CI | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - "frontend/**" | |
| - ".github/workflows/frontend-ci.yml" | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "frontend/**" | |
| jobs: | |
| frontend-ci: | |
| name: Frontend Build and Format Checks | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| # ----------------------------------- | |
| # Checkout repository | |
| # ----------------------------------- | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # ----------------------------------- | |
| # Set up Node.js environment | |
| # ----------------------------------- | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| # ----------------------------------- | |
| # Detect and set up package manager | |
| # ----------------------------------- | |
| - name: Detect package manager | |
| id: pm | |
| run: | | |
| if [ -f "pnpm-lock.yaml" ]; then | |
| echo "manager=pnpm" >> $GITHUB_OUTPUT | |
| elif [ -f "yarn.lock" ]; then | |
| echo "manager=yarn" >> $GITHUB_OUTPUT | |
| else | |
| echo "manager=npm" >> $GITHUB_OUTPUT | |
| fi | |
| # ----------------------------------- | |
| # Set up pnpm (if using pnpm) | |
| # Pin to packageManager in frontend/package.json — "latest" (pnpm 11+) | |
| # requires Node >= 22.13 and crashes on Node 20 (node:sqlite). | |
| # ----------------------------------- | |
| - name: Set up pnpm | |
| if: steps.pm.outputs.manager == 'pnpm' | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.26.1 | |
| # ----------------------------------- | |
| # Cache dependencies | |
| # ----------------------------------- | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| .next/cache | |
| key: ${{ runner.os }}-deps-${{ hashFiles('frontend/package-lock.json', 'frontend/pnpm-lock.yaml', 'frontend/yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-deps- | |
| # ----------------------------------- | |
| # Install dependencies | |
| # ----------------------------------- | |
| - name: Install dependencies | |
| run: | | |
| if [ "${{ steps.pm.outputs.manager }}" = "pnpm" ]; then | |
| pnpm install --frozen-lockfile | |
| elif [ "${{ steps.pm.outputs.manager }}" = "yarn" ]; then | |
| yarn install --frozen-lockfile | |
| else | |
| npm ci | |
| fi | |
| # ----------------------------------- | |
| # Lint check (ESLint) — refs #84 | |
| # No continue-on-error: lint failures must fail the job directly so | |
| # branch protection can block merges on lint errors. | |
| # No --fix flag: this workflow only reports, never auto-commits. | |
| # ----------------------------------- | |
| - name: Lint | |
| run: | | |
| if [ "${{ steps.pm.outputs.manager }}" = "pnpm" ]; then | |
| pnpm lint | |
| elif [ "${{ steps.pm.outputs.manager }}" = "yarn" ]; then | |
| yarn lint | |
| else | |
| npm run lint | |
| fi | |
| # ----------------------------------- | |
| # Unit and E2E tests | |
| # ----------------------------------- | |
| - name: Run frontend tests | |
| run: | | |
| if [ "${{ steps.pm.outputs.manager }}" = "pnpm" ]; then | |
| pnpm test | |
| elif [ "${{ steps.pm.outputs.manager }}" = "yarn" ]; then | |
| yarn test | |
| else | |
| npm test | |
| fi | |
| # ----------------------------------- | |
| # Build check | |
| # ----------------------------------- | |
| - name: Build frontend | |
| run: | | |
| if [ "${{ steps.pm.outputs.manager }}" = "pnpm" ]; then | |
| pnpm build | |
| elif [ "${{ steps.pm.outputs.manager }}" = "yarn" ]; then | |
| yarn build | |
| else | |
| npm run build | |
| fi |