|
48 | 48 | - uses: ./.github/actions/install |
49 | 49 |
|
50 | 50 | - name: zig build release |
51 | | - run: zig build -Doptimize=ReleaseSafe |
| 51 | + run: zig build --release=safe -Doptimize=ReleaseSafe -Dcpu=x86_64 -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) |
52 | 52 |
|
53 | 53 | - name: upload artifact |
54 | 54 | uses: actions/upload-artifact@v4 |
@@ -135,3 +135,94 @@ jobs: |
135 | 135 | ./lightpanda serve & echo $! > LPD.pid |
136 | 136 | go run runner/main.go --verbose |
137 | 137 | kill `cat LPD.pid` |
| 138 | +
|
| 139 | + cdp-and-hyperfine-bench: |
| 140 | + name: cdp-and-hyperfine-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: run hyperfine |
| 182 | + run: | |
| 183 | + go run ws/main.go & echo $! > WS.pid |
| 184 | + hyperfine --export-json=hyperfine.json --warmup 3 --runs 20 --shell=none "./lightpanda --dump http://127.0.0.1:1234/campfire-commerce/" |
| 185 | + kill `cat WS.pid` |
| 186 | +
|
| 187 | + - name: write commit |
| 188 | + run: | |
| 189 | + echo "${{github.sha}}" > commit.txt |
| 190 | +
|
| 191 | + - name: upload artifact |
| 192 | + uses: actions/upload-artifact@v4 |
| 193 | + with: |
| 194 | + name: bench-results |
| 195 | + path: | |
| 196 | + bench.json |
| 197 | + hyperfine.json |
| 198 | + commit.txt |
| 199 | + retention-days: 10 |
| 200 | + |
| 201 | + |
| 202 | + perf-fmt: |
| 203 | + name: perf-fmt |
| 204 | + needs: cdp-bench |
| 205 | + |
| 206 | + # Don't execute on PR |
| 207 | + if: github.event_name != 'pull_request' |
| 208 | + |
| 209 | + runs-on: ubuntu-latest |
| 210 | + timeout-minutes: 15 |
| 211 | + |
| 212 | + container: |
| 213 | + image: ghcr.io/lightpanda-io/perf-fmt:latest |
| 214 | + credentials: |
| 215 | + username: ${{ github.actor }} |
| 216 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 217 | + |
| 218 | + steps: |
| 219 | + - name: download artifact |
| 220 | + uses: actions/download-artifact@v4 |
| 221 | + with: |
| 222 | + name: bench-results |
| 223 | + |
| 224 | + - name: format and send json result |
| 225 | + run: /perf-fmt cdp ${{ github.sha }} bench.json |
| 226 | + |
| 227 | + - name: format and send json result |
| 228 | + run: /perf-fmt hyperfine ${{ github.sha }} hyperfine.json |
0 commit comments