updating ci workflow #23
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: PR Quality Gate | |
| on: | |
| pull_request: | |
| branches: [ "leader" ] | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: 'Branch to check' | |
| required: true | |
| default: 'leader' | |
| env: | |
| FORCE_COLOR: 1 | |
| PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.cache/ms-playwright | |
| jobs: | |
| # =========================================================================== | |
| # JOB 1: INFRASTRUCTURE & BUILD | |
| # Must pass before any testing begins | |
| # =========================================================================== | |
| infra-check: | |
| name: 🏗️ Infra & Build | |
| runs-on: self-hosted | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.branch || github.ref }} | |
| fetch-depth: 0 | |
| clean: true | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Get pnpm store directory | |
| id: pnpm-cache | |
| shell: bash | |
| run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20.x" | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Configure pnpm & Install | |
| run: | | |
| pnpm config set side-effects-cache true | |
| pnpm install --frozen-lockfile --prefer-offline | |
| - name: Create Runtime Envs | |
| run: | | |
| mkdir -p logs | |
| echo "NEXTAUTH_URL=http://127.0.0.1:3000" > .env.local | |
| echo "NEXTAUTH_SECRET=ci-secret" >> .env.local | |
| - name: Lint Code | |
| run: pnpm run lint | |
| - name: Verify Build | |
| run: pnpm run build | |
| # =========================================================================== | |
| # JOB 2: CORE LOGIC TESTS | |
| # DEPENDS ON: infra-check | |
| # =========================================================================== | |
| core-tests: | |
| name: 🧪 Core Logic | |
| needs: infra-check # 👈 ENFORCES ORDER | |
| runs-on: self-hosted | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.branch || github.ref }} | |
| clean: true | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - id: pnpm-cache | |
| run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: ${{ runner.os }}-pnpm-store- | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20.x" | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Cache Browsers | |
| id: playwright-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} | |
| key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: ${{ runner.os }}-playwright- | |
| - run: | | |
| pnpm config set side-effects-cache true | |
| pnpm install --frozen-lockfile --prefer-offline | |
| - name: Install Playwright (Binary Only) | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| run: pnpm exec playwright install chromium | |
| - name: Create Runtime Envs | |
| run: | | |
| echo "NEXTAUTH_URL=http://127.0.0.1:3000" > .env.local | |
| echo "NEXTAUTH_SECRET=ci-secret" >> .env.local | |
| - name: Run Core Tests (Skip Visuals) | |
| run: pnpm exec playwright test --project=chromium --grep-invert "@visual" | |
| # =========================================================================== | |
| # JOB 3: VISUAL REGRESSION TESTS | |
| # DEPENDS ON: core-tests | |
| # =========================================================================== | |
| visual-tests: | |
| name: 🎨 Visual Regression | |
| needs: core-tests # 👈 ENFORCES ORDER | |
| runs-on: self-hosted | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.branch || github.ref }} | |
| clean: true | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - id: pnpm-cache | |
| run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: ${{ runner.os }}-pnpm-store- | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20.x" | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Cache Browsers | |
| id: playwright-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} | |
| key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: ${{ runner.os }}-playwright- | |
| - run: | | |
| pnpm config set side-effects-cache true | |
| pnpm install --frozen-lockfile --prefer-offline | |
| - name: Install Playwright (Binary Only) | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| run: pnpm exec playwright install chromium | |
| - name: Create Runtime Envs | |
| run: | | |
| echo "NEXTAUTH_URL=http://127.0.0.1:3000" > .env.local | |
| echo "NEXTAUTH_SECRET=ci-secret" >> .env.local | |
| - name: Run Visual Tests | |
| run: pnpm exec playwright test --project=chromium --grep "@visual" | |
| - name: Upload Report on Failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report-visual | |
| path: playwright-report/ | |
| retention-days: 5 |