Skip to content

Commit 9e9be6c

Browse files
Parallelize Flow in CI (facebook#20794)
* Parallelize Flow in CI We added more host configs recently, and we run all the checks in sequence, so sometimes Flow ends up being the slowest CI job. This splits the job across multiple processes. * Fix environment variable typo Co-authored-by: Ricky <rickhanlonii@gmail.com> Co-authored-by: Ricky <rickhanlonii@gmail.com>
1 parent eee874c commit 9e9be6c

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

.circleci/config.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ jobs:
8383
yarn_flow:
8484
docker: *docker
8585
environment: *environment
86+
parallelism: 5
8687

8788
steps:
8889
- checkout
@@ -384,9 +385,6 @@ workflows:
384385
- yarn_lint:
385386
requires:
386387
- setup
387-
- yarn_flow:
388-
requires:
389-
- setup
390388
- RELEASE_CHANNEL_stable_yarn_build:
391389
requires:
392390
- setup
@@ -426,6 +424,9 @@ workflows:
426424
unless: << pipeline.parameters.prerelease_commit_sha >>
427425
jobs:
428426
- setup
427+
- yarn_flow:
428+
requires:
429+
- setup
429430
- yarn_test:
430431
requires:
431432
- setup

scripts/tasks/flow-ci.js

+15-5
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,22 @@ process.on('unhandledRejection', err => {
1414
const runFlow = require('../flow/runFlow');
1515
const inlinedHostConfigs = require('../shared/inlinedHostConfigs');
1616

17+
// Parallelize tests across multiple tasks.
18+
const nodeTotal = process.env.CIRCLE_NODE_TOTAL
19+
? parseInt(process.env.CIRCLE_NODE_TOTAL, 10)
20+
: 1;
21+
const nodeIndex = process.env.CIRCLE_NODE_INDEX
22+
? parseInt(process.env.CIRCLE_NODE_INDEX, 10)
23+
: 0;
24+
1725
async function checkAll() {
18-
// eslint-disable-next-line no-for-of-loops/no-for-of-loops
19-
for (let rendererInfo of inlinedHostConfigs) {
20-
if (rendererInfo.isFlowTyped) {
21-
await runFlow(rendererInfo.shortName, ['check']);
22-
console.log();
26+
for (let i = 0; i < inlinedHostConfigs.length; i++) {
27+
if (i % nodeTotal === nodeIndex) {
28+
const rendererInfo = inlinedHostConfigs[i];
29+
if (rendererInfo.isFlowTyped) {
30+
await runFlow(rendererInfo.shortName, ['check']);
31+
console.log();
32+
}
2333
}
2434
}
2535
}

0 commit comments

Comments
 (0)