forked from letta-ai/letta-code
-
Notifications
You must be signed in to change notification settings - Fork 0
369 lines (311 loc) · 11.1 KB
/
Copy pathci.yml
File metadata and controls
369 lines (311 loc) · 11.1 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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
classify:
name: Classify change
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
release_bump_only: ${{ steps.classify.outputs.release_bump_only }}
run_heavy_ci: ${{ steps.classify.outputs.run_heavy_ci }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Detect release-bump-only change
id: classify
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "pull_request" ]; then
TITLE=$(jq -er '.pull_request.title' "$GITHUB_EVENT_PATH")
BASE_SHA=$(jq -er '.pull_request.base.sha' "$GITHUB_EVENT_PATH")
HEAD_SHA=$(jq -er '.pull_request.head.sha' "$GITHUB_EVENT_PATH")
else
TITLE=$(git log --format=%s "${{ github.event.before }}..${{ github.sha }}" | tail -n 1)
BASE_SHA="${{ github.event.before }}"
HEAD_SHA="${{ github.sha }}"
fi
CHANGED_FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA")
TITLE_MATCH=false
if [[ "$TITLE" == chore:\ bump\ version\ to* ]]; then
TITLE_MATCH=true
fi
FILES_MATCH=true
if [ -z "$CHANGED_FILES" ]; then
FILES_MATCH=false
fi
for file in $CHANGED_FILES; do
case "$file" in
package.json|package-lock.json) ;;
*)
FILES_MATCH=false
;;
esac
done
RELEASE_BUMP_ONLY=false
if [ "$TITLE_MATCH" = true ] && [ "$FILES_MATCH" = true ]; then
RELEASE_BUMP_ONLY=true
fi
echo "release_bump_only=$RELEASE_BUMP_ONLY" >> "$GITHUB_OUTPUT"
if [ "$RELEASE_BUMP_ONLY" = true ]; then
echo "run_heavy_ci=false" >> "$GITHUB_OUTPUT"
else
echo "run_heavy_ci=true" >> "$GITHUB_OUTPUT"
fi
echo "title=$TITLE"
printf 'changed_files=%s\n' "$CHANGED_FILES"
check:
name: Lint & Type Check
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.0
- name: Install dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bun install
- name: Lint & Type Check
run: bun run check
update-chain-smoke:
needs: check
name: Update Chain Smoke
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.0
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: "22"
- name: Install dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bun install
- name: Build bundle
run: bun run build
- name: Manual update-chain smoke test
run: bun run test:update-chain:manual
build:
needs: [classify, check]
if: needs.classify.outputs.run_heavy_ci == 'true'
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: macOS arm64 (macos-14)
runner: macos-14
- name: Linux x64 (ubuntu-24.04)
runner: ubuntu-24.04
- name: Linux arm64 (ubuntu-24.04-arm)
runner: ubuntu-24.04-arm
- name: Windows x64 (windows-latest)
runner: windows-latest
defaults:
run:
shell: bash
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.0
- name: Install dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bun install
- name: Unlock GNOME Keyring
if: runner.os == 'Linux'
uses: t1m0thyj/unlock-keyring@v1
- name: Run tests (extended timeout)
# Unit tests must pass for fork PRs (no secrets). Keep API-dependent tests
# in a separate gated step.
run: bun test src/tests --timeout 15000
- name: Run integration tests (API)
# Only run on push to main or PRs from the same repo (not forks, to protect secrets)
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
env:
LETTA_API_KEY: ${{ secrets.LETTA_API_KEY }}
run: bun test src/integration-tests --timeout 15000
- name: Build bundle
run: bun run build
- name: CLI help smoke test
run: ./letta.js --help
- name: CLI version smoke test
run: ./letta.js --version || true
- name: Bundle size check
run: |
if [ "$RUNNER_OS" = "Windows" ]; then
SIZE=$(powershell -command "(Get-Item letta.js).length")
else
SIZE=$(stat -f%z ./letta.js 2>/dev/null || stat -c%s ./letta.js 2>/dev/null)
fi
SIZE_MB=$((SIZE / 1024 / 1024))
echo "Bundle size: $SIZE bytes (~${SIZE_MB}MB)"
# Warn if bundle is larger than 50MB
if [ $SIZE -gt 52428800 ]; then
echo "⚠️ Warning: Bundle size is larger than 50MB"
else
echo "✓ Bundle size is acceptable"
fi
# Test npm install flow with native shell to catch shebang issues
# This uses PowerShell on Windows (not Git Bash) to match real user experience
- name: Test npm install flow (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
npm pack
npm install -g (Get-Item letta-ai-letta-code-*.tgz).FullName
letta --help
- name: Test npm install flow (Unix)
if: runner.os != 'Windows'
shell: sh
run: |
npm pack
npm install -g ./letta-ai-letta-code-*.tgz
letta --help
- name: Headless smoke test (API)
# Only run on push to main or PRs from the same repo (not forks, to protect secrets)
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
env:
LETTA_API_KEY: ${{ secrets.LETTA_API_KEY }}
run: ./letta.js --prompt "ping" --tools "" --permission-mode plan
- name: Windows integration test
# Only run on Windows, with API key available
if: ${{ runner.os == 'Windows' && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) }}
env:
LETTA_API_KEY: ${{ secrets.LETTA_API_KEY }}
run: bun run src/tests/headless-windows.ts --model sonnet-4.6-low
- name: Publish dry-run
if: ${{ github.event_name == 'push' }}
env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
LETTA_API_KEY: dummy
run: bun publish --dry-run
- name: Pack (no auth available)
if: ${{ github.event_name != 'push' }}
run: bun pm pack
node18-smoke:
needs: [classify, check]
if: needs.classify.outputs.run_heavy_ci == 'true'
name: Node 18 Smoke Test
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.0
- name: Install dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bun install
- name: Build bundle
run: bun run build
- name: Setup Node 18
uses: actions/setup-node@v6
with:
node-version: "18"
- name: Verify Node version
run: node --version
- name: CLI smoke test (Node 18)
run: node ./letta.js --help
headless:
needs: [classify, check]
if: needs.classify.outputs.run_heavy_ci == 'true'
name: Headless / ${{ matrix.model }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Note: gpt-4.1 / gemini-3.1 / gemini-3-flash / glm-4.7 are temporarily
# excluded here due to intermittent provider-side scenario instability.
model: [gpt-5-minimal, sonnet-4.6-low, haiku]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.0
- name: Install dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bun install
- name: Run headless scenario (all outputs)
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
env:
LETTA_API_KEY: ${{ secrets.LETTA_API_KEY }}
run: |
bun run src/tests/headless-scenario.ts --model "${{ matrix.model }}" --output text --parallel on
bun run src/tests/headless-scenario.ts --model "${{ matrix.model }}" --output json --parallel on
bun run src/tests/headless-scenario.ts --model "${{ matrix.model }}" --output stream-json --parallel on
docker:
needs: [classify, check]
name: Docker Integration
runs-on: ubuntu-latest
# Only run on push to main or PRs from the same repo (not forks, to protect secrets)
if: ${{ needs.classify.outputs.run_heavy_ci == 'true' && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.0
- name: Install dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bun install
- name: Build bundle
run: bun run build
- name: Start Letta Docker server
run: |
docker run -d \
--name letta-server \
-p 8283:8283 \
-e ANTHROPIC_API_KEY=${{ secrets.ANTHROPIC_API_KEY }} \
letta/letta:latest
- name: Wait for Letta server to be ready
run: |
echo "Waiting for Letta server to be healthy..."
timeout 120 bash -c 'until curl -sf http://localhost:8283/v1/health; do sleep 2; done'
echo "Letta server is ready!"
- name: Docker smoke test
env:
LETTA_BASE_URL: http://localhost:8283
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: ./letta.js --prompt "ping" --tools "" --permission-mode plan --model haiku
- name: Docker logs (on failure)
if: failure()
run: docker logs letta-server
- name: Stop Letta Docker server
if: always()
run: docker stop letta-server || true