Files
David Luzar e7b534668a ci(repo): measure each master commit against the one before it (#12484)
GitHub's hosted runners differ from run to run (region, CPU), so a commit's
timings only compare with timings from the same runner.

- The perf job builds the commit and master before the push and loads both
  alternately (`yarn stats:compare --base <commit> --iterations 6`), instead of
  waiting for staging; without staging there's nothing to cancel, so every merge
  gets its run.
- `perf.mjs --base` takes a commit: checked out into a temporary worktree with its
  own dependencies, built and served like this checkout. `--out *.json` writes both
  builds' loads; `--wait-for` is gone. One unrecorded warm-up load per build, and
  the runner's CPU in the environment.
- `post.mjs` sends the commit time (the admin orders runs by it) and the base
  build; perf runs need one.

Claude Opus 5.5 (xhigh)
2026-10-28 16:29:35 +01:00

72 lines
2.4 KiB
YAML

name: Stats
# Posts every master commit's production build (bundle size) and its page-load
# measurements — next to the commit before it, both built and measured
# alternately on the same runner — to the Excalidraw+ admin's Bundle size and
# Performance pages (scripts/stats/). No run cancels another, so commits merged
# close together are all measured.
# OSS_STATS_TOKEN lives in the `stats` environment, which only master can use.
on:
push:
branches: master
workflow_dispatch:
permissions:
contents: read
jobs:
bundle:
name: Bundle size
runs-on: ubuntu-latest
environment: stats
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20.x
- name: Install
run: yarn install --frozen-lockfile
- name: Build with bundle stats
run: yarn stats:bundle
env:
VITE_APP_GIT_SHA: ${{ github.sha }}
VITE_APP_ENABLE_ESLINT: "false"
- name: Post to the Excalidraw+ admin
run: node scripts/stats/post.mjs bundle excalidraw-app/build/bundle-stats.json
env:
OSS_STATS_TOKEN: ${{ secrets.OSS_STATS_TOKEN }}
perf:
name: Performance
# a fixed image, so the runs stay comparable; Playwright 1.58 can't install
# its browser on ubuntu-latest's 26.04 either
runs-on: ubuntu-24.04
environment: stats
timeout-minutes: 40
env:
# master before the push; runs started by hand compare with the parent
BEFORE: ${{ github.event.before }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 2
- name: Fetch the commit before the push
if: env.BEFORE
run: git fetch --no-tags --depth=1 origin "$BEFORE"
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20.x
- name: Install
run: |
yarn install --frozen-lockfile
npx playwright install --with-deps chromium
- name: Measure this commit and the one before it
run: yarn stats:compare --base "${BEFORE:-HEAD^}" --iterations 6 --out perf.json
- name: Post to the Excalidraw+ admin
run: node scripts/stats/post.mjs perf perf.json
env:
OSS_STATS_TOKEN: ${{ secrets.OSS_STATS_TOKEN }}