|
| 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 | +
|
0 commit comments