-
-
Notifications
You must be signed in to change notification settings - Fork 0
Add e2e benchmark regression testing with cross-platform CI #315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
... Fixed in 24e8d87. The issue was using |
- Create jest-bench-e2e.config.ts for e2e benchmarks - Add tsconfig.bench.json in workspace-e2e - Add e2e-benchmark target to workspace-e2e project - Update nx.json with e2e-benchmark target defaults - Convert performance tests to benchmark format (.bench.ts) - Add e2e-benchmark CI job (macOS, Windows, Ubuntu Arm) - Configure 140% threshold for e2e benchmarks - Update test/e2e jobs to exclude .bench.ts files Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
- Add tsconfig.bench.json reference to workspace-e2e tsconfig.json - Configure eslint to allow benchmark files to import from tools - Remove unused beforeEachIteration import Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Performance tests now only run in e2e-benchmark job, not in regular e2e job. This prevents long-running performance tests from blocking regular CI. Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
- Replace lodash uniqueId with crypto-based uniqueId across codebase - Remove old performance spec files (replaced by .bench.ts) - Remove all logging and console output from benchmarks - Remove assertions from benchmarks (benchmarks measure time only) - Use stdio inherit for all execSync calls in benchmarks - Add afterEachIteration to reset state between benchmark runs - Reuse benchmark target name (not e2e-benchmark) - Update nx.json to share benchmark target configuration - Add matrix configuration for e2e-benchmark (Ubuntu only for PRs) - Simplify e2e test ignore pattern (only .bench.ts needed) - Add benchmarks/ directory to .gitignore Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Remove benchmarks/ from .gitignore - only ignore individual benchmark result files (benchmark.json, *-benchmark.txt) Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Configure jest-bench-e2e.config.ts with globalSetup and globalTeardown scripts to start local registry and publish package before running benchmarks. This fixes the CI failure where npm install @nxworker/workspace@e2e was failing. Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Replace randomUUID() with timestamp-based IDs (Date.now().toString(36)) for library names in benchmarks. UUIDs were too long and contained characters that caused issues with Nx library path resolution. Timestamp-based IDs are shorter, still unique per benchmark run, and avoid path-related issues. Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Replace Date.now().toString(36) with randomBytes(4).toString('hex')
for library name suffixes in benchmarks. randomBytes provides
cryptographically secure random data, is shorter (8 chars),
and avoids potential timestamp collisions.
Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
…tion Replace afterEachIteration with beforeEachIteration to ensure files are reset BEFORE each benchmark iteration runs, not after. This ensures files are always in the expected location when the benchmark starts, preventing "file not found" errors during warmup and actual benchmark runs. Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
24e8d87 to
9daba45
Compare
|
@copilot Rebased with new uniqueId function. Failure: FAIL e2e-benchmarks packages/workspace-e2e/src/performance-stress-test.bench.ts Cannot find module '@internal/test-util' from 'packages/workspace-e2e/src/performance-stress-test.bench.ts' 4 | describe,
at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11) Test Suites: 2 failed, 2 total |
- Add moduleNameMapper to jest-bench-e2e.config.ts to resolve @internal/test-util - Keep beforeEachIteration import (it's actually used in the code) - The benchmarks use uniqueId from the new test-utils package Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Fixed in 709d580. Added |
E2E Benchmark Regression Testing Implementation
This PR implements e2e benchmark regression testing as requested in the issue.
Completed Tasks
Changes Made
Infrastructure:
jest-bench-e2e.config.tsfor e2e benchmark configurationglobalSetupto start local registry and publish packageglobalTeardownto stop local registrymoduleNameMapperto resolve@internal/test-utilpathpackages/workspace-e2e/tsconfig.bench.jsonfor TypeScript configurationbenchmarktarget topackages/workspace-e2e/project.json(reused name)nx.jsonto share benchmark target configuration for both projectspackages/workspace-e2e/tsconfig.jsonto reference tsconfig.bench.jsonpackages/workspace-e2e/eslint.config.jsto allow benchmark files to import from tools directoryuniqueIdfrom@internal/test-utilpackage (test-utils).gitignoreto ignore only individual benchmark files, not the directoryE2E Benchmark Tests:
Created
performance-benchmark.bench.tswith:create-nx-workspaceCreated
performance-stress-test.bench.tswith:create-nx-workspaceRemoved old
performance-benchmark.spec.tsandperformance-stress-test.spec.tsUse test-utils package:
uniqueIdfrom@internal/test-utilpackageCI Workflow Updates (.github/workflows/ci.yml):
set-e2e-benchmark-matrixjob to configure OS matrix:e2e-benchmarkjob:nx benchmark workspace-e2e(reused target name)\.bench\.ts$files\.bench\.ts$files only (simplified pattern)Commands Verified Locally:
npx nx build workspace- builds successfullynpx nx benchmark workspace- runs micro-benchmarksnpx nx lint workspace-e2e- passes lintingnpx nx format:check- formatting passesnpx nx benchmark workspace-e2e- testing in progressSecurity:
How It Works
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.