👷 parallelize test app builds#4567
Conversation
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
ea3e54c to
2e6a2d1
Compare
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 2e3c7f8 | Docs | Datadog PR Page | Give us feedback! |
2e6a2d1 to
e819ee5
Compare
Add `runAsync()` to the `command` builder and use it in `build-test-apps.ts` to build all apps concurrently. Dependencies are resolved via a memoized `ensureBuild()` function that waits for each app's deps before starting it. Git commands are automatically serialized via a mutex to avoid index lock conflicts. Reduces wall-clock build time from ~1m22s to ~37s.
e819ee5 to
2e3c7f8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2e3c7f84e0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const child = childProcess.spawn(commandName, commandArguments, { | ||
| env: { ...process.env, ...env }, | ||
| ...extraOptions, | ||
| stdio: 'pipe', | ||
| }) |
There was a problem hiding this comment.
Honor withInput() when running asynchronously
When callers use the new runAsync() path with withInput() (for example the existing gh auth login --with-token/ssh-add - patterns if they are converted to async), the configured input is never written to the spawned process. Because spawn() creates a stdin pipe here but the parent neither writes nor closes it, commands that read from stdin can hang indefinitely or fail with missing input, unlike run() which passes input to spawnSync().
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right, but we'll fix when we need it.
Motivation
yarn build:appsbuilds all test apps sequentially, making it slow (~1m22s on a typical machine). Since most apps are independent, they can be built in parallel.Changes
runAsync()to thecommandbuilder (asyncspawn-based counterpart torun()), with a mutex that automatically serializesgitcommands to avoid index lock conflictsbuild-test-apps.tsto build all apps concurrently using a dependency-awareensureBuild()function;react-router-v7-appwaits onreact-router-v6-app, and the two extensions wait onbase-extensionsecureCommandExecutionESLint rule to accept.runAsync()as a valid terminal callWall-clock time drops from ~1m22s to ~37s (~2x faster).
Test instructions
Run
yarn build:appsand verify all apps build successfully.Checklist