Skip to content

Commit 9894cce

Browse files
committed
ci: extract end-to-end test on its own file
1 parent bcedbc8 commit 9894cce

File tree

2 files changed

+107
-65
lines changed

2 files changed

+107
-65
lines changed

.github/workflows/e2e-test.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: e2e-test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "build.zig"
9+
- "src/**/*.zig"
10+
- "src/*.zig"
11+
- "vendor/zig-js-runtime"
12+
- ".github/**"
13+
- "vendor/**"
14+
pull_request:
15+
16+
# By default GH trigger on types opened, synchronize and reopened.
17+
# see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
18+
# Since we skip the job when the PR is in draft state, we want to force CI
19+
# running when the PR is marked ready_for_review w/o other change.
20+
# see https://github.com/orgs/community/discussions/25722#discussioncomment-3248917
21+
types: [opened, synchronize, reopened, ready_for_review]
22+
23+
paths:
24+
- ".github/**"
25+
- "build.zig"
26+
- "src/**/*.zig"
27+
- "src/*.zig"
28+
- "vendor/**"
29+
- ".github/**"
30+
- "vendor/**"
31+
# Allows you to run this workflow manually from the Actions tab
32+
workflow_dispatch:
33+
34+
jobs:
35+
zig-build-release:
36+
name: zig build release
37+
38+
runs-on: ubuntu-latest
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
44+
# fetch submodules recusively, to get zig-js-runtime submodules also.
45+
submodules: recursive
46+
47+
- uses: ./.github/actions/install
48+
49+
- name: zig build release
50+
run: zig build -Doptimize=ReleaseSafe -Dengine=v8
51+
52+
- name: upload artifact
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: lightpanda-build-release
56+
path: |
57+
zig-out/bin/lightpanda
58+
retention-days: 1
59+
60+
puppeteer:
61+
name: puppeteer
62+
needs: zig-build-release
63+
64+
env:
65+
MAX_MEMORY: 24000
66+
MAX_AVG_DURATION: 23
67+
68+
runs-on: ubuntu-latest
69+
70+
steps:
71+
- uses: actions/checkout@v4
72+
with:
73+
repository: 'lightpanda-io/demo'
74+
fetch-depth: 0
75+
76+
- run: npm install
77+
78+
- name: download artifact
79+
uses: actions/download-artifact@v4
80+
with:
81+
name: lightpanda-build-release
82+
83+
- run: chmod a+x ./lightpanda
84+
85+
- name: run puppeteer
86+
run: |
87+
python3 -m http.server 1234 -d ./public & echo $! > PYTHON.pid
88+
./lightpanda & echo $! > LPD.pid
89+
RUNS=100 npm run bench-puppeteer-cdp > puppeteer.out || exit 1
90+
cat /proc/`cat LPD.pid`/status |grep VmHWM|grep -oP '\d+' > LPD.VmHWM
91+
kill `cat LPD.pid` `cat PYTHON.pid`
92+
93+
- name: puppeteer result
94+
run: cat puppeteer.out
95+
96+
- name: memory regression
97+
run: |
98+
export LPD_VmHWM=`cat LPD.VmHWM`
99+
echo "Peak resident set size: $LPD_VmHWM"
100+
test "$LPD_VmHWM" -le "$MAX_MEMORY"
101+
102+
- name: duration regression
103+
run: |
104+
export PUPPETEER_AVG_DURATION=`cat puppeteer.out|grep 'avg run'|sed 's/avg run duration (ms) //'`
105+
echo "puppeteer avg duration: $PUPPETEER_AVG_DURATION"
106+
test "$PUPPETEER_AVG_DURATION" -le "$MAX_AVG_DURATION"
107+

.github/workflows/zig-test.yml

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -66,31 +66,6 @@ jobs:
6666
zig-out/bin/lightpanda
6767
retention-days: 1
6868

69-
zig-build-release:
70-
name: zig build release
71-
72-
runs-on: ubuntu-latest
73-
74-
steps:
75-
- uses: actions/checkout@v4
76-
with:
77-
fetch-depth: 0
78-
# fetch submodules recusively, to get zig-js-runtime submodules also.
79-
submodules: recursive
80-
81-
- uses: ./.github/actions/install
82-
83-
- name: zig build release
84-
run: zig build -Doptimize=ReleaseSafe -Dengine=v8
85-
86-
- name: upload artifact
87-
uses: actions/upload-artifact@v4
88-
with:
89-
name: lightpanda-build-release
90-
path: |
91-
zig-out/bin/lightpanda
92-
retention-days: 1
93-
9469
zig-test:
9570
name: zig test
9671

@@ -146,43 +121,3 @@ jobs:
146121

147122
- name: format and send json result
148123
run: /perf-fmt bench-browser ${{ github.sha }} bench.json
149-
150-
demo-puppeteer:
151-
name: demo-puppeteer
152-
needs: zig-build-dev
153-
154-
env:
155-
MAX_MEMORY: 23456
156-
MAX_AVG_DURATION: 22
157-
158-
runs-on: ubuntu-latest
159-
160-
steps:
161-
- uses: actions/checkout@v4
162-
with:
163-
repository: 'lightpanda-io/demo'
164-
fetch-depth: 0
165-
166-
- run: npm install
167-
168-
- name: download artifact
169-
uses: actions/download-artifact@v4
170-
with:
171-
name: lightpanda-build-release
172-
173-
- run: chmod a+x ./lightpanda
174-
175-
- name: run puppeteer
176-
run: |
177-
go run ws/main.go &
178-
/usr/bin/time -f'%M' -omrs.out ./lightpanda &
179-
RUNS=100 npm run bench-puppeteer-cdp |tee output
180-
181-
- name: memory regression
182-
run: |
183-
test "`cat mrs.out`" -le "$MAX_MEMORY"
184-
185-
- name: duration regression
186-
run: |
187-
test "`cat output|grep 'avg run'|sed 's/avg run duration (ms) //'`" -le "$MAX_AVG_DURATION"
188-

0 commit comments

Comments
 (0)