-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add integ-runner and rosetta support (#17)
This PR adds default support for integ-runner and rosetta for construct libraries. I've been making these changes individually for some repos (see https://github.com/cdklabs/cdk-stacksets), but we should be controlling it centrally. closes https://github.com/cdklabs/cdk-ops/issues/2438
- Loading branch information
Showing
5 changed files
with
207 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Component, DependencyType } from 'projen'; | ||
import { TypeScriptProject } from 'projen/lib/typescript'; | ||
|
||
/** | ||
* This component adds support for using `integ-runner` and `integ-tests` | ||
* in a construct library. | ||
*/ | ||
export class IntegRunner extends Component { | ||
constructor(project: TypeScriptProject) { | ||
super(project); | ||
|
||
project.deps.addDependency('@aws-cdk/integ-runner@^2.45.0', DependencyType.DEVENV); | ||
project.deps.addDependency('@aws-cdk/integ-tests-alpha@^2.45.0-alpha.0', DependencyType.DEVENV); | ||
|
||
const integSnapshotTask = project.addTask('integ', { | ||
description: 'Run integration snapshot tests', | ||
receiveArgs: true, | ||
exec: 'yarn integ-runner --language typescript', | ||
}); | ||
|
||
project.addTask('integ:update', { | ||
description: 'Run and update integration snapshot tests', | ||
exec: 'yarn integ-runner --language typescript --update-on-failed', | ||
receiveArgs: true, | ||
}); | ||
|
||
project.testTask.spawn(integSnapshotTask); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Component, TextFile } from 'projen'; | ||
import { TypeScriptProject } from 'projen/lib/typescript'; | ||
|
||
/** | ||
* The Rosetta component adds builtin rosetta support | ||
* for a construct library. Since ConstructHub will run | ||
* rosetta for real, this just adds a check to the build to | ||
* ensure that rosetta will run successfully | ||
*/ | ||
export class Rosetta extends Component { | ||
constructor(project: TypeScriptProject) { | ||
super(project); | ||
|
||
const rosettaTask = project.addTask('rosetta:extract', { | ||
description: 'Test rosetta extract', | ||
exec: 'yarn --silent jsii-rosetta extract --strict', | ||
}); | ||
project.postCompileTask.spawn(rosettaTask); | ||
project.addGitIgnore('.jsii.tabl.json'); | ||
|
||
new TextFile(project, 'rosetta/default.ts-fixture', { | ||
readonly: false, | ||
lines: [ | ||
'// Fixture with packages imported, but nothing else', | ||
"import { Construct } from 'constructs';", | ||
'import {', | ||
' Stack,', | ||
"} from 'aws-cdk-lib';", | ||
'', | ||
'class Fixture extends Stack {', | ||
' constructor(scope: Construct, id: string) {', | ||
' super(scope, id);', | ||
'', | ||
' /// here', | ||
' }', | ||
'}', | ||
], | ||
marker: false, | ||
}); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.