1
- name : Common CI
1
+ name : Common CI tests
2
+
3
+ run-name : " Test: mode=${{ inputs.mode }}, testMonorepo=${{ inputs.testMonorepo }}"
2
4
3
5
on :
4
6
workflow_call :
7
+ inputs :
8
+ mode :
9
+ description : " 'build' (just builded code, used while publishing) or 'global' (real NPM installed globally) or 'local' (real NPM installed locally)"
10
+ type : string
11
+ required : true
12
+ testMonorepo :
13
+ description : " Test monorepo by specifying folder in config"
14
+ type : string
15
+ required : true
5
16
6
17
permissions :
7
18
id-token : write
8
19
contents : write
9
20
10
21
env :
11
22
DISABLE_PARALLEL_DEPLOY : false
23
+ REAL_NPM : ${{ inputs.mode == 'global' || inputs.mode == 'local' }}
24
+ TEST_MONOREPO : ${{ github.event.inputs.testMonorepo }}
12
25
node_version : 20
13
26
14
27
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
28
test-cdk-basic :
47
- needs :
48
- - build
49
29
runs-on : ubuntu-latest
50
30
concurrency :
51
31
group : test-cdk-basic
@@ -58,10 +38,22 @@ jobs:
58
38
registry-url : " https://registry.npmjs.org"
59
39
- name : Install dependencies
60
40
run : npm ci
61
- - uses : actions/download-artifact@v4
41
+ - name : Download build artifact
42
+ uses : actions/download-artifact@v4
43
+ if : ${{ inputs.mode == 'build' }}
62
44
with :
63
45
name : dist
64
46
path : dist
47
+ - name : Install lambda-live-debugger globally
48
+ if : ${{ inputs.mode == 'global' }}
49
+ run : |
50
+ npm i lambda-live-debugger -g
51
+ working-directory : test
52
+ - name : Install lambda-live-debugger locally
53
+ if : ${{ inputs.mode == 'local' }}
54
+ run : |
55
+ npm i lambda-live-debugger
56
+ working-directory : test
65
57
- name : Configure AWS Credentials
66
58
uses : aws-actions/configure-aws-credentials@v4
67
59
with :
81
73
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/cdk-basic.test.ts
82
74
83
75
test-sls-basic :
84
- needs :
85
- - build
86
76
runs-on : ubuntu-latest
87
77
concurrency :
88
78
group : test-sls-basic
@@ -95,10 +85,23 @@ jobs:
95
85
registry-url : " https://registry.npmjs.org"
96
86
- name : Install dependencies
97
87
run : npm ci
98
- - uses : actions/download-artifact@v4
88
+ - name : Download build artifact
89
+ uses : actions/download-artifact@v4
90
+ if : ${{ inputs.mode == 'build' }}
99
91
with :
100
92
name : dist
101
93
path : dist
94
+ - name : Install lambda-live-debugger globally
95
+ if : ${{ inputs.mode == 'global' }}
96
+ run : |
97
+ npm i lambda-live-debugger -g
98
+
99
+ working-directory : test
100
+ - name : Install lambda-live-debugger locally
101
+ if : ${{ inputs.mode == 'local' }}
102
+ run : |
103
+ npm i lambda-live-debugger
104
+ working-directory : test
102
105
- name : Configure AWS Credentials
103
106
uses : aws-actions/configure-aws-credentials@v4
104
107
with :
@@ -118,8 +121,6 @@ jobs:
118
121
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/sls-basic.test.ts
119
122
120
123
test-sls-esbuild-cjs :
121
- needs :
122
- - build
123
124
runs-on : ubuntu-latest
124
125
concurrency :
125
126
group : test-sls-esbuild-cjs
@@ -132,10 +133,23 @@ jobs:
132
133
registry-url : " https://registry.npmjs.org"
133
134
- name : Install dependencies
134
135
run : npm ci
135
- - uses : actions/download-artifact@v4
136
+ - name : Download build artifact
137
+ uses : actions/download-artifact@v4
138
+ if : ${{ inputs.mode == 'build' }}
136
139
with :
137
140
name : dist
138
141
path : dist
142
+ - name : Install lambda-live-debugger globally
143
+ if : ${{ inputs.mode == 'global' }}
144
+ run : |
145
+ npm i lambda-live-debugger -g
146
+
147
+ working-directory : test
148
+ - name : Install lambda-live-debugger locally
149
+ if : ${{ inputs.mode == 'local' }}
150
+ run : |
151
+ npm i lambda-live-debugger
152
+ working-directory : test
139
153
- name : Configure AWS Credentials
140
154
uses : aws-actions/configure-aws-credentials@v4
141
155
with :
@@ -155,8 +169,6 @@ jobs:
155
169
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/sls-esbuild-cjs.test.ts
156
170
157
171
test-sls-esbuild-esm :
158
- needs :
159
- - build
160
172
runs-on : ubuntu-latest
161
173
concurrency :
162
174
group : test-sls-esbuild-esm
@@ -169,10 +181,23 @@ jobs:
169
181
registry-url : " https://registry.npmjs.org"
170
182
- name : Install dependencies
171
183
run : npm ci
172
- - uses : actions/download-artifact@v4
184
+ - name : Download build artifact
185
+ uses : actions/download-artifact@v4
186
+ if : ${{ inputs.mode == 'build' }}
173
187
with :
174
188
name : dist
175
189
path : dist
190
+ - name : Install lambda-live-debugger globally
191
+ if : ${{ inputs.mode == 'global' }}
192
+ run : |
193
+ npm i lambda-live-debugger -g
194
+
195
+ working-directory : test
196
+ - name : Install lambda-live-debugger locally
197
+ if : ${{ inputs.mode == 'local' }}
198
+ run : |
199
+ npm i lambda-live-debugger
200
+ working-directory : test
176
201
- name : Configure AWS Credentials
177
202
uses : aws-actions/configure-aws-credentials@v4
178
203
with :
@@ -192,8 +217,6 @@ jobs:
192
217
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/sls-esbuild-esm.test.ts
193
218
194
219
test-sam-basic :
195
- needs :
196
- - build
197
220
runs-on : ubuntu-latest
198
221
concurrency :
199
222
group : test-sam-basic
@@ -210,10 +233,22 @@ jobs:
210
233
registry-url : " https://registry.npmjs.org"
211
234
- name : Install dependencies
212
235
run : npm ci
213
- - uses : actions/download-artifact@v4
236
+ - name : Download build artifact
237
+ uses : actions/download-artifact@v4
238
+ if : ${{ inputs.mode == 'build' }}
214
239
with :
215
240
name : dist
216
241
path : dist
242
+ - name : Install lambda-live-debugger globally
243
+ if : ${{ inputs.mode == 'global' }}
244
+ run : |
245
+ npm i lambda-live-debugger -g
246
+ working-directory : test
247
+ - name : Install lambda-live-debugger locally
248
+ if : ${{ inputs.mode == 'local' }}
249
+ run : |
250
+ npm i lambda-live-debugger
251
+ working-directory : test
217
252
- name : Configure AWS Credentials
218
253
uses : aws-actions/configure-aws-credentials@v4
219
254
with :
@@ -233,8 +268,6 @@ jobs:
233
268
run : OBSERVABLE_MODE=true npx vitest --retry 1 test/sam-basic.test.ts
234
269
235
270
test-terraform-basic :
236
- needs :
237
- - build
238
271
runs-on : ubuntu-latest
239
272
concurrency :
240
273
group : test-terraform-basic
@@ -247,10 +280,22 @@ jobs:
247
280
registry-url : " https://registry.npmjs.org"
248
281
- name : Install dependencies
249
282
run : npm ci
250
- - uses : actions/download-artifact@v4
283
+ - name : Download build artifact
284
+ uses : actions/download-artifact@v4
285
+ if : ${{ inputs.mode == 'build' }}
251
286
with :
252
287
name : dist
253
288
path : dist
289
+ - name : Install lambda-live-debugger globally
290
+ if : ${{ inputs.mode == 'global' }}
291
+ run : |
292
+ npm i lambda-live-debugger -g
293
+ working-directory : test
294
+ - name : Install lambda-live-debugger locally
295
+ if : ${{ inputs.mode == 'local' }}
296
+ run : |
297
+ npm i lambda-live-debugger
298
+ working-directory : test
254
299
- name : Configure AWS Credentials
255
300
uses : aws-actions/configure-aws-credentials@v4
256
301
with :
@@ -275,37 +320,3 @@ jobs:
275
320
run : npx vitest --retry 1 test/terraform-basic.test.ts
276
321
- name : Test - observable mode
277
322
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