@@ -135,3 +135,84 @@ jobs:
135135 ./lightpanda serve & echo $! > LPD.pid
136136 go run runner/main.go --verbose
137137 kill `cat LPD.pid`
138+
139+ cdp-bench :
140+ name : cdp-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 : write commit
182+ run : |
183+ echo "${{github.sha}}" > commit.txt
184+
185+ - name : upload artifact
186+ uses : actions/upload-artifact@v4
187+ with :
188+ name : bench-results
189+ path : |
190+ bench.json
191+ commit.txt
192+ retention-days : 10
193+
194+
195+ cpd-bench-fmt :
196+ name : perf-fmt
197+ needs : cdp-bench
198+
199+ # Don't execute on PR
200+ if : github.event_name != 'pull_request'
201+
202+ runs-on : ubuntu-latest
203+ timeout-minutes : 15
204+
205+ container :
206+ image : ghcr.io/lightpanda-io/perf-fmt:latest
207+ credentials :
208+ username : ${{ github.actor }}
209+ password : ${{ secrets.GITHUB_TOKEN }}
210+
211+ steps :
212+ - name : download artifact
213+ uses : actions/download-artifact@v4
214+ with :
215+ name : bench-results
216+
217+ - name : format and send json result
218+ run : /perf-fmt cdp ${{ github.sha }} bench.json
0 commit comments