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 : string
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
@@ -58,10 +36,22 @@ jobs:
58
36
registry-url : " https://registry.npmjs.org"
59
37
- name : Install dependencies
60
38
run : npm ci
61
- - uses : actions/download-artifact@v4
39
+ - name : Download build artifact
40
+ uses : actions/download-artifact@v4
41
+ if : ${{ github.event.inputs.mode == 'build' }}
62
42
with :
63
43
name : dist
64
44
path : dist
45
+ - name : Install lambda-live-debugger globally
46
+ if : ${{ github.event.inputs.mode == 'global' }}
47
+ run : |
48
+ npm i lambda-live-debugger -g
49
+ working-directory : test
50
+ - name : Install lambda-live-debugger locally
51
+ if : ${{ github.event.inputs.mode == 'local' }}
52
+ run : |
53
+ npm i lambda-live-debugger
54
+ working-directory : test
65
55
- name : Configure AWS Credentials
66
56
uses : aws-actions/configure-aws-credentials@v4
67
57
with :
81
71
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/cdk-basic.test.ts
82
72
83
73
test-sls-basic :
84
- needs :
85
- - build
86
74
runs-on : ubuntu-latest
87
75
concurrency :
88
76
group : test-sls-basic
@@ -95,10 +83,23 @@ jobs:
95
83
registry-url : " https://registry.npmjs.org"
96
84
- name : Install dependencies
97
85
run : npm ci
98
- - uses : actions/download-artifact@v4
86
+ - name : Download build artifact
87
+ uses : actions/download-artifact@v4
88
+ if : ${{ github.event.inputs.mode == 'build' }}
99
89
with :
100
90
name : dist
101
91
path : dist
92
+ - name : Install lambda-live-debugger globally
93
+ if : ${{ github.event.inputs.mode == 'global' }}
94
+ run : |
95
+ npm i lambda-live-debugger -g
96
+
97
+ working-directory : test
98
+ - name : Install lambda-live-debugger locally
99
+ if : ${{ github.event.inputs.mode == 'local' }}
100
+ run : |
101
+ npm i lambda-live-debugger
102
+ working-directory : test
102
103
- name : Configure AWS Credentials
103
104
uses : aws-actions/configure-aws-credentials@v4
104
105
with :
@@ -118,8 +119,6 @@ jobs:
118
119
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/sls-basic.test.ts
119
120
120
121
test-sls-esbuild-cjs :
121
- needs :
122
- - build
123
122
runs-on : ubuntu-latest
124
123
concurrency :
125
124
group : test-sls-esbuild-cjs
@@ -132,10 +131,23 @@ jobs:
132
131
registry-url : " https://registry.npmjs.org"
133
132
- name : Install dependencies
134
133
run : npm ci
135
- - uses : actions/download-artifact@v4
134
+ - name : Download build artifact
135
+ uses : actions/download-artifact@v4
136
+ if : ${{ github.event.inputs.mode == 'build' }}
136
137
with :
137
138
name : dist
138
139
path : dist
140
+ - name : Install lambda-live-debugger globally
141
+ if : ${{ github.event.inputs.mode == 'global' }}
142
+ run : |
143
+ npm i lambda-live-debugger -g
144
+
145
+ working-directory : test
146
+ - name : Install lambda-live-debugger locally
147
+ if : ${{ github.event.inputs.mode == 'local' }}
148
+ run : |
149
+ npm i lambda-live-debugger
150
+ working-directory : test
139
151
- name : Configure AWS Credentials
140
152
uses : aws-actions/configure-aws-credentials@v4
141
153
with :
@@ -155,8 +167,6 @@ jobs:
155
167
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/sls-esbuild-cjs.test.ts
156
168
157
169
test-sls-esbuild-esm :
158
- needs :
159
- - build
160
170
runs-on : ubuntu-latest
161
171
concurrency :
162
172
group : test-sls-esbuild-esm
@@ -169,10 +179,23 @@ jobs:
169
179
registry-url : " https://registry.npmjs.org"
170
180
- name : Install dependencies
171
181
run : npm ci
172
- - uses : actions/download-artifact@v4
182
+ - name : Download build artifact
183
+ uses : actions/download-artifact@v4
184
+ if : ${{ github.event.inputs.mode == 'build' }}
173
185
with :
174
186
name : dist
175
187
path : dist
188
+ - name : Install lambda-live-debugger globally
189
+ if : ${{ github.event.inputs.mode == 'global' }}
190
+ run : |
191
+ npm i lambda-live-debugger -g
192
+
193
+ working-directory : test
194
+ - name : Install lambda-live-debugger locally
195
+ if : ${{ github.event.inputs.mode == 'local' }}
196
+ run : |
197
+ npm i lambda-live-debugger
198
+ working-directory : test
176
199
- name : Configure AWS Credentials
177
200
uses : aws-actions/configure-aws-credentials@v4
178
201
with :
@@ -192,8 +215,6 @@ jobs:
192
215
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/sls-esbuild-esm.test.ts
193
216
194
217
test-sam-basic :
195
- needs :
196
- - build
197
218
runs-on : ubuntu-latest
198
219
concurrency :
199
220
group : test-sam-basic
@@ -210,10 +231,22 @@ jobs:
210
231
registry-url : " https://registry.npmjs.org"
211
232
- name : Install dependencies
212
233
run : npm ci
213
- - uses : actions/download-artifact@v4
234
+ - name : Download build artifact
235
+ uses : actions/download-artifact@v4
236
+ if : ${{ github.event.inputs.mode == 'build' }}
214
237
with :
215
238
name : dist
216
239
path : dist
240
+ - name : Install lambda-live-debugger globally
241
+ if : ${{ github.event.inputs.mode == 'global' }}
242
+ run : |
243
+ npm i lambda-live-debugger -g
244
+ working-directory : test
245
+ - name : Install lambda-live-debugger locally
246
+ if : ${{ github.event.inputs.mode == 'local' }}
247
+ run : |
248
+ npm i lambda-live-debugger
249
+ working-directory : test
217
250
- name : Configure AWS Credentials
218
251
uses : aws-actions/configure-aws-credentials@v4
219
252
with :
@@ -233,8 +266,6 @@ jobs:
233
266
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/sam-basic.test.ts
234
267
235
268
test-terraform-basic :
236
- needs :
237
- - build
238
269
runs-on : ubuntu-latest
239
270
concurrency :
240
271
group : test-terraform-basic
@@ -247,10 +278,22 @@ jobs:
247
278
registry-url : " https://registry.npmjs.org"
248
279
- name : Install dependencies
249
280
run : npm ci
250
- - uses : actions/download-artifact@v4
281
+ - name : Download build artifact
282
+ uses : actions/download-artifact@v4
283
+ if : ${{ github.event.inputs.mode == 'build' }}
251
284
with :
252
285
name : dist
253
286
path : dist
287
+ - name : Install lambda-live-debugger globally
288
+ if : ${{ github.event.inputs.mode == 'global' }}
289
+ run : |
290
+ npm i lambda-live-debugger -g
291
+ working-directory : test
292
+ - name : Install lambda-live-debugger locally
293
+ if : ${{ github.event.inputs.mode == 'local' }}
294
+ run : |
295
+ npm i lambda-live-debugger
296
+ working-directory : test
254
297
- name : Configure AWS Credentials
255
298
uses : aws-actions/configure-aws-credentials@v4
256
299
with :
@@ -275,37 +318,3 @@ jobs:
275
318
run : npx vitest --retry 1 test/terraform-basic.test.ts
276
319
- name : Test - observable mode
277
320
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