feat(test): add bench mark persist#1054
Merged
ErnestM1234 merged 11 commits intomainfrom Feb 27, 2026
Merged
Conversation
Contributor
Author
|
@greptileai plz review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The monorepo has middleware benchmarks (unit via vitest bench, E2E via Playwright) that only run locally — performance regressions can ship undetected. We need a CI system that automatically compares benchmark results against known baselines and surfaces regressions on PRs, without blocking merges while thresholds are being tuned.
Changes
.github/workflows/benchmark.yml— New workflow triggered on PRs (with change detection forpackages/next/and the middleware app),repository_dispatch(post-release baseline updates), andworkflow_dispatch(manual trigger for external PRs). Usesgithub-action-benchmarkwithcustomSmallerIsBetterformat, 150% alert threshold, and informational-only alerts. Baselines are stored on thegh-pagesbranch and only persisted on release dispatches (never on PRs, for security)..github/workflows/release.yml— Added arepository_dispatchstep that fires arelease-publishedevent withpublishedPackageswhen changesets publishes, so benchmarks only run and baselines only update whengt-nextis actually released.tests/apps/next/middleware/benchmarks/transform-results.mjs— New script that converts vitest bench JSON and Playwright E2E performance JSON intogithub-action-benchmark's custom format, tagging each data point with the package name and version.tests/apps/next/middleware/benchmarks/e2e-performance.spec.ts— AddedBENCH_OUTPUT_NAMEenv var support for predictable output filenames in CI.tests/apps/next/middleware/package.json— Addedbench:unit:jsonconvenience script for running vitest bench with JSON output.Greptile Summary
Implements automated benchmark tracking for middleware performance with CI integration via GitHub Actions. The system runs unit (vitest) and E2E (Playwright) benchmarks on PRs to detect regressions, and updates baselines on releases. Key highlights:
gh-pageson release events, never on PRs (prevents malicious data injection from forks)packages/next/or the middleware test app changesgt-nextis published via repository dispatchThe transform script converts vitest and Playwright outputs into
github-action-benchmarkformat with package/version metadata. Workflow uses 150% alert threshold with informational-only alerts (non-blocking).Confidence Score: 5/5
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[PR/Release Event] --> B{Event Type?} B -->|PR| C[Check Changed Files] B -->|Release Dispatch| D[Check if gt-next Published] B -->|Manual Trigger| E[Always Run] C --> F{Should Run?} D --> F E --> F F -->|Yes| G[Setup Environment] F -->|No| Z[Skip] G --> H[Build Packages] H --> I[Run Unit Benchmarks] I --> J[Run E2E Benchmarks] J --> K[Transform Results] K --> L[Store & Compare with Baseline] L --> M{Event Type?} M -->|PR| N[Compare Only - No Persist] M -->|Release| O[Update Baseline on gh-pages] N --> P[Post Alert if Regression] O --> P style O fill:#f9f,stroke:#333 style N fill:#bbf,stroke:#333 style P fill:#bfb,stroke:#333Last reviewed commit: c9d6ec8