seriesoftubes/.github/workflows/perf.yml
Frederic Jung c64b139a86
Fewer merge conflicts: actions by area, one city per line, sorted dictionaries
- ACT is split by area into game/90-actions/*.js (const ACT in the first file,
  Object.assign in the rest)
- CITY_LL, CITY_NUDGE and LANDS_LL have one entry per line; the id-keyed ones
  are sorted
- site/i18n/*.js are sorted, one entry per line; i18n-check enforces it and
  --fix (npm run i18n:fix) restores it; scripts/i18n-add.js adds, removes
  and renames entries in place
- scripts/legacy/port-branch.js moves a branch's site/index.html edits into
  src/ during a merge with main
- perf workflow and PR template build the base page with scripts/lib/page.js
2026-10-27 10:10:16 +01:00

58 lines
2 KiB
YAML

name: Performance
# Times the PR against its base on a very large network, headless and in Chrome (desktop and a throttled phone),
# and uploads the tables. A separate workflow
# (perf-comment.yml) posts it on the PR: runs for pull requests from forks have no write access.
on:
pull_request:
paths:
- 'src/**'
- 'site/**'
- 'scripts/lib/**'
- 'scripts/perf-*.js'
- 'tests/fixtures/**'
- 'tests/harness.js'
workflow_dispatch:
permissions:
contents: read
jobs:
bench:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 24
cache: npm
- run: npm ci
- name: Base version of the game
if: github.event_name == 'pull_request'
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
git fetch --depth=1 origin "$BASE_SHA"
# The base's page, assembled by the base's own scripts (or its site/index.html from before the split).
node scripts/lib/page.js --ref FETCH_HEAD -o "$RUNNER_TEMP/base.html"
echo "BASE_ARG=--base $RUNNER_TEMP/base.html" >> "$GITHUB_ENV"
- name: Benchmark
# The runner image ships Google Chrome; playwright-core (a dev dependency) drives it, no browser download.
run: |
export PERF_CHROME="$(command -v google-chrome || command -v google-chrome-stable || command -v chromium)"
echo "Chrome: $PERF_CHROME ($("$PERF_CHROME" --version))"
node scripts/perf-bench.js $BASE_ARG --browser --md perf.md --summary "$GITHUB_STEP_SUMMARY"
- name: Remember the PR number
if: github.event_name == 'pull_request'
env:
PR: ${{ github.event.pull_request.number }}
run: echo "$PR" > pr-number.txt
- uses: actions/upload-artifact@v4
if: github.event_name == 'pull_request'
with:
name: perf
path: |
perf.md
pr-number.txt
retention-days: 7