Skip to content

Commit ed665a0

Browse files
committed
[ci] Parallelize flow github action
The existing flow-ci script makes some assumptions about running inside of circleci for parallelization. This PR forks the script with very smal ll tweaks to allow for a short name to be passed in as an argument. These short names are discovered in a new GH job and then each one is passed as an argument for parallelization ghstack-source-id: 8676079 Pull Request resolved: #30026
1 parent 5e2201c commit ed665a0

File tree

2 files changed

+53
-3
lines changed

2 files changed

+53
-3
lines changed

.github/workflows/flow.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,28 @@ on:
66
pull_request:
77

88
jobs:
9-
flow:
10-
name: Run flow
9+
discover_flow_inline_configs:
10+
name: Discover flow inline configs
1111
runs-on: ubuntu-latest
12+
outputs:
13+
matrix: ${{ steps.set-matrix.outputs.result }}
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/github-script@v7
17+
id: set-matrix
18+
with:
19+
script: |
20+
const inlinedHostConfigs = require('./scripts/shared/inlinedHostConfigs.js');
21+
return inlinedHostConfigs.map(config => config.shortName);
22+
23+
Flow:
24+
name: Flow check ${{ matrix.flow_inline_config_shortname }}
25+
needs: discover_flow_inline_configs
26+
runs-on: ubuntu-latest
27+
continue-on-error: true
28+
strategy:
29+
matrix:
30+
flow_inline_config_shortname: ${{ fromJSON(needs.discover_flow_inline_configs.outputs.matrix) }}
1231
steps:
1332
- uses: actions/checkout@v4
1433
- uses: actions/setup-node@v4
@@ -18,8 +37,9 @@ jobs:
1837
cache-dependency-path: yarn.lock
1938
- name: Restore cached node_modules
2039
uses: actions/cache@v4
40+
id: node_modules
2141
with:
2242
path: "**/node_modules"
2343
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
2444
- run: yarn install --frozen-lockfile
25-
- run: node ./scripts/tasks/flow-ci
45+
- run: node ./scripts/tasks/flow-ci-ghaction ${{ matrix.flow_inline_config_shortname }}

scripts/tasks/flow-ci-ghaction.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
'use strict';
9+
10+
process.on('unhandledRejection', err => {
11+
throw err;
12+
});
13+
14+
const runFlow = require('../flow/runFlow');
15+
const inlinedHostConfigs = require('../shared/inlinedHostConfigs');
16+
17+
async function check(shortName) {
18+
if (shortName == null) {
19+
throw new Error('Expected an inlinedHostConfig shortName');
20+
}
21+
const rendererInfo = inlinedHostConfigs.find(
22+
config => config.shortName === shortName
23+
);
24+
if (rendererInfo.isFlowTyped) {
25+
await runFlow(rendererInfo.shortName, ['check']);
26+
console.log();
27+
}
28+
}
29+
30+
check(process.argv[2]);

0 commit comments

Comments
 (0)