Skip to content

Commit

Permalink
Merge pull request #428 from lightpanda-io/ci-rgression
Browse files Browse the repository at this point in the history
ci: add puppeteer regression test
  • Loading branch information
krichprollsch authored Feb 18, 2025
2 parents 79387f4 + dc1d593 commit 73a2fa3
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 47 deletions.
107 changes: 107 additions & 0 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: e2e-test

on:
push:
branches:
- main
paths:
- "build.zig"
- "src/**/*.zig"
- "src/*.zig"
- "vendor/zig-js-runtime"
- ".github/**"
- "vendor/**"
pull_request:

# By default GH trigger on types opened, synchronize and reopened.
# see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
# Since we skip the job when the PR is in draft state, we want to force CI
# running when the PR is marked ready_for_review w/o other change.
# see https://github.com/orgs/community/discussions/25722#discussioncomment-3248917
types: [opened, synchronize, reopened, ready_for_review]

paths:
- ".github/**"
- "build.zig"
- "src/**/*.zig"
- "src/*.zig"
- "vendor/**"
- ".github/**"
- "vendor/**"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
zig-build-release:
name: zig build release

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# fetch submodules recusively, to get zig-js-runtime submodules also.
submodules: recursive

- uses: ./.github/actions/install

- name: zig build release
run: zig build -Doptimize=ReleaseSafe -Dengine=v8

- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: lightpanda-build-release
path: |
zig-out/bin/lightpanda
retention-days: 1

puppeteer:
name: puppeteer
needs: zig-build-release

env:
MAX_MEMORY: 25000
MAX_AVG_DURATION: 24

runs-on: ubuntu-latest

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: |
python3 -m http.server 1234 -d ./public & echo $! > PYTHON.pid
./lightpanda & 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 PYTHON.pid`
- name: puppeteer result
run: cat puppeteer.out

- name: memory regression
run: |
export LPD_VmHWM=`cat LPD.VmHWM`
echo "Peak resident set size: $LPD_VmHWM"
test "$LPD_VmHWM" -le "$MAX_MEMORY"
- name: duration regression
run: |
export PUPPETEER_AVG_DURATION=`cat puppeteer.out|grep 'avg run'|sed 's/avg run duration (ms) //'`
echo "puppeteer avg duration: $PUPPETEER_AVG_DURATION"
test "$PUPPETEER_AVG_DURATION" -le "$MAX_AVG_DURATION"
47 changes: 0 additions & 47 deletions .github/workflows/zig-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,26 +66,6 @@ jobs:
zig-out/bin/lightpanda
retention-days: 1

zig-build-release:
name: zig build release

# Don't run the CI on PR
if: github.event_name != 'pull_request'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# fetch submodules recusively, to get zig-js-runtime submodules also.
submodules: recursive

- uses: ./.github/actions/install

- name: zig build release
run: zig build -Doptimize=ReleaseSafe -Dengine=v8

zig-test:
name: zig test

Expand Down Expand Up @@ -141,30 +121,3 @@ jobs:

- name: format and send json result
run: /perf-fmt bench-browser ${{ github.sha }} bench.json

demo-puppeteer:
name: demo-puppeteer
needs: zig-build-dev

runs-on: ubuntu-latest

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-dev

- run: chmod a+x ./lightpanda

- name: run puppeteer
run: |
python3 -m http.server 1234 -d ./public &
./lightpanda &
RUNS=2 npm run bench-puppeteer-cdp

0 comments on commit 73a2fa3

Please sign in to comment.