@@ -20,13 +20,15 @@ jobs:
2020 - name : Checkout code
2121 uses : actions/checkout@v5
2222
23- - name : Set up Node 20 (project supports 18.x+, using 20 in CI for consistency and latest features)
23+ # Engines: Node >=20, npm >=10
24+ - name : Set up Node 20
2425 uses : actions/setup-node@v4
2526 with :
2627 node-version : " 20"
2728 cache : " npm"
28- - name : Use npm 11
29- run : npm i -g npm@11
29+
30+ - name : Use npm 10 (per package.json engines)
31+ run : npm i -g npm@10
3032
3133 - name : Copy env file
3234 run : |
@@ -37,25 +39,44 @@ jobs:
3739 - name : Install dependencies
3840 run : npm ci
3941
40- # ---------- Prisma + SQLite ----------
42+ # ---------- Playwright MCP (system deps + browsers) ----------
43+ - name : Install Playwright deps & browsers
44+ if : ${{ hashFiles('playwright.config.*') != '' || hashFiles('.playwright-mcp/**') != '' }}
45+ run : |
46+ npx playwright install-deps
47+ npx playwright install
48+
49+ - name : Cache Playwright browsers
50+ if : ${{ hashFiles('playwright.config.*') != '' || hashFiles('.playwright-mcp/**') != '' }}
51+ uses : actions/cache@v4
52+ with :
53+ path : ~/.cache/ms-playwright
54+ key : ${{ runner.os }}-playwright-${{ hashFiles('playwright.config.*', '.playwright-mcp/**') }}
55+
56+ # ---------- Prisma + SQLite (prisma/dev.db) ----------
4157 - name : Generate Prisma client (SQLite)
4258 env :
43- DATABASE_URL : " file:./dev.db"
59+ DATABASE_URL : " file:./prisma/ dev.db"
4460 run : |
4561 mkdir -p prisma
4662 npx prisma generate
4763
48- - name : Apply migrations (create prisma/dev. db if needed )
64+ - name : Init SQLite schema ( db push )
4965 env :
50- DATABASE_URL : " file:./dev.db"
66+ DATABASE_URL : " file:./prisma/dev.db"
67+ run : npx prisma db push --accept-data-loss
68+
69+ - name : Apply migrations (optional if present)
70+ env :
71+ DATABASE_URL : " file:./prisma/dev.db"
5172 run : |
52- if [ -f "prisma/schema.prisma" ]; then
73+ if [ -f "prisma/schema.prisma" ] && [ -d "prisma/migrations" ] ; then
5374 npx prisma migrate deploy || true
5475 fi
5576
5677 - name : Seed database (uses your npm script)
5778 env :
58- DATABASE_URL : " file:./dev.db"
79+ DATABASE_URL : " file:./prisma/ dev.db"
5980 run : |
6081 if [ -f "prisma/seed.ts" ]; then
6182 npm run db:seed
@@ -67,26 +88,14 @@ jobs:
6788 - name : Type check
6889 run : npm run type-check
6990
70- - name : Save type-check errors to JSON (PowerShell script)
91+ - name : Save type-check errors to JSON (PowerShell script with Linux fallback )
7192 run : |
72- # Run npm script first; if it fails, fall back to direct PowerShell execution
7393 npm run type-check:save || pwsh -File ./scripts/collect-type-errors.ps1
7494 shell : bash
7595
76- # ---------- Playwright MCP ----------
77- - name : Install Playwright browsers (+ deps)
78- if : ${{ hashFiles('playwright.config.*') != '' || hashFiles('.playwright-mcp/**') != '' }}
79- run : npx playwright install --with-deps
80-
81- - name : Cache Playwright browsers
82- if : ${{ hashFiles('playwright.config.*') != '' || hashFiles('.playwright-mcp/**') != '' }}
83- uses : actions/cache@v4
84- with :
85- path : ~/.cache/ms-playwright
86- key : ${{ runner.os }}-playwright-${{ hashFiles('playwright.config.*', '.playwright-mcp/**') }}
87-
88- # ---------- Next.js MCP warm start ----------
96+ # ---------- Next.js MCP warm start (guarded) ----------
8997 - name : Warm-start Next.js dev server (time-boxed)
98+ if : ${{ hashFiles('app/**','pages/**','src/app/**','src/pages/**') != '' }}
9099 env :
91100 NODE_ENV : development
92101 run : |
0 commit comments