-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (114 loc) · 4.05 KB
/
copilot-setup-steps.yml
File metadata and controls
133 lines (114 loc) · 4.05 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: "Copilot Setup Steps"
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml
jobs:
copilot-setup-steps:
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v5
# Engines: Node >=20, npm >=10
- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Use npm 10 (per package.json engines)
run: npm i -g npm@10
- name: Copy env file
run: |
if [ -f ".env.example" ]; then
cp .env.example .env
fi
- name: Install dependencies
run: npm ci
# ---------- Playwright MCP (system deps + browsers) ----------
- name: Install Playwright deps & browsers
if: ${{ hashFiles('playwright.config.*') != '' || hashFiles('.playwright-mcp/**') != '' }}
run: |
npx playwright install-deps
npx playwright install
- name: Cache Playwright browsers
if: ${{ hashFiles('playwright.config.*') != '' || hashFiles('.playwright-mcp/**') != '' }}
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('playwright.config.*', '.playwright-mcp/**') }}
# ---------- Prisma + SQLite (prisma/dev.db) ----------
- name: Generate Prisma client (SQLite)
env:
DATABASE_URL: "file:./prisma/dev.db"
run: |
mkdir -p prisma
npx prisma generate
- name: Init SQLite schema (db push)
env:
DATABASE_URL: "file:./prisma/dev.db"
run: npx prisma db push --accept-data-loss
- name: Apply migrations (optional if present)
env:
DATABASE_URL: "file:./prisma/dev.db"
run: |
if [ -f "prisma/schema.prisma" ] && [ -d "prisma/migrations" ]; then
npx prisma migrate deploy || true
fi
- name: Seed database (uses your npm script)
env:
DATABASE_URL: "file:./prisma/dev.db"
run: |
if [ -f "prisma/seed.ts" ]; then
npm run db:seed
else
echo "No prisma/seed.ts found; skipping."
fi
# ---------- Type checking ----------
# - name: Type check
# run: npm run type-check
# - name: Save type-check errors to JSON (PowerShell script with Linux fallback)
# run: |
# npm run type-check:save || pwsh -File ./scripts/collect-type-errors.ps1
# shell: bash
# ---------- Next.js MCP warm start (guarded) ----------
- name: Warm-start Next.js dev server (time-boxed)
if: ${{ hashFiles('app/**','pages/**','src/app/**','src/pages/**') != '' }}
env:
NODE_ENV: development
run: |
(npm run dev & echo $! > /tmp/next_pid) || true
sleep 15 || true
if [ -f /tmp/next_pid ]; then
kill $(cat /tmp/next_pid) || true
fi
# ---------- Optional caches ----------
- name: Cache Next.js build artifacts
uses: actions/cache@v4
with:
path: |
~/.npm
.next/cache
key: ${{ runner.os }}-next-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-next-
# Prepare and (optionally) upload Copilot runtime logs to avoid warnings
- name: Prepare Copilot runtime logs
run: |
mkdir -p /home/runner/work/_temp/runtime-logs
: > /home/runner/work/_temp/runtime-logs/blocked.jsonl
: > /home/runner/work/_temp/runtime-logs/blocked.md
- name: Upload Copilot runtime logs (if present)
uses: actions/upload-artifact@v4
with:
name: copilot-runtime-logs
path: |
/home/runner/work/_temp/runtime-logs/blocked.jsonl
/home/runner/work/_temp/runtime-logs/blocked.md
if-no-files-found: ignore