-
Notifications
You must be signed in to change notification settings - Fork 0
270 lines (233 loc) · 8.85 KB
/
Copy pathreal-pi-e2e.yml
File metadata and controls
270 lines (233 loc) · 8.85 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
name: Real-pi E2E (fake model)
# Runs the genuine `pi` binary against a local deterministic fake-model server
# (server/test/fake-model). This isolates the pi integration contract — RPC
# framing, provider selection, streaming — from the app. Three jobs:
#
# real-pi-pinned — pinned pi version, headless smoke on Linux, blocking on PRs.
# Failure = our bug.
# real-pi-app — real pi + Flutter e2e on iOS simulator (macos-15).
# Full stack proof. Pinned pi, MANUAL (workflow_dispatch)
# only — macOS runners are expensive, so not a per-PR gate.
# real-pi-canary — pi@latest on a schedule. Failure = a pi upgrade broke the
# integration; opens an issue so we can bump the pin.
on:
pull_request:
branches: [ main ]
paths:
- 'server/**'
- 'app/**'
- '.github/workflows/real-pi-e2e.yml'
push:
branches: [ main ]
paths:
- 'server/**'
- 'app/**'
- '.github/workflows/real-pi-e2e.yml'
schedule:
# Weekly canary against pi@latest — Mondays 06:00 UTC.
- cron: '0 6 * * 1'
workflow_dispatch: {}
env:
# Bump deliberately when the canary goes red. Keep in sync with the pi
# version the team runs locally.
PI_PINNED_VERSION: '0.80.3'
jobs:
# Blocking gate on PRs/pushes: reproducible headless run against the pinned pi.
# Linux, no simulator needed, fast.
real-pi-pinned:
if: github.event_name == 'push' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: server
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '22'
- name: Enable Corepack
run: corepack enable
- name: Prepare pnpm
run: corepack prepare pnpm@11.8.0 --activate
- name: Cache pnpm store
uses: actions/cache@v5
with:
path: ~/.local/share/pnpm/store
key: ${{ runner.os }}-pnpm-${{ hashFiles('server/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install dependencies (lockfile-locked)
run: pnpm secure:install
- name: Install pinned pi
run: npm install -g "@earendil-works/pi-coding-agent@${PI_PINNED_VERSION}"
- name: Record pi version
run: pi --version
- name: Real-pi smoke (fake model)
run: pnpm e2e:verify-pi
# Full-stack on macOS: real pi + real Flutter e2e via `tool/e2e.sh --mode real`
# on an iOS simulator. Proves the complete makit↔pi integration on the target.
# macOS runners are expensive — MANUAL (workflow_dispatch) only, not a per-PR gate.
real-pi-app:
if: github.event_name == 'workflow_dispatch'
runs-on: macos-15
timeout-minutes: 40
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.44.4'
channel: 'stable'
cache: true
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '22'
- name: Enable Corepack
run: corepack enable
- name: Prepare pnpm
run: corepack prepare pnpm@11.8.0 --activate
- name: Cache pnpm store
uses: actions/cache@v5
with:
path: ~/.local/share/pnpm/store
key: ${{ runner.os }}-pnpm-${{ hashFiles('server/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Cache Flutter packages
uses: actions/cache@v5
with:
path: ~/.pub-cache
key: ${{ runner.os }}-flutter-${{ hashFiles('app/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-flutter-
- name: Cache CocoaPods
uses: actions/cache@v5
with:
path: |
~/Library/Caches/CocoaPods
~/.cocoapods
app/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('app/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Cache Xcode DerivedData
uses: actions/cache@v5
with:
path: ~/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-deriveddata-${{ hashFiles('app/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-deriveddata-
- name: Install server dependencies (lockfile-locked)
working-directory: server
run: pnpm secure:install
- name: Install app dependencies (lockfile-locked)
working-directory: app
run: flutter pub get --enforce-lockfile
- name: Install pinned pi
run: npm install -g "@earendil-works/pi-coding-agent@${PI_PINNED_VERSION}"
- name: Record pi version
run: pi --version
- name: Pick an available iOS simulator
run: |
# tool/e2e.sh matches MAKIT_SIM_NAME as a substring; pick the first
# available iPhone the runner's Xcode ships (model names vary by
# Xcode version, so don't hard-code "iPhone 17").
NAME=$(xcrun simctl list devices available \
| grep -E '^[[:space:]]+iPhone' \
| head -1 | sed -E 's/^[[:space:]]+//; s/ \(.*//')
if [[ -z "$NAME" ]]; then
echo "no iPhone simulator available on this runner" >&2
xcrun simctl list devices available >&2
exit 1
fi
echo "MAKIT_SIM_NAME=$NAME" >> "$GITHUB_ENV"
- name: Flutter full-stack e2e (real pi)
run: app/tool/e2e.sh --mode real
# Canary: track pi@latest so an upstream release that breaks the integration
# surfaces here (not silently on the next manual bump). Never blocks PRs.
real-pi-canary:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
issues: write
defaults:
run:
working-directory: server
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '22'
- name: Enable Corepack
run: corepack enable
- name: Prepare pnpm
run: corepack prepare pnpm@11.8.0 --activate
- name: Cache pnpm store
uses: actions/cache@v5
with:
path: ~/.local/share/pnpm/store
key: ${{ runner.os }}-pnpm-${{ hashFiles('server/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install dependencies (lockfile-locked)
run: pnpm secure:install
- name: Install pi@latest
run: npm install -g "@earendil-works/pi-coding-agent@latest"
- name: Record pi version
id: piver
run: |
VER="$(pi --version)"
echo "version=$VER" >> "$GITHUB_OUTPUT"
echo "pinned=${PI_PINNED_VERSION}" >> "$GITHUB_OUTPUT"
- name: Real-pi smoke (fake model)
run: pnpm e2e:verify-pi
- name: Open issue on canary failure
if: failure()
uses: actions/github-script@v7
with:
script: |
const latest = "${{ steps.piver.outputs.version }}" || "unknown";
const pinned = "${{ env.PI_PINNED_VERSION }}";
const title = `real-pi canary failed against pi@${latest}`;
const body = [
`The scheduled real-pi canary failed running \`pnpm e2e:verify-pi\` against **pi@${latest}**.`,
``,
`Pinned version in CI: \`${pinned}\`.`,
``,
`A pi release likely changed the RPC/model contract. Investigate, fix`,
`\`server/test/fake-model/\` or the PiAdapter as needed, then bump`,
`\`PI_PINNED_VERSION\` in \`.github/workflows/real-pi-e2e.yml\`.`,
``,
`Run: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
].join("\n");
// De-dupe: reuse an open canary issue if one exists.
const existing = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: "open",
labels: "real-pi-canary",
});
if (existing.data.length > 0) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: existing.data[0].number,
body,
});
} else {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title,
body,
labels: ["real-pi-canary"],
});
}