From 13091e0de4fe5b1d0487f3e441f9e892b12b8843 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 26 May 2025 12:02:48 +0200 Subject: [PATCH] ci: add cdp-bench The cdp bench is run on self host machine. --- .github/workflows/e2e-test.yml | 81 ++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index a8b115fd..b5bd2014 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -135,3 +135,84 @@ jobs: ./lightpanda serve & echo $! > LPD.pid go run runner/main.go --verbose kill `cat LPD.pid` + + cdp-bench: + name: cdp-bench + needs: zig-build-release + + # use a self host runner. + runs-on: lpd_bench_m5.large + timeout-minutes: 15 + + steps: + - uses: actions/checkout@v4 + with: + repository: 'lightpanda-io/demo' + fetch-depth: 0 + + - run: npm install + + - name: download artifact + uses: actions/download-artifact@v4 + with: + name: lightpanda-build-release + + - run: chmod a+x ./lightpanda + + - name: run puppeteer + run: | + go run ws/main.go & echo $! > WS.pid + ./lightpanda serve & echo $! > LPD.pid + RUNS=100 npm run bench-puppeteer-cdp > puppeteer.out || exit 1 + cat /proc/`cat LPD.pid`/status |grep VmHWM|grep -oP '\d+' > LPD.VmHWM + kill `cat LPD.pid` `cat WS.pid` + + - name: puppeteer result + run: cat puppeteer.out + + - name: json output + run: | + export AVG_DURATION=`cat puppeteer.out|grep 'avg run'|sed 's/avg run duration (ms) //'` + export TOTAL_DURATION=`cat puppeteer.out|grep 'total duration'|sed 's/total duration (ms) //'` + export LPD_VmHWM=`cat LPD.VmHWM` + echo "{\"duration_total\":${TOTAL_DURATION},\"duration_avg\":${AVG_DURATION},\"mem_peak\":${LPD_VmHWM}}" > bench.json + cat bench.json + + - name: write commit + run: | + echo "${{github.sha}}" > commit.txt + + - name: upload artifact + uses: actions/upload-artifact@v4 + with: + name: bench-results + path: | + bench.json + commit.txt + retention-days: 10 + + + cpd-bench-fmt: + name: perf-fmt + needs: cdp-bench + + # Don't execute on PR + if: github.event_name != 'pull_request' + + runs-on: ubuntu-latest + timeout-minutes: 15 + + container: + image: ghcr.io/lightpanda-io/perf-fmt:latest + credentials: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: download artifact + uses: actions/download-artifact@v4 + with: + name: bench-results + + - name: format and send json result + run: /perf-fmt cdp ${{ github.sha }} bench.json