Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 59 additions & 11 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ concurrency:
group: bench-${{ github.head_ref }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write
issues: write

jobs:
bench:
Expand All @@ -34,33 +30,65 @@ jobs:
path: base

- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14

- name: Install PR benchmark dependencies
working-directory: pr
run: bun install --frozen-lockfile


- name: Run bench on base
- name: Detect base replay/parser benchmark
id: base-benchmark
run: |
if [ -f base/test/benchmarks/replay-parser.bench.ts ]; then
echo "available=true" >> "$GITHUB_OUTPUT"
else
echo "available=false" >> "$GITHUB_OUTPUT"
fi

- name: Run benchmarks on base
working-directory: base
run: |
bun install --frozen-lockfile
bun install --no-save --ignore-scripts
bun run test/benchmarks/pipeline.bench.ts
mv bench-results.json ../base-results.json
if [ -f test/benchmarks/replay-parser.bench.ts ]; then
bun test/benchmarks/replay-parser.bench.ts --no-enforce --output=../base-telemetry-results.json
fi

- name: Run bench on PR
- name: Run benchmarks on PR
working-directory: pr
run: |
bun install --frozen-lockfile
bun run test/benchmarks/pipeline.bench.ts
mv bench-results.json ../pr-results.json
bun test/benchmarks/replay-parser.bench.ts --output=../pr-telemetry-results.json

- name: Compare
id: compare
working-directory: pr
run: |
bun scripts/quality/bench-compare.ts ../base-results.json ../pr-results.json --threshold=5 > ../comparison.md
cat ../comparison.md
bun scripts/quality/bench-compare.ts ../base-results.json ../pr-results.json --threshold=5 > ../pipeline-comparison.md
if [ -f ../base-telemetry-results.json ]; then
bun scripts/quality/replay-parser-bench-compare.ts ../base-telemetry-results.json ../pr-telemetry-results.json > ../telemetry-comparison.md
else
{
echo "## Replay/parser benchmark budgets"
echo
echo "Base commit has no replay/parser benchmark. Current hard memory budgets passed; same-machine throughput comparison starts after this benchmark lands on the base branch."
} > ../telemetry-comparison.md
fi
{
cat ../pipeline-comparison.md
echo
cat ../telemetry-comparison.md
} | tee ../comparison.md
cat ../comparison.md >> "$GITHUB_STEP_SUMMARY"
{
echo 'body<<EOF'
cat ../comparison.md
echo 'EOF'
} >> "$GITHUB_OUTPUT"

- name: Find existing comment
id: find
uses: peter-evans/find-comment@v3
Expand All @@ -75,3 +103,23 @@ jobs:
comment-id: ${{ steps.find.outputs.comment-id }}
body: ${{ steps.compare.outputs.body }}
edit-mode: replace

- name: Enforce replay/parser budgets
if: steps.base-benchmark.outputs.available == 'true'
working-directory: pr
run: bun scripts/quality/replay-parser-bench-compare.ts ../base-telemetry-results.json ../pr-telemetry-results.json --fail-on-regression

- name: Upload benchmark reports
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmark-reports
path: |
base-results.json
pr-results.json
base-telemetry-results.json
pr-telemetry-results.json
pipeline-comparison.md
telemetry-comparison.md
comparison.md
retention-days: 7
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ laps.json
client/debug-storybook.log
client/src/stories/__snapshots__/results/
bench-results.json
telemetry-benchmark-results.json
client/storybook-static/
.superset/

Expand Down
12 changes: 6 additions & 6 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"test:ai": "bun test test/ai/evals/ai-quality.ai-eval.ts --timeout 120000",
"ai:baseline": "bun scripts/quality/ai-baseline.ts",
"bench": "bun test/benchmarks/pipeline.bench.ts",
"bench:telemetry": "bun scripts/quality/replay-parser-bench-local.ts",
"bench:telemetry:current": "bun test/benchmarks/replay-parser.bench.ts",
"extract:tracks": "bun scripts/games/fm-2023/extract-tracks.ts && bun scripts/games/f1-2025/extract-tracks.ts",
"extract:tracks:forza": "bun scripts/games/fm-2023/extract-tracks.ts",
"extract:tracks:f1": "bun scripts/games/f1-2025/extract-tracks.ts",
Expand Down
4 changes: 3 additions & 1 deletion scripts/quality/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ Capture and compare quality/performance measurements and exercise update install
|---|---|
| `bun scripts/quality/ai-baseline.ts` | Run AI evaluation fixtures and write a SHA/model baseline under `test/ai-fixtures/baselines`. Requires Gemini API credentials. |
| `bun scripts/quality/bench-compare.ts <baseline.json> <current.json> [--threshold=5] [--fail-on-regression]` | Emit benchmark markdown diff; optionally fail when regressions exceed threshold. |
| `bun scripts/quality/replay-parser-bench-compare.ts <baseline.json> <current.json> [--fail-on-regression]` | Compare compatible same-machine reports; enforce relative throughput/memory and hard memory budgets when requested. |
| `bun scripts/quality/replay-parser-bench-local.ts [--base=main]` | Benchmark base ref and current worktree on same machine; bootstrap hard memory only when base predates benchmark. |
| `bun scripts/quality/test-updater.ts` | Build/reuse local installer and start dev server with forced-update variables. |

Inputs: AI credentials and fixtures, Mitata JSON result files, or local package/installer state. Outputs: baseline JSON, markdown on stdout, or update-test process logs/status.
Inputs: AI credentials and fixtures, same-machine Mitata or replay/parser benchmark JSON result files, or local package/installer state. Outputs: baseline JSON, markdown on stdout, or update-test process logs/status.

Boundary: measurement and local verification workflows only. Scripts do not own production builds, test fixtures, benchmark generation, or release publication.

Expand Down
Loading
Loading