updating ci workflow #20
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' | |
| jobs: | |
| quality-gate: | |
| runs-on: self-hosted | |
| timeout-minutes: 20 | |
| env: | |
| FORCE_COLOR: 1 | |
| # Critical: Tell Playwright where to look for the cached binaries | |
| PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.cache/ms-playwright | |
| steps: | |
| - name: Checkout & Prep | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.branch || github.ref }} | |
| fetch-depth: 0 | |
| clean: true | |
| # 1. Setup pnpm (Package Manager) | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| # Version inferred from package.json "packageManager" | |
| run_install: false | |
| # 2. Get Dynamic Store Path (Fixes "0% Cache Hit") | |
| - name: Get pnpm store directory | |
| id: pnpm-cache | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
| # 3. Explicit pnpm Store Cache | |
| - 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- | |
| # 4. Setup Node.js (Linking to the cache we just set up) | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20.x" | |
| cache-dependency-path: pnpm-lock.yaml | |
| # We handle store caching manually above for better reliability on self-hosted | |
| # 5. Cache Next.js Build | |
| - name: Cache Next.js | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ github.workspace }}/.next/cache | |
| key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}- | |
| # 6. Cache Playwright Browsers | |
| - name: Cache Playwright Browsers | |
| 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: Create Runtime Directories | |
| run: | | |
| mkdir -p logs | |
| echo "✅ Created 'logs' directory" | |
| - name: Configure .env.local | |
| run: | | |
| echo "📝 Creating .env.local with development defaults..." | |
| cat > .env.local <<EOL | |
| NEXTAUTH_URL=http://127.0.0.1:3000 | |
| NEXTAUTH_SECRET=jules-dev-environment-secret-123 | |
| SPOTIFY_CLIENT_ID=placeholder_id | |
| SPOTIFY_CLIENT_SECRET=placeholder_secret | |
| EOL | |
| # 7. Optimized Dependency Install | |
| - name: Configure pnpm settings | |
| run: pnpm config set side-effects-cache true | |
| - name: Install Dependencies | |
| # --prefer-offline: Trust the store cache we just restored | |
| run: pnpm install --frozen-lockfile --prefer-offline | |
| # 8. Install Playwright (No Sudo / User Space Only) | |
| - name: Install Playwright Browsers | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| # Only installs the binary to our cached folder. | |
| # Assumes OS libraries (libgbm, etc.) are already on the runner. | |
| run: pnpm exec playwright install chromium | |
| - name: Lint Code | |
| run: pnpm run lint | |
| - name: Verify Build | |
| run: pnpm run build | |
| - name: Run Tests | |
| run: pnpm run test |