|
1
|
name: Documentation Tests |
|
2
|
on: |
|
3
|
pull_request: |
|
4
|
paths: |
|
5
|
- www/** |
|
6
|
- .github/workflows/docs-test.yml |
|
7
|
|
|
8
|
jobs: |
|
9
|
apps-test: |
|
10
|
timeout-minutes: 45 |
|
11
|
if: ${{ startsWith(github.head_ref, 'docs/') }} |
|
12
|
runs-on: ubuntu-latest |
|
13
|
steps: |
|
14
|
- name: Cancel Previous Runs |
|
15
|
uses: styfle/cancel-workflow-action@0.11.0 |
|
16
|
with: |
|
17
|
access_token: ${{ github.token }} |
|
18
|
|
|
19
|
- name: Checkout |
|
20
|
uses: actions/checkout@v3 |
|
21
|
with: |
|
22
|
fetch-depth: 0 |
|
23
|
|
|
24
|
- name: Setup Node.js environment |
|
25
|
uses: actions/setup-node@v4 |
|
26
|
with: |
|
27
|
node-version: 22 |
|
28
|
cache: "yarn" |
|
29
|
|
|
30
|
- name: Install dependencies |
|
31
|
uses: ./.github/actions/cache-deps |
|
32
|
with: |
|
33
|
extension: docs |
|
34
|
|
|
35
|
- name: Install Workspace dependencies |
|
36
|
working-directory: www |
|
37
|
run: yarn install |
|
38
|
|
|
39
|
- name: Run Tests |
|
40
|
working-directory: www |
|
41
|
run: yarn test |
|
42
|
|
|
43
|
- name: Build Doc Apps |
|
44
|
working-directory: www |
|
45
|
run: yarn build --concurrency=2 |
|
46
|
env: |
|
47
|
NEXT_PUBLIC_BASE_URL: "http://localhost:3000" |
|
48
|
NEXT_PUBLIC_BASE_PATH: /api |
|
49
|
NEXT_PUBLIC_DOCS_URL: "https://medusa-docs.vercel.app" |
|
50
|
NODE_ENV: production |
|
51
|
NEXT_PUBLIC_RESOURCES_URL: "http://medusa-types-nine.vercel.app" |
|
52
|
NEXT_PUBLIC_SANITY_PROJECT_ID: temp |
|
53
|
NEXT_PUBLIC_SANITY_DATASET: temp |
|
54
|
NEXT_PUBLIC_ENV: CI |
|
55
|
# TODO change once we have actual URLs |
|
56
|
NEXT_PUBLIC_USER_GUIDE_URL: "http://example.com" |
|
57
|
|
|
58
|
vale-book: |
|
59
|
if: ${{ startsWith(github.head_ref, 'docs/') }} |
|
60
|
runs-on: ubuntu-latest |
|
61
|
steps: |
|
62
|
- name: Cancel Previous Runs |
|
63
|
uses: styfle/cancel-workflow-action@0.11.0 |
|
64
|
with: |
|
65
|
access_token: ${{ github.token }} |
|
66
|
|
|
67
|
- name: Checkout |
|
68
|
uses: actions/checkout@v3 |
|
69
|
with: |
|
70
|
fetch-depth: 0 |
|
71
|
|
|
72
|
- name: Install Dependencies |
|
73
|
run: yarn |
|
74
|
|
|
75
|
- name: Build Dependencies |
|
76
|
run: yarn build |
|
77
|
|
|
78
|
- name: Install www/utils Dependencies |
|
79
|
run: yarn |
|
80
|
working-directory: www/utils |
|
81
|
|
|
82
|
- name: Build utils |
|
83
|
run: yarn build |
|
84
|
working-directory: www/utils |
|
85
|
|
|
86
|
# reviewdog throws an error when the number |
|
87
|
# of file changes in a PR is > 300, so |
|
88
|
# we retrieve the number of changed files |
|
89
|
# and only run the linter if the number is |
|
90
|
# less than 300. This is to avoid a PR hanging in |
|
91
|
# an error state |
|
92
|
- name: Get PR files number |
|
93
|
working-directory: www/utils/packages/scripts |
|
94
|
run: "yarn check:pr-files-count ${{ github.ref_name }}" |
|
95
|
id: pr-files |
|
96
|
|
|
97
|
- name: Get Directories to Scan |
|
98
|
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }} |
|
99
|
working-directory: www/vale |
|
100
|
run: ./get-files.sh book/app/learn resources |
|
101
|
id: directories |
|
102
|
|
|
103
|
- name: Vale Linter |
|
104
|
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }} |
|
105
|
uses: errata-ai/vale-action@reviewdog |
|
106
|
with: |
|
107
|
files: ${{ steps.directories.outputs.LIST }} |
|
108
|
fail_on_error: true |
|
109
|
vale_flags: "--minAlertLevel=error" |
|
110
|
reporter: github-pr-check |
|
111
|
token: ${{ github.token }} |
|
112
|
filter_mode: nofilter |
|
113
|
env: |
|
114
|
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }} |
|
115
|
|
|
116
|
vale-resources: |
|
117
|
if: ${{ startsWith(github.head_ref, 'docs/') }} |
|
118
|
runs-on: ubuntu-latest |
|
119
|
steps: |
|
120
|
- name: Cancel Previous Runs |
|
121
|
uses: styfle/cancel-workflow-action@0.11.0 |
|
122
|
with: |
|
123
|
access_token: ${{ github.token }} |
|
124
|
|
|
125
|
- name: Checkout |
|
126
|
uses: actions/checkout@v3 |
|
127
|
with: |
|
128
|
fetch-depth: 0 |
|
129
|
|
|
130
|
- name: Install Dependencies |
|
131
|
run: yarn |
|
132
|
|
|
133
|
- name: Build Dependencies |
|
134
|
run: yarn build |
|
135
|
|
|
136
|
- name: Install www/utils Dependencies |
|
137
|
run: yarn |
|
138
|
working-directory: www/utils |
|
139
|
|
|
140
|
- name: Build utils |
|
141
|
run: yarn build |
|
142
|
working-directory: www/utils |
|
143
|
|
|
144
|
# reviewdog throws an error when the number |
|
145
|
# of file changes in a PR is > 300, so |
|
146
|
# we retrieve the number of changed files |
|
147
|
# and only run the linter if the number is |
|
148
|
# less than 300. This is to avoid a PR hanging in |
|
149
|
# an error state |
|
150
|
- name: Get PR files number |
|
151
|
working-directory: www/utils/packages/scripts |
|
152
|
run: "yarn check:pr-files-count ${{ github.ref_name }}" |
|
153
|
id: pr-files |
|
154
|
|
|
155
|
- name: Get Directories to Scan |
|
156
|
working-directory: www/vale |
|
157
|
run: ./get-files.sh resources/app |
|
158
|
id: directories |
|
159
|
|
|
160
|
- name: Vale Linter |
|
161
|
uses: errata-ai/vale-action@reviewdog |
|
162
|
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }} |
|
163
|
with: |
|
164
|
files: ${{ steps.directories.outputs.LIST }} |
|
165
|
fail_on_error: true |
|
166
|
vale_flags: "--minAlertLevel=error" |
|
167
|
reporter: github-pr-check |
|
168
|
token: ${{ github.token }} |
|
169
|
filter_mode: nofilter |
|
170
|
env: |
|
171
|
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }} |
|
172
|
|
|
173
|
vale-user-guide: |
|
174
|
if: ${{ startsWith(github.head_ref, 'docs/') }} |
|
175
|
runs-on: ubuntu-latest |
|
176
|
steps: |
|
177
|
- name: Cancel Previous Runs |
|
178
|
uses: styfle/cancel-workflow-action@0.11.0 |
|
179
|
with: |
|
180
|
access_token: ${{ github.token }} |
|
181
|
|
|
182
|
- name: Checkout |
|
183
|
uses: actions/checkout@v3 |
|
184
|
with: |
|
185
|
fetch-depth: 0 |
|
186
|
|
|
187
|
- name: Install Dependencies |
|
188
|
run: yarn |
|
189
|
|
|
190
|
- name: Build Dependencies |
|
191
|
run: yarn build |
|
192
|
|
|
193
|
- name: Install www/utils Dependencies |
|
194
|
run: yarn |
|
195
|
working-directory: www/utils |
|
196
|
|
|
197
|
- name: Build utils |
|
198
|
run: yarn build |
|
199
|
working-directory: www/utils |
|
200
|
|
|
201
|
# reviewdog throws an error when the number |
|
202
|
# of file changes in a PR is > 300, so |
|
203
|
# we retrieve the number of changed files |
|
204
|
# and only run the linter if the number is |
|
205
|
# less than 300. This is to avoid a PR hanging in |
|
206
|
# an error state |
|
207
|
- name: Get PR files number |
|
208
|
working-directory: www/utils/packages/scripts |
|
209
|
run: "yarn check:pr-files-count ${{ github.ref_name }}" |
|
210
|
id: pr-files |
|
211
|
|
|
212
|
- name: Get Directories to Scan |
|
213
|
working-directory: www/vale |
|
214
|
run: ./get-files.sh user-guide/app |
|
215
|
id: directories |
|
216
|
|
|
217
|
- name: Vale Linter |
|
218
|
uses: errata-ai/vale-action@reviewdog |
|
219
|
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }} |
|
220
|
with: |
|
221
|
files: ${{ steps.directories.outputs.LIST }} |
|
222
|
fail_on_error: true |
|
223
|
vale_flags: "--minAlertLevel=error" |
|
224
|
reporter: github-pr-check |
|
225
|
token: ${{ github.token }} |
|
226
|
filter_mode: nofilter |
|
227
|
env: |
|
228
|
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }} |
|
229
|
|
|
230
|
vale-ui: |
|
231
|
if: ${{ startsWith(github.head_ref, 'docs/') }} |
|
232
|
runs-on: ubuntu-latest |
|
233
|
steps: |
|
234
|
- name: Cancel Previous Runs |
|
235
|
uses: styfle/cancel-workflow-action@0.11.0 |
|
236
|
with: |
|
237
|
access_token: ${{ github.token }} |
|
238
|
|
|
239
|
- name: Checkout |
|
240
|
uses: actions/checkout@v3 |
|
241
|
with: |
|
242
|
fetch-depth: 0 |
|
243
|
|
|
244
|
- name: Install Dependencies |
|
245
|
run: yarn |
|
246
|
|
|
247
|
- name: Build Dependencies |
|
248
|
run: yarn build |
|
249
|
|
|
250
|
- name: Install www/utils Dependencies |
|
251
|
run: yarn |
|
252
|
working-directory: www/utils |
|
253
|
|
|
254
|
- name: Build utils |
|
255
|
run: yarn build |
|
256
|
working-directory: www/utils |
|
257
|
|
|
258
|
# reviewdog throws an error when the number |
|
259
|
# of file changes in a PR is > 300, so |
|
260
|
# we retrieve the number of changed files |
|
261
|
# and only run the linter if the number is |
|
262
|
# less than 300. This is to avoid a PR hanging in |
|
263
|
# an error state |
|
264
|
- name: Get PR files number |
|
265
|
working-directory: www/utils/packages/scripts |
|
266
|
run: "yarn check:pr-files-count ${{ github.ref_name }}" |
|
267
|
id: pr-files |
|
268
|
|
|
269
|
- name: Get Directories to Scan |
|
270
|
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }} |
|
271
|
working-directory: www/vale |
|
272
|
run: ./get-files.sh ui/app |
|
273
|
id: directories |
|
274
|
|
|
275
|
- name: Vale Linter |
|
276
|
uses: errata-ai/vale-action@reviewdog |
|
277
|
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }} |
|
278
|
with: |
|
279
|
files: ${{ steps.directories.outputs.LIST }} |
|
280
|
fail_on_error: true |
|
281
|
vale_flags: "--minAlertLevel=error" |
|
282
|
reporter: github-pr-check |
|
283
|
token: ${{ github.token }} |
|
284
|
filter_mode: nofilter |
|
285
|
env: |
|
286
|
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }} |
|
287
|
|
|
288
|
vale-api: |
|
289
|
if: ${{ startsWith(github.head_ref, 'docs/') }} |
|
290
|
runs-on: ubuntu-latest |
|
291
|
steps: |
|
292
|
- name: Cancel Previous Runs |
|
293
|
uses: styfle/cancel-workflow-action@0.11.0 |
|
294
|
with: |
|
295
|
access_token: ${{ github.token }} |
|
296
|
|
|
297
|
- name: Checkout |
|
298
|
uses: actions/checkout@v3 |
|
299
|
with: |
|
300
|
fetch-depth: 0 |
|
301
|
|
|
302
|
- name: Install Dependencies |
|
303
|
run: yarn |
|
304
|
|
|
305
|
- name: Build Dependencies |
|
306
|
run: yarn build |
|
307
|
|
|
308
|
- name: Install www/utils Dependencies |
|
309
|
run: yarn |
|
310
|
working-directory: www/utils |
|
311
|
|
|
312
|
- name: Build utils |
|
313
|
run: yarn build |
|
314
|
working-directory: www/utils |
|
315
|
|
|
316
|
# reviewdog throws an error when the number |
|
317
|
# of file changes in a PR is > 300, so |
|
318
|
# we retrieve the number of changed files |
|
319
|
# and only run the linter if the number is |
|
320
|
# less than 300. This is to avoid a PR hanging in |
|
321
|
# an error state |
|
322
|
- name: Get PR files number |
|
323
|
working-directory: www/utils/packages/scripts |
|
324
|
run: "yarn check:pr-files-count ${{ github.ref_name }}" |
|
325
|
id: pr-files |
|
326
|
|
|
327
|
- name: Get Directories to Scan |
|
328
|
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }} |
|
329
|
working-directory: www/vale |
|
330
|
run: ./get-files.sh api-reference/markdown |
|
331
|
id: directories |
|
332
|
|
|
333
|
- name: Vale Linter |
|
334
|
uses: errata-ai/vale-action@reviewdog |
|
335
|
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }} |
|
336
|
with: |
|
337
|
files: ${{ steps.directories.outputs.LIST }} |
|
338
|
fail_on_error: true |
|
339
|
vale_flags: "--minAlertLevel=error" |
|
340
|
reporter: github-pr-check |
|
341
|
token: ${{ github.token }} |
|
342
|
filter_mode: diff_context |
|
343
|
env: |
|
344
|
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }} |
|
345
|
|
|
346
|
vale-cloud: |
|
347
|
if: ${{ startsWith(github.head_ref, 'docs/') }} |
|
348
|
runs-on: ubuntu-latest |
|
349
|
steps: |
|
350
|
- name: Cancel Previous Runs |
|
351
|
uses: styfle/cancel-workflow-action@0.11.0 |
|
352
|
with: |
|
353
|
access_token: ${{ github.token }} |
|
354
|
|
|
355
|
- name: Checkout |
|
356
|
uses: actions/checkout@v3 |
|
357
|
with: |
|
358
|
fetch-depth: 0 |
|
359
|
|
|
360
|
- name: Install Dependencies |
|
361
|
run: yarn |
|
362
|
|
|
363
|
- name: Build Dependencies |
|
364
|
run: yarn build |
|
365
|
|
|
366
|
- name: Install www/utils Dependencies |
|
367
|
run: yarn |
|
368
|
working-directory: www/utils |
|
369
|
|
|
370
|
- name: Build utils |
|
371
|
run: yarn build |
|
372
|
working-directory: www/utils |
|
373
|
|
|
374
|
# reviewdog throws an error when the number |
|
375
|
# of file changes in a PR is > 300, so |
|
376
|
# we retrieve the number of changed files |
|
377
|
# and only run the linter if the number is |
|
378
|
# less than 300. This is to avoid a PR hanging in |
|
379
|
# an error state |
|
380
|
- name: Get PR files number |
|
381
|
working-directory: www/utils/packages/scripts |
|
382
|
run: "yarn check:pr-files-count ${{ github.ref_name }}" |
|
383
|
id: pr-files |
|
384
|
|
|
385
|
- name: Get Directories to Scan |
|
386
|
working-directory: www/vale |
|
387
|
run: ./get-files.sh cloud/app |
|
388
|
id: directories |
|
389
|
|
|
390
|
- name: Vale Linter |
|
391
|
uses: errata-ai/vale-action@reviewdog |
|
392
|
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }} |
|
393
|
with: |
|
394
|
files: ${{ steps.directories.outputs.LIST }} |
|
395
|
fail_on_error: true |
|
396
|
vale_flags: "--minAlertLevel=error" |
|
397
|
reporter: github-pr-check |
|
398
|
token: ${{ github.token }} |
|
399
|
filter_mode: nofilter |
|
400
|
env: |
|
401
|
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }} |
|
402
|
|
|
403
|
content-eslint: |
|
404
|
if: ${{ startsWith(github.head_ref, 'docs/') }} |
|
405
|
runs-on: ubuntu-latest |
|
406
|
steps: |
|
407
|
- name: Cancel Previous Runs |
|
408
|
uses: styfle/cancel-workflow-action@0.11.0 |
|
409
|
with: |
|
410
|
access_token: ${{ github.token }} |
|
411
|
|
|
412
|
- name: Checkout |
|
413
|
uses: actions/checkout@v3 |
|
414
|
with: |
|
415
|
fetch-depth: 0 |
|
416
|
|
|
417
|
- name: Install Monorepo dependencies |
|
418
|
run: yarn install |
|
419
|
|
|
420
|
# www consumes the plugin via `link:../packages/eslint-plugin`, and its |
|
421
|
# `dist` isn't committed, so it must be built before the content lint. |
|
422
|
- name: Build ESLint plugin |
|
423
|
run: yarn workspace @medusajs/eslint-plugin build |
|
424
|
|
|
425
|
- name: Install dependencies |
|
426
|
working-directory: www |
|
427
|
run: yarn install |
|
428
|
|
|
429
|
- name: Run Eslint |
|
430
|
working-directory: www |
|
431
|
run: yarn lint:content |
|
432
|
|
|
433
|
code-docs-eslint: |
|
434
|
if: ${{ startsWith(github.head_ref, 'docs/') }} |
|
435
|
runs-on: ubuntu-latest |
|
436
|
steps: |
|
437
|
- name: Cancel Previous Runs |
|
438
|
uses: styfle/cancel-workflow-action@0.11.0 |
|
439
|
with: |
|
440
|
access_token: ${{ github.token }} |
|
441
|
|
|
442
|
- name: Checkout |
|
443
|
uses: actions/checkout@v3 |
|
444
|
with: |
|
445
|
fetch-depth: 0 |
|
446
|
|
|
447
|
- name: Install Monorepo dependencies |
|
448
|
run: yarn install |
|
449
|
|
|
450
|
- name: Install dependencies |
|
451
|
working-directory: www |
|
452
|
run: yarn install |
|
453
|
|
|
454
|
- name: Build packages |
|
455
|
working-directory: www |
|
456
|
run: yarn build:packages |
|
457
|
|
|
458
|
- name: Run Eslint |
|
459
|
working-directory: www |
|
460
|
run: yarn lint |