forked from linode/manager
-
Notifications
You must be signed in to change notification settings - Fork 0
358 lines (337 loc) · 11.3 KB
/
ci.yml
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
name: ci
on:
push:
branches:
- master
- staging
- develop
pull_request:
jobs:
lint:
strategy:
matrix:
package: ["linode-manager", "@linode/api-v4", "@linode/validation", "@linode/ui"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.17"
- uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn workspace ${{ matrix.package }} run lint
build-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.17"
- uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn workspace @linode/validation run build
- uses: actions/upload-artifact@v4
with:
name: packages-validation-lib
path: packages/validation/lib
publish-validation:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: build-validation
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: packages-validation-lib
path: packages/validation/lib
- uses: JS-DevTools/npm-publish@v1
id: npm-publish
with:
token: ${{ secrets.NPM_AUTH_TOKEN }}
package: ./packages/validation/package.json
- name: slack-notify
uses: rtCamp/action-slack-notify@master
if: steps.npm-publish.outputs.type != 'none'
env:
SLACK_CHANNEL: api-js-client
SLACK_TITLE: "Linode Validation v${{ steps.npm-publish.outputs.version}}"
SLACK_MESSAGE: ":rocket: Linode Validation Library has been published to NPM: ${{ steps.npm-publish.outputs.old-version }} => ${{ steps.npm-publish.outputs.version }}. View the changelog at https://github.com/linode/manager/blob/master/packages/validation/CHANGELOG.md"
SLACK_USERNAME: npm-bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_ICON_EMOJI: ":package:"
MSG_MINIMAL: true
test-sdk:
runs-on: ubuntu-latest
needs: build-validation
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.17"
- uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- run: yarn --frozen-lockfile
- uses: actions/download-artifact@v4
with:
name: packages-validation-lib
path: packages/validation/lib
- run: yarn workspace @linode/api-v4 run test
build-sdk:
runs-on: ubuntu-latest
needs: build-validation
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.17"
- uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- uses: actions/download-artifact@v4
with:
name: packages-validation-lib
path: packages/validation/lib
- run: yarn --frozen-lockfile
- run: yarn workspace @linode/api-v4 run build
- uses: actions/upload-artifact@v4
with:
name: packages-api-v4-lib
path: packages/api-v4/lib
validate-sdk:
runs-on: ubuntu-latest
needs: build-sdk
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.17"
# Download the validation and api-v4 artifacts (built packages)
- uses: actions/download-artifact@v4
with:
name: packages-validation-lib
path: packages/validation/lib
- uses: actions/download-artifact@v4
with:
name: packages-api-v4-lib
path: packages/api-v4/lib
# Create an api-v4 tarball
- run: cd packages/api-v4 && npm pack --pack-destination ../../
# Create an validation tarball
- run: cd packages/validation && npm pack --pack-destination ../../
# Test @linode/api-v4 as an ES Module
- run: mkdir test-sdk-esm && cd test-sdk-esm && npm init es6 -y && npm install ../$(ls ../ | grep "linode-api-v4-.*\.tgz") ../$(ls ../ | grep "linode-validation-.*\.tgz")
- run: cp scripts/validatePackages/sdk-esm.js test-sdk-esm/
- run: cd test-sdk-esm && node ./sdk-esm.js
# Verify @linode/api-v4 as CommonJS
- run: mkdir test-sdk-cjs && cd test-sdk-cjs && npm init -y && npm install ../$(ls ../ | grep "linode-api-v4-.*\.tgz") ../$(ls ../ | grep "linode-validation-.*\.tgz")
- run: cp scripts/validatePackages/sdk-commonjs.cjs test-sdk-cjs/
- run: cd test-sdk-cjs && node ./sdk-commonjs.cjs
test-manager:
runs-on: ubuntu-latest
needs: build-sdk
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.17"
- uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- uses: actions/download-artifact@v4
with:
name: packages-validation-lib
path: packages/validation/lib
- uses: actions/download-artifact@v4
with:
name: packages-api-v4-lib
path: packages/api-v4/lib
- run: yarn --frozen-lockfile
- run: yarn workspace linode-manager run test
test-search:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.17"
- uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn workspace @linode/search run test
test-ui:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.17"
- uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn workspace @linode/ui run test
typecheck-ui:
runs-on: ubuntu-latest
needs: build-sdk
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.17"
- uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn workspace @linode/ui run typecheck
typecheck-manager:
runs-on: ubuntu-latest
needs: build-sdk
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.17"
- uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- uses: actions/download-artifact@v4
with:
name: packages-validation-lib
path: packages/validation/lib
- uses: actions/download-artifact@v4
with:
name: packages-api-v4-lib
path: packages/api-v4/lib
- run: yarn --frozen-lockfile
- run: yarn workspace linode-manager run typecheck
build-manager:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: build-sdk
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.17"
- uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- uses: actions/download-artifact@v4
with:
name: packages-validation-lib
path: packages/validation/lib
- uses: actions/download-artifact@v4
with:
name: packages-api-v4-lib
path: packages/api-v4/lib
- run: yarn --frozen-lockfile
- run: yarn workspace linode-manager run build
- uses: actions/upload-artifact@v4
with:
name: packages-manager-build
path: packages/manager/build
publish-sdk:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs:
- test-sdk
- validate-sdk
# If the validation publish failed we could have mismatched versions and a broken JS client
- publish-validation
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: packages-api-v4-lib
path: packages/api-v4/lib
- uses: JS-DevTools/npm-publish@v1
id: npm-publish
with:
token: ${{ secrets.NPM_AUTH_TOKEN }}
package: ./packages/api-v4/package.json
- name: slack-notify
uses: rtCamp/action-slack-notify@master
if: steps.npm-publish.outputs.type != 'none'
env:
SLACK_CHANNEL: api-js-client
SLACK_TITLE: "Linode JS Client v${{ steps.npm-publish.outputs.version}}"
SLACK_MESSAGE: ":rocket: Linode JS Client has been published to NPM: ${{ steps.npm-publish.outputs.old-version }} => ${{ steps.npm-publish.outputs.version }}. View the changelog at https://github.com/linode/manager/blob/master/packages/api-v4/CHANGELOG.md"
SLACK_USERNAME: npm-bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_ICON_EMOJI: ":package:"
MSG_MINIMAL: true
build-storybook:
runs-on: ubuntu-latest
needs: build-sdk
env:
NODE_OPTIONS: --max-old-space-size=4096
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.17"
- uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- uses: actions/download-artifact@v4
with:
name: packages-validation-lib
path: packages/validation/lib
- uses: actions/download-artifact@v4
with:
name: packages-api-v4-lib
path: packages/api-v4/lib
- run: yarn --frozen-lockfile
- run: yarn workspace linode-manager run build-storybook
- uses: actions/upload-artifact@v4
with:
name: storybook-build
path: packages/manager/storybook-static
publish-storybook:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: build-storybook
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: storybook-build
path: storybook/build
- uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_ENDPOINT: https://us-east-1.linodeobjects.com
AWS_S3_BUCKET: ${{ secrets.STORYBOOK_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-1
SOURCE_DIR: storybook/build