Skip to content
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

ci: run tests in parallel #4642

Merged
merged 2 commits into from
Jul 20, 2022
Merged

ci: run tests in parallel #4642

merged 2 commits into from
Jul 20, 2022

Conversation

paul-soporan
Copy link
Member

@paul-soporan paul-soporan commented Jul 19, 2022

What's the problem this PR addresses?

Running the integration tests on CI takes forever.

Now with nodejs/corepack#84 fixed, there shouldn't be any issues that this could trigger.

How did you fix it?

Changed --runInBand to --maxWorkers=100% to speed it up.

According to the GitHub Actions docs:

  • Windows and Linux runners have a 2C/2T CPU
  • macOS runners have a 3C/3T CPU

ubuntu-latest w/ Node.js 14.x (2C/2T) Before After Improvement
test:integration 22m 14m 36%
test:unit 34s 26s 23%
windows-latest w/ Node.js 14.x (2C/2T) Before After Improvement
test:integration 29m 19m 34%
test:unit 45s 33s 26%
macos-latest w/ Node.js 14.x (3C/3T) Before After Improvement
test:integration 32m 17m 46%
test:unit 32s 38s -18%

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@merceyz
Copy link
Member

merceyz commented Jul 20, 2022

If we update to Jest 28 we can take advantage of its new --shard option to speed it up even more.
https://jestjs.io/blog/2022/04/25/jest-28#sharding-of-test-run

@paul-soporan
Copy link
Member Author

Will look into it 👍

(though this PR doesn't have to wait until then since I could really use some faster tests in some other PRs)

@paul-soporan
Copy link
Member Author

The before & after numbers for test:unit --maxWorkers=100% on macOS are a bit weird, should probably do another run but right now I'm going to sleep.

@paul-soporan
Copy link
Member Author

paul-soporan commented Jul 20, 2022

On a rerun I got 34ms for the unit tests on macOS so it seems like the value isn't consistent and is pretty much equivalent to the old one.

@paul-soporan paul-soporan enabled auto-merge (squash) July 20, 2022 18:28
@arcanis arcanis disabled auto-merge July 20, 2022 18:34
@arcanis arcanis merged commit 548f953 into master Jul 20, 2022
@arcanis arcanis deleted the paul/ci/run-tests-in-parallel branch July 20, 2022 18:35
merceyz pushed a commit that referenced this pull request Oct 21, 2023
* ci: run tests in parallel

* ci: run unit tests with all workers too

(cherry picked from commit 548f953)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants