-
Notifications
You must be signed in to change notification settings - Fork 7
119 lines (101 loc) · 3.65 KB
/
Copy pathpr-quality.yml
File metadata and controls
119 lines (101 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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