-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.projenrc.ts
125 lines (113 loc) · 3.29 KB
/
.projenrc.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import { awscdk, javascript, TaskStep, TextFile } from 'projen';
import { GithubCredentials } from 'projen/lib/github';
import { JobPermission } from 'projen/lib/github/workflows-model';
const nodejsVersion = 'v20';
const project = new awscdk.AwsCdkConstructLibrary({
author: 'Elisa SRE',
keywords: ['aws', 'cdk', 'constructs'],
depsUpgrade: false,
authorAddress: '',
cdkVersion: '2.128.0',
defaultReleaseBranch: 'main',
name: '@elisasre/cdk-constructs',
packageManager: javascript.NodePackageManager.NPM,
repositoryUrl: 'https://github.com/elisasre/cdk-constructs.git',
bundledDeps: ['cfn-response', 'aws-sdk'],
description: 'Constructs for AWS CDK',
devDeps: ['esbuild', '@aws-cdk/integ-tests-alpha', '@aws-cdk/integ-runner', '@types/cfn-response', '@types/aws-lambda'],
gitignore: ['test/cdk-integ.out*'],
releaseToNpm: true,
npmRegistryUrl: 'https://npm.pkg.github.com',
githubOptions: {
mergify: false,
projenCredentials: GithubCredentials.fromPersonalAccessToken({ secret: 'DEVOPS_CI_PAT' }),
},
dependabot: true,
licensed: false,
projenrcTs: true,
workflowNodeVersion: nodejsVersion,
});
const integrationTestSteps: TaskStep[] = [
{
name: 'integration-test',
exec: [
'integ-runner',
'--app="ts-node {filePath}"',
'--test-regex="test/integ\.[a-z-_]+.ts$"',
'--parallel-regions=eu-central-1',
'--update-on-failed',
].join(' '),
},
];
const integrationTestPreSteps = ['default', 'compile']
.map((taskName) => project.tasks.tryFind(taskName))
.filter(task => task !== undefined)
.reduce((acc, task) => [...acc, ...task?.steps ?? []], [] as TaskStep[]);
project.addTask('integrationtest', {
description: 'Runs integration tests',
steps: [...integrationTestPreSteps, ...integrationTestSteps],
});
project.buildWorkflow?.addPostBuildJob('integrationtest', {
concurrency: {
group: 'integrationtest',
},
tools: {
node: {
version: nodejsVersion,
},
},
permissions: {
contents: JobPermission.READ,
idToken: JobPermission.WRITE,
},
runsOn: ['ubuntu-latest'],
steps: [
{
name: 'Checkout',
uses: 'actions/checkout@v3',
with: {
ref: '${{ github.event.pull_request.head.ref }}',
repository: '${{ github.event.pull_request.head.repo.full_name }}',
},
},
{
name: 'Install dependencies',
run: 'npm install',
},
{
name: 'Configure AWS credentials',
uses: 'aws-actions/configure-aws-credentials@v4',
with: {
'role-to-assume': 'arn:aws:iam::762212084818:role/cdk-constructs-test-role',
'role-session-name': 'cdk-constructs-test',
'aws-region': 'eu-central-1',
},
},
{
name: 'Run integration tests',
run: 'npx projen integrationtest',
},
],
});
project.buildWorkflow?.addPostBuildJob('automerge', {
needs: ['integrationtest'],
permissions: {
pullRequests: JobPermission.WRITE,
contents: JobPermission.WRITE,
},
runsOn: ['ubuntu-latest'],
steps: [
{
name: 'Automerge dependabot PR',
uses: 'elisa-actions/github-action-merge-dependabot@v3',
with: {
'target': 'minor',
'github-token': '${{ secrets.DOPS_SRE_PAT }}',
},
},
],
});
new TextFile(project, '.nvmrc', {
lines: [nodejsVersion],
});
project.synth();