1
- name : Common CI
1
+ name : Common CI tests
2
2
3
3
on :
4
4
workflow_call :
5
+ inputs :
6
+ mode :
7
+ description : " 'build' (just builded code, used while publishing) or 'global' (real NPM installed globally) or 'local' (real NPM installed locally) "
8
+ type : string
9
+ required : true
10
+ testMonorepo :
11
+ description : " Test monorepo by specifying folder in config
12
+ type: boolean
13
+ default: false
5
14
6
15
permissions:
7
16
id-token: write
8
17
contents: write
9
18
10
19
env:
11
20
DISABLE_PARALLEL_DEPLOY: false
21
+ REAL_NPM: ${{ github.event.inputs.mode == 'global' || github.event.inputs.mode == 'local' }}
22
+ TEST_MONOREPO: ${{ github.event.inputs.testMonorepo }}
12
23
node_version: 20
13
24
14
25
jobs:
15
- build :
16
- runs-on : ubuntu-latest
17
- concurrency :
18
- group : build
19
- steps :
20
- - uses : actions/checkout@v4
21
- - name : Use Node.js
22
- uses : actions/setup-node@v4
23
- with :
24
- node-version : ${{ env.node_version }}
25
- registry-url : " https://registry.npmjs.org"
26
- - name : Install dependencies
27
- run : npm ci
28
- - name : Typecheck
29
- run : npm run typecheck
30
- - name : Build
31
- run : npm run build
32
- - name : Configure AWS Credentials
33
- uses : aws-actions/configure-aws-credentials@v4
34
- with :
35
- aws-region : eu-west-1
36
- role-to-assume : ${{ secrets.AWS_ROLE }}
37
- role-session-name : GitHubActions
38
- - name : Bootstrap CDK
39
- # so I do not have to do it manually when CDK is updated
40
- run : npx cdk bootstrap aws://${{secrets.AWS_ACCOUNT_ID}}/eu-west-1
41
- - uses : actions/upload-artifact@v4
42
- with :
43
- name : dist
44
- path : dist
45
-
46
26
test-cdk-basic:
47
- needs :
48
- - build
49
27
runs-on: ubuntu-latest
50
28
concurrency:
51
29
group: test-cdk-basic
59
37
- name : Install dependencies
60
38
run : npm ci
61
39
- uses : actions/download-artifact@v4
40
+ if : ${{ github.event.inputs.mode == 'build' }}
62
41
with :
63
42
name : dist
64
43
path : dist
44
+ - name : Install lambda-live-debugger globally
45
+ if : ${{ github.event.inputs.mode == 'global' }}
46
+ run : |
47
+ npm i lambda-live-debugger -g
48
+ working-directory : test
49
+ - name : Install lambda-live-debugger locally
50
+ if : ${{ github.event.inputs.mode != 'local' }}
51
+ run : |
52
+ npm i lambda-live-debugger
53
+ working-directory : test
65
54
- name : Configure AWS Credentials
66
55
uses : aws-actions/configure-aws-credentials@v4
67
56
with :
81
70
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/cdk-basic.test.ts
82
71
83
72
test-sls-basic :
84
- needs :
85
- - build
86
73
runs-on : ubuntu-latest
87
74
concurrency :
88
75
group : test-sls-basic
96
83
- name : Install dependencies
97
84
run : npm ci
98
85
- uses : actions/download-artifact@v4
86
+ if : ${{ github.event.inputs.mode == 'build' }}
99
87
with :
100
88
name : dist
101
89
path : dist
@@ -118,8 +106,6 @@ jobs:
118
106
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/sls-basic.test.ts
119
107
120
108
test-sls-esbuild-cjs :
121
- needs :
122
- - build
123
109
runs-on : ubuntu-latest
124
110
concurrency :
125
111
group : test-sls-esbuild-cjs
@@ -133,6 +119,7 @@ jobs:
133
119
- name : Install dependencies
134
120
run : npm ci
135
121
- uses : actions/download-artifact@v4
122
+ if : ${{ github.event.inputs.mode == 'build' }}
136
123
with :
137
124
name : dist
138
125
path : dist
@@ -155,8 +142,6 @@ jobs:
155
142
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/sls-esbuild-cjs.test.ts
156
143
157
144
test-sls-esbuild-esm :
158
- needs :
159
- - build
160
145
runs-on : ubuntu-latest
161
146
concurrency :
162
147
group : test-sls-esbuild-esm
@@ -170,6 +155,7 @@ jobs:
170
155
- name : Install dependencies
171
156
run : npm ci
172
157
- uses : actions/download-artifact@v4
158
+ if : ${{ github.event.inputs.mode == 'build' }}
173
159
with :
174
160
name : dist
175
161
path : dist
@@ -192,8 +178,6 @@ jobs:
192
178
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/sls-esbuild-esm.test.ts
193
179
194
180
test-sam-basic :
195
- needs :
196
- - build
197
181
runs-on : ubuntu-latest
198
182
concurrency :
199
183
group : test-sam-basic
@@ -211,6 +195,7 @@ jobs:
211
195
- name : Install dependencies
212
196
run : npm ci
213
197
- uses : actions/download-artifact@v4
198
+ if : ${{ github.event.inputs.mode == 'build' }}
214
199
with :
215
200
name : dist
216
201
path : dist
@@ -233,8 +218,6 @@ jobs:
233
218
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/sam-basic.test.ts
234
219
235
220
test-terraform-basic :
236
- needs :
237
- - build
238
221
runs-on : ubuntu-latest
239
222
concurrency :
240
223
group : test-terraform-basic
@@ -248,6 +231,7 @@ jobs:
248
231
- name : Install dependencies
249
232
run : npm ci
250
233
- uses : actions/download-artifact@v4
234
+ if : ${{ github.event.inputs.mode == 'build' }}
251
235
with :
252
236
name : dist
253
237
path : dist
@@ -275,37 +259,3 @@ jobs:
275
259
run : npx vitest --retry 1 test/terraform-basic.test.ts
276
260
- name : Test - observable mode
277
261
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/terraform-basic.test.ts
278
-
279
- publish :
280
- needs :
281
- - test-cdk-basic
282
- - test-sls-basic
283
- - test-sls-esbuild-cjs
284
- - test-sls-esbuild-esm
285
- - test-sam-basic
286
- - test-terraform-basic
287
- if : github.event_name == 'workflow_dispatch'
288
- runs-on : ubuntu-latest
289
- concurrency :
290
- group : publish
291
- steps :
292
- - uses : actions/checkout@v4
293
- - name : Use Node.js
294
- uses : actions/setup-node@v4
295
- with :
296
- node-version : ${{ env.node_version }}
297
- registry-url : " https://registry.npmjs.org"
298
- - name : Install dependencies
299
- run : npm ci
300
- - uses : actions/download-artifact@v4
301
- with :
302
- name : dist
303
- path : dist
304
- - name : Semantic Release
305
- run : |
306
- npm whoami
307
- npx semantic-release
308
- env :
309
- GITHUB_TOKEN : ${{ secrets.PRIVATE_GITHUB_TOKEN }}
310
- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
311
- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments