Skip to content

job order

job order #24

Workflow file for this run

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
# The script will use this path if you update it to respect the env var,
# otherwise it installs to the default location.
# For the script provided earlier, it uses 'pnpm exec playwright install'
# which defaults to ~/.cache/ms-playwright.
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.cache/ms-playwright
jobs:
# ===========================================================================
# JOB 1: INFRASTRUCTURE & BUILD
# Checks: Linting, Typos, Build Compilation (handled by setup.sh)
# ===========================================================================
infra-check:
name: 🏗️ Infra & Build
runs-on: self-hosted
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4

Check failure on line 32 in .github/workflows/pr-quality.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/pr-quality.yml

Invalid workflow file

You have an error in your yaml syntax on line 32
with: { ref: ${{ inputs.branch || github.ref }}, fetch-depth: 0, clean: true }
# --- CI OPTIMIZATION (Runs BEFORE script) ---
- 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: Cache Playwright 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-
# ---------------------------------------------
- name: Pre-configure CI Environment
run: |
# We create this first so setup.sh sees it and skips generating default placeholders
mkdir -p logs
echo "NEXTAUTH_URL=http://127.0.0.1:3000" > .env.local
echo "NEXTAUTH_SECRET=ci-secret" >> .env.local
echo "SPOTIFY_CLIENT_ID=mock_id" >> .env.local
echo "SPOTIFY_CLIENT_SECRET=mock_secret" >> .env.local
- name: Run Setup Script
run: |
chmod +x ./scripts/setup.sh
./scripts/setup.sh
# This script runs:
# 1. pnpm install (fast because of cache above)
# 2. playwright install (fast because of cache above)
# 3. pnpm run build (verifies compilation)
- name: Lint Code
run: pnpm run lint
# ===========================================================================
# JOB 2: CORE LOGIC TESTS
# ===========================================================================
core-tests:
name: 🧪 Core Logic
needs: infra-check
runs-on: self-hosted
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with: { ref: ${{ inputs.branch || github.ref }}, clean: true }
# --- CI OPTIMIZATION ---
- 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 }
- uses: actions/cache@v4
id: playwright-cache
with:
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-playwright-
# -----------------------
- name: Pre-configure CI Environment
run: |
echo "NEXTAUTH_URL=http://127.0.0.1:3000" > .env.local
echo "NEXTAUTH_SECRET=ci-secret" >> .env.local
- name: Run Setup Script
run: |
chmod +x ./scripts/setup.sh
./scripts/setup.sh
- name: Run Core Tests (Skip Visuals)
run: pnpm exec playwright test --project=chromium --grep-invert "@visual"
# ===========================================================================
# JOB 3: VISUAL REGRESSION TESTS
# ===========================================================================
visual-tests:
name: 🎨 Visual Regression
needs: core-tests
runs-on: self-hosted
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with: { ref: ${{ inputs.branch || github.ref }}, clean: true }
# --- CI OPTIMIZATION ---
- 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 }
- uses: actions/cache@v4
id: playwright-cache
with:
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-playwright-
# -----------------------
- name: Pre-configure CI Environment
run: |
echo "NEXTAUTH_URL=http://127.0.0.1:3000" > .env.local
echo "NEXTAUTH_SECRET=ci-secret" >> .env.local
- name: Run Setup Script
run: |
chmod +x ./scripts/setup.sh
./scripts/setup.sh
- 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