-
Notifications
You must be signed in to change notification settings - Fork 0
171 lines (141 loc) · 5.86 KB
/
Copy pathci.yml
File metadata and controls
171 lines (141 loc) · 5.86 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: mlugg/setup-zig@v2
with:
version: 0.15.2
- name: Install binaryen (wasm-opt)
run: sudo apt-get install -y binaryen
- name: Cache bun dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock', 'package.json') }}
restore-keys: bun-${{ runner.os }}-
- name: Install
run: bun install
- name: Build
run: bun run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 1
test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Cache bun dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock', 'package.json') }}
restore-keys: bun-${{ runner.os }}-
- name: Install
run: bun install
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Test
run: bun run test
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Test — Worker Transferable (Playwright)
run: npx playwright test --config test/browser/playwright.config.ts
benchmark:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Cache bun dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock', 'package.json') }}
restore-keys: bun-${{ runner.os }}-
- name: Install
run: bun install
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Install bench dependencies
run: cd bench/ai-parsers && bun install
- name: Benchmark — Parse & Stream
run: |
timeout 300 bun --expose-gc bench/parse-stream.mjs 2>&1 | tee /tmp/bench-parse.txt || echo '⏱ Exceeded 5 min timeout' >> /tmp/bench-parse.txt
- name: Benchmark — Time to First Action
run: |
timeout 300 bun --expose-gc bench/time-to-first-action.mjs 2>&1 | tee /tmp/bench-ttfa.txt || echo '⏱ Exceeded 5 min timeout' >> /tmp/bench-ttfa.txt
- name: Benchmark — AI SDK Comparison
run: |
cd bench/ai-parsers && timeout 300 bun --expose-gc bench.mjs 2>&1 | tee /tmp/bench-ai.txt || echo '⏱ Exceeded 5 min timeout' >> /tmp/bench-ai.txt
- name: Benchmark — Deep Compare
run: |
timeout 300 node --expose-gc bench/deep-compare.mjs 2>&1 | tee /tmp/bench-deep-compare.txt || echo '⏱ Exceeded 5 min timeout' >> /tmp/bench-deep-compare.txt
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Benchmark — Worker Transfer vs Clone (Playwright)
run: |
npx playwright test --config bench/browser/playwright.config.ts 2>&1 | tee /tmp/bench-worker.txt || true
- name: Post benchmark results to summary
if: always()
run: |
echo '## Benchmark Results' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '<details><summary>Parse & Stream</summary>' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat /tmp/bench-parse.txt >> $GITHUB_STEP_SUMMARY 2>/dev/null || echo 'No output'>> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '</details>' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '<details><summary>Time to First Action</summary>' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat /tmp/bench-ttfa.txt >> $GITHUB_STEP_SUMMARY 2>/dev/null || echo 'No output' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '</details>' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '<details><summary>AI SDK Comparison</summary>' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat /tmp/bench-ai.txt >> $GITHUB_STEP_SUMMARY 2>/dev/null || echo 'No output' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '</details>' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '<details><summary>Deep Compare</summary>' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat /tmp/bench-deep-compare.txt >> $GITHUB_STEP_SUMMARY 2>/dev/null || echo 'No output' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '</details>' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '<details><summary>Worker Transfer vs Clone (Browser)</summary>' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat /tmp/bench-worker.txt >> $GITHUB_STEP_SUMMARY 2>/dev/null || echo 'No output' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '</details>' >> $GITHUB_STEP_SUMMARY