Skip to content

Commit 61160a3

Browse files
mrgraingithub-actions
and
github-actions
authored
feat: add maxWorkers option to CdkCliIntegTestsWorkflow (#841)
* feat: add maxWorkers option to CdkCliIntegTestsWorkflow * chore: self mutation Signed-off-by: github-actions <[email protected]> --------- Signed-off-by: github-actions <[email protected]> Co-authored-by: github-actions <[email protected]>
1 parent 0d55fe8 commit 61160a3

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

API.md

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cdk-cli-integ-tests.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ export interface CdkCliIntegTestsWorkflowProps {
7575
* @default - atmosphere is not used
7676
*/
7777
readonly enableAtmosphere?: AtmosphereOptions;
78+
79+
80+
/**
81+
* Specifies the maximum number of workers the worker-pool will spawn for running tests.
82+
*
83+
* @default - the cli integ test package determines a sensible default
84+
*/
85+
readonly maxWorkers?: string;
7886
}
7987

8088
/**
@@ -120,6 +128,11 @@ export class CdkCliIntegTestsWorkflow extends Component {
120128
}
121129
});
122130

131+
let maxWorkersArg = '';
132+
if (props.maxWorkers) {
133+
maxWorkersArg = ` --maxWorkers=${props.maxWorkers}`;
134+
}
135+
123136
runTestsWorkflow.on({
124137
pullRequestTarget: {
125138
branches: ['main'],
@@ -384,7 +397,7 @@ export class CdkCliIntegTestsWorkflow extends Component {
384397
{
385398
name: 'Run the test suite: ${{ matrix.suite }}',
386399
run: [
387-
'bin/run-suite --use-cli-release=${{ steps.versions.outputs.cli_version }} --framework-version=${{ steps.versions.outputs.lib_version }} ${{ matrix.suite }}',
400+
`bin/run-suite${maxWorkersArg} --use-cli-release=\${{ steps.versions.outputs.cli_version }} --framework-version=\${{ steps.versions.outputs.lib_version }} \${{ matrix.suite }}`,
388401
].join('\n'),
389402
env: {
390403
JSII_SILENCE_WARNING_DEPRECATED_NODE_VERSION: 'true',

test/cdk-cli-integ-tests.test.ts

+20
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,23 @@ test('snapshot test for the CDK CLI integ tests using atmosphere', () => {
4545
const outdir = Testing.synth(repo);
4646
expect(outdir).toMatchSnapshot();
4747
});
48+
49+
test('can set maxworkers', () => {
50+
const repo = new yarn.CdkLabsMonorepo({
51+
name: 'monorepo',
52+
defaultReleaseBranch: 'main',
53+
});
54+
55+
new CdkCliIntegTestsWorkflow(repo, {
56+
approvalEnvironment: 'approval',
57+
testEnvironment: 'test',
58+
buildRunsOn: 'runsOn',
59+
testRunsOn: 'testRunsOn',
60+
localPackages: ['@aws-cdk/bla', '@aws-cdk/bloeh'],
61+
sourceRepo: 'aws/some-repo',
62+
maxWorkers: '500',
63+
});
64+
65+
const outdir = Testing.synth(repo);
66+
expect(outdir['.github/workflows/integ.yml']).toContain('run: bin/run-suite --maxWorkers=500 --use-cli-release=');
67+
});

0 commit comments

Comments
 (0)