Skip to content

Commit

Permalink
[ci] Improve parallelism of yarn test
Browse files Browse the repository at this point in the history
Changes the `ci` argument to be an enum instead so the tests use all
available workers in GitHub actions.

When `ci === 'github'` also increase maxConcurrency and enable
workerThreads

ghstack-source-id: 7297ed89271c27746e636583f38c392dd777a369
Pull Request resolved: #30033
  • Loading branch information
poteto committed Jun 21, 2024
1 parent 93a6757 commit cf19908
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ jobs:
steps:
- checkout
- setup_node_modules
- run: yarn test <<parameters.args>> --ci
- run: yarn test <<parameters.args>> --ci=circleci

yarn_test_build:
docker: *docker
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/runtime_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ jobs:
path: "**/node_modules"
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
- run: yarn test ${{ matrix.params }} --ci
- run: yarn test ${{ matrix.params }} --ci=github
10 changes: 7 additions & 3 deletions scripts/jest/jest-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ const argv = yargs
ci: {
describe: 'Run tests in CI',
requiresArg: false,
type: 'boolean',
default: false,
type: 'choices',
choices: ['circleci', 'github'],
},
compactConsole: {
alias: 'c',
Expand Down Expand Up @@ -309,10 +309,14 @@ function getCommandArgs() {
}

// CI Environments have limited workers.
if (argv.ci) {
if (argv.ci === 'circleci') {
args.push('--maxWorkers=2');
}

if (argv.ci === 'github') {
args.push('--maxConcurrency=10 --workerThreads=true');
}

// Push the remaining args onto the command.
// This will send args like `--watch` to Jest.
args.push(...argv._);
Expand Down

0 comments on commit cf19908

Please sign in to comment.