-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Parallelizing across machines in CI #6270
Comments
@aaronabramov you talked about something like this at FB. But I don't remember if you said it worked for you, or if you wanted something like it? |
i was talking about something else (host process and a bunch of remote clients), but i think it would be nice to do |
I would like to see this to make CI fast and it feels like a common request. Also reported in: #2330 |
Cypress has the feature to slice or load balance tests, and it's really neat, since it can be set up just by adding a parallel execution strategy to the CI pipeline. I'm surprised there's been no traction for this feature. |
We have been doing something similar in Skroutz with RSspec, using multiple process one of which gets promoted to the orchestrator. We also use a Redis instance to measure the runtime of the tests and distribute them with sort of equal load. I was thinking of something similar for jest if anyone interested, I can setup a ddoc on how to achieve this, as I am not really familiar with the internals of Jest. |
Frontend test duration has been creeping up and failing. There are some optimizations we could do, but I think this needs to be split for now. Took the logic from this post jestjs/jest#6270 (comment) and applied it here.
I would love to see this feature been native to jest. Right now we have been using the approach suggested at #11252 (comment). But seems to be a common enough functionality to be added to jest itself. When a project reaches a certain size is nice to be able to split across different jobs/machines in CI. Seems that we have a few suggestions on how the API would look like:
I would like to add another suggestion, based on elixir test framework:
I would be happy to send a PR if the feature is welcome. |
For added context, the npx playwright test --shard=1/3
npx playwright test --shard=2/3
npx playwright test --shard=3/3 This would be amazing to have in jest out of the box as well. |
PR very much welcome! 🙂 |
Went ahead and implemented this as |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Many CI systems support splitting up a single task across multiple machines. This can drastically speed up CI times even when you are duplicating some of the work compiling or whatever.
From what I've seen, they mostly work like this:
For example: https://buildkite.com/docs/builds/parallel-builds
It would be awesome if there was an easy way to integrate this with Jest such that you could automatically chunk tests up so that they can be run across machines.
I imagine you'd have to discover all the tests and then have some stable way of splitting them up, either by counting the tests or by splitting the files up.
I think you could even automatically do this without any additional setup from developers. I created a module to help you do just that: /~https://github.com/jamiebuilds/ci-parallel-vars
We do this in our project today by starting 4 separate Jest runs on different machines:
Then in
jest.config.js
we split up the tests:This sped up our builds significantly
The text was updated successfully, but these errors were encountered: