Skip to content

Commit 272b16b

Browse files
committed
up
1 parent 164433c commit 272b16b

1 file changed

Lines changed: 117 additions & 0 deletions

File tree

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: "Copilot Setup Steps"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- .github/workflows/copilot-setup-steps.yml
8+
pull_request:
9+
paths:
10+
- .github/workflows/copilot-setup-steps.yml
11+
12+
jobs:
13+
copilot-setup-steps:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 30
16+
permissions:
17+
contents: read
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v5
22+
23+
# Engines: Node >=20, npm >=10
24+
- name: Set up Node 20
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: "20"
28+
cache: "npm"
29+
30+
- name: Use npm 10 (per package.json engines)
31+
run: npm i -g npm@10
32+
33+
- name: Copy env file
34+
run: |
35+
if [ -f ".env.example" ]; then
36+
cp .env.example .env
37+
fi
38+
39+
- name: Install dependencies
40+
run: npm ci
41+
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) ----------
57+
- name: Generate Prisma client (SQLite)
58+
env:
59+
DATABASE_URL: "file:./prisma/dev.db"
60+
run: |
61+
mkdir -p prisma
62+
npx prisma generate
63+
64+
- name: Init SQLite schema (db push)
65+
env:
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"
72+
run: |
73+
if [ -f "prisma/schema.prisma" ] && [ -d "prisma/migrations" ]; then
74+
npx prisma migrate deploy || true
75+
fi
76+
77+
- name: Seed database (uses your npm script)
78+
env:
79+
DATABASE_URL: "file:./prisma/dev.db"
80+
run: |
81+
if [ -f "prisma/seed.ts" ]; then
82+
npm run db:seed
83+
else
84+
echo "No prisma/seed.ts found; skipping."
85+
fi
86+
87+
# ---------- Type checking ----------
88+
- name: Type check
89+
run: npm run type-check
90+
91+
- name: Save type-check errors to JSON (PowerShell script with Linux fallback)
92+
run: |
93+
npm run type-check:save || pwsh -File ./scripts/collect-type-errors.ps1
94+
shell: bash
95+
96+
# ---------- Next.js MCP warm start (guarded) ----------
97+
- name: Warm-start Next.js dev server (time-boxed)
98+
if: ${{ hashFiles('app/**','pages/**','src/app/**','src/pages/**') != '' }}
99+
env:
100+
NODE_ENV: development
101+
run: |
102+
(npm run dev & echo $! > /tmp/next_pid) || true
103+
sleep 15 || true
104+
if [ -f /tmp/next_pid ]; then
105+
kill $(cat /tmp/next_pid) || true
106+
fi
107+
108+
# ---------- Optional caches ----------
109+
- name: Cache Next.js build artifacts
110+
uses: actions/cache@v4
111+
with:
112+
path: |
113+
~/.npm
114+
.next/cache
115+
key: ${{ runner.os }}-next-${{ hashFiles('package-lock.json') }}
116+
restore-keys: |
117+
${{ runner.os }}-next-

0 commit comments

Comments
 (0)