Skip to content

Commit 18b97df

Browse files
Merge pull request #693 from lightpanda-io/bench-runner
ci: add cdp-bench
2 parents 1a72bf5 + 087d232 commit 18b97df

File tree

1 file changed

+92
-1
lines changed

1 file changed

+92
-1
lines changed

.github/workflows/e2e-test.yml

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- uses: ./.github/actions/install
4949

5050
- name: zig build release
51-
run: zig build -Doptimize=ReleaseSafe
51+
run: zig build --release=safe -Doptimize=ReleaseSafe -Dcpu=x86_64 -Dgit_commit=$(git rev-parse --short ${{ github.sha }})
5252

5353
- name: upload artifact
5454
uses: actions/upload-artifact@v4
@@ -135,3 +135,94 @@ jobs:
135135
./lightpanda serve & echo $! > LPD.pid
136136
go run runner/main.go --verbose
137137
kill `cat LPD.pid`
138+
139+
cdp-and-hyperfine-bench:
140+
name: cdp-and-hyperfine-bench
141+
needs: zig-build-release
142+
143+
# use a self host runner.
144+
runs-on: lpd_bench_m5.large
145+
timeout-minutes: 15
146+
147+
steps:
148+
- uses: actions/checkout@v4
149+
with:
150+
repository: 'lightpanda-io/demo'
151+
fetch-depth: 0
152+
153+
- run: npm install
154+
155+
- name: download artifact
156+
uses: actions/download-artifact@v4
157+
with:
158+
name: lightpanda-build-release
159+
160+
- run: chmod a+x ./lightpanda
161+
162+
- name: run puppeteer
163+
run: |
164+
go run ws/main.go & echo $! > WS.pid
165+
./lightpanda serve & echo $! > LPD.pid
166+
RUNS=100 npm run bench-puppeteer-cdp > puppeteer.out || exit 1
167+
cat /proc/`cat LPD.pid`/status |grep VmHWM|grep -oP '\d+' > LPD.VmHWM
168+
kill `cat LPD.pid` `cat WS.pid`
169+
170+
- name: puppeteer result
171+
run: cat puppeteer.out
172+
173+
- name: json output
174+
run: |
175+
export AVG_DURATION=`cat puppeteer.out|grep 'avg run'|sed 's/avg run duration (ms) //'`
176+
export TOTAL_DURATION=`cat puppeteer.out|grep 'total duration'|sed 's/total duration (ms) //'`
177+
export LPD_VmHWM=`cat LPD.VmHWM`
178+
echo "{\"duration_total\":${TOTAL_DURATION},\"duration_avg\":${AVG_DURATION},\"mem_peak\":${LPD_VmHWM}}" > bench.json
179+
cat bench.json
180+
181+
- name: run hyperfine
182+
run: |
183+
go run ws/main.go & echo $! > WS.pid
184+
hyperfine --export-json=hyperfine.json --warmup 3 --runs 20 --shell=none "./lightpanda --dump http://127.0.0.1:1234/campfire-commerce/"
185+
kill `cat WS.pid`
186+
187+
- name: write commit
188+
run: |
189+
echo "${{github.sha}}" > commit.txt
190+
191+
- name: upload artifact
192+
uses: actions/upload-artifact@v4
193+
with:
194+
name: bench-results
195+
path: |
196+
bench.json
197+
hyperfine.json
198+
commit.txt
199+
retention-days: 10
200+
201+
202+
perf-fmt:
203+
name: perf-fmt
204+
needs: cdp-bench
205+
206+
# Don't execute on PR
207+
if: github.event_name != 'pull_request'
208+
209+
runs-on: ubuntu-latest
210+
timeout-minutes: 15
211+
212+
container:
213+
image: ghcr.io/lightpanda-io/perf-fmt:latest
214+
credentials:
215+
username: ${{ github.actor }}
216+
password: ${{ secrets.GITHUB_TOKEN }}
217+
218+
steps:
219+
- name: download artifact
220+
uses: actions/download-artifact@v4
221+
with:
222+
name: bench-results
223+
224+
- name: format and send json result
225+
run: /perf-fmt cdp ${{ github.sha }} bench.json
226+
227+
- name: format and send json result
228+
run: /perf-fmt hyperfine ${{ github.sha }} hyperfine.json

0 commit comments

Comments
 (0)