-
Notifications
You must be signed in to change notification settings - Fork 8
346 lines (325 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
name: Build
on:
pull_request:
types: [opened, synchronize, reopened, "ready_for_review"]
paths-ignore:
- "apps/examples/**"
- ".husky/**"
- ".idea/**"
- "stories/**"
- ".vscode/**"
- "README.md"
- "CONTRIBUTING.md"
- "CHANGELOG.md"
- "LICENSE"
push:
branches:
- main
concurrency:
group: CI-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
PERCY_TOKEN_PIE_DOCS: ${{ secrets.PERCY_TOKEN_PIE_DOCS }}
PERCY_TOKEN_PIE_ASSISTIVE_TEXT: ${{ secrets.PERCY_TOKEN_PIE_ASSISTIVE_TEXT }}
PERCY_TOKEN_PIE_BUTTON: ${{ secrets.PERCY_TOKEN_PIE_BUTTON }}
PERCY_TOKEN_PIE_CARD: ${{ secrets.PERCY_TOKEN_PIE_CARD }}
PERCY_TOKEN_PIE_CHECKBOX: ${{ secrets.PERCY_TOKEN_PIE_CHECKBOX }}
PERCY_TOKEN_PIE_CHECKBOX_GROUP: ${{ secrets.PERCY_TOKEN_PIE_CHECKBOX_GROUP }}
PERCY_TOKEN_PIE_CHIP: ${{ secrets.PERCY_TOKEN_PIE_CHIP }}
PERCY_TOKEN_PIE_COOKIE_BANNER: ${{ secrets.PERCY_TOKEN_PIE_COOKIE_BANNER }}
PERCY_TOKEN_PIE_DIVIDER: ${{ secrets.PERCY_TOKEN_PIE_DIVIDER }}
PERCY_TOKEN_PIE_FORM_LABEL: ${{ secrets.PERCY_TOKEN_PIE_FORM_LABEL }}
PERCY_TOKEN_PIE_ICON_BUTTON: ${{ secrets.PERCY_TOKEN_PIE_ICON_BUTTON }}
PERCY_TOKEN_PIE_ICONS_WEBC: ${{ secrets.PERCY_TOKEN_PIE_ICONS_WEBC }}
PERCY_TOKEN_PIE_LINK: ${{ secrets.PERCY_TOKEN_PIE_LINK }}
PERCY_TOKEN_PIE_MODAL: ${{ secrets.PERCY_TOKEN_PIE_MODAL }}
PERCY_TOKEN_PIE_NOTIFICATION: ${{ secrets.PERCY_TOKEN_PIE_NOTIFICATION }}
PERCY_TOKEN_PIE_SPINNER: ${{ secrets.PERCY_TOKEN_PIE_SPINNER }}
PERCY_TOKEN_PIE_SWITCH: ${{ secrets.PERCY_TOKEN_PIE_SWITCH }}
PERCY_TOKEN_PIE_TAG: ${{ secrets.PERCY_TOKEN_PIE_TAG }}
PERCY_TOKEN_PIE_TEXT_INPUT: ${{ secrets.PERCY_TOKEN_PIE_TEXT_INPUT }}
PERCY_TOKEN_PIE_TEXTAREA: ${{ secrets.PERCY_TOKEN_PIE_TEXTAREA }}
PERCY_TOKEN_PIE_TOAST: ${{ secrets.PERCY_TOKEN_PIE_TOAST }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
PERCY_DO_NOT_CAPTURE_RESPONSIVE_ASSETS: true
PERCY_PAGE_LOAD_TIMEOUT: 60000
PERCY_NETWORK_IDLE_WAIT_TIMEOUT: 60000
jobs:
dependency-changeset:
if: github.actor == 'renovate-bot' || github.actor == 'renovate[bot]' || contains(github.ref_name, 'snyk-fix-')
uses: the-guild-org/shared-config/.github/workflows/changesets-dependencies.yaml@main
secrets:
githubToken: ${{ secrets.GITHUB_TOKEN }}
check-change-type:
name: Get change type
runs-on: ubuntu-latest
outputs:
pie-docs-change: ${{ steps.docs-check.outputs.docs-change }}
web-components-change: ${{ steps.component-check.outputs.web-components-change }}
storybook-change: ${{ steps.storybook-check.outputs.storybook-change }}
steps:
# Checkout the Repo
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
# Setup Repo
- name: Setup Repo
uses: ./.github/actions/setup-repo
with:
node-version: 20
os: ubuntu-latest
- name: Verify if pie-docs has changes
id: docs-check
run: |
DOCS_CHANGE=$(npx -y turbo run build --filter='pie-docs[origin/main]' --dry=json | jq '.packages | length > 0')
echo "Change Detected: $DOCS_CHANGE"
echo "docs-change=$DOCS_CHANGE" >> $GITHUB_OUTPUT
- name: Verify if web components have changes
id: component-check
run: |
COMPONENT_CHANGE=$(npx -y turbo run build --filter='{./packages/components/*}...[origin/main]' --dry=json | jq '.packages | length > 0')
echo "Change Detected: $COMPONENT_CHANGE"
echo "web-components-change=$COMPONENT_CHANGE" >> $GITHUB_OUTPUT
- name: Verify if storybook has changes
id: storybook-check
run: |
STORYBOOK_CHANGE=$(npx -y turbo run build --filter='pie-storybook[origin/main]' --dry=json | jq '.packages | length > 0')
echo "Change Detected: $STORYBOOK_CHANGE"
echo "storybook-change=$STORYBOOK_CHANGE" >> $GITHUB_OUTPUT
lint-styles:
runs-on: ubuntu-latest
steps:
# Checkout the Repo
- name: Checkout
uses: actions/checkout@v3
# Setup Repo
- name: Setup Repo
uses: ./.github/actions/setup-repo
with:
node-version: 20
os: ubuntu-latest
# Lint Styles
- name: Lint Styles
uses: ./.github/actions/run-script
with:
script-name: "lint:style"
concurrency: 10
lint-js:
runs-on: ubuntu-latest
steps:
# Checkout the Repo
- name: Checkout
uses: actions/checkout@v3
# Setup Repo
- name: Setup Repo
uses: ./.github/actions/setup-repo
with:
node-version: 20
os: ubuntu-latest
# Lint JS
- name: Lint JavaScript
uses: ./.github/actions/run-script
with:
script-name: "lint:scripts"
build-windows-node-20:
uses: ./.github/workflows/install-build.yml
with:
os: windows-latest
node-version: 20
secrets: inherit
build-ubuntu-node-18:
uses: ./.github/workflows/install-build.yml
with:
os: ubuntu-latest
node-version: 18
secrets: inherit
build-ubuntu-node-20:
uses: ./.github/workflows/install-build.yml
needs: ['lint-js', 'lint-styles', 'check-change-type']
with:
os: ubuntu-latest
node-version: 20
secrets: inherit
unit-tests:
needs: 'build-ubuntu-node-20'
runs-on: ubuntu-latest
steps:
# Checkout the Repo
- name: Checkout
uses: actions/checkout@v3
# Setup Repo
- name: Setup Repo
uses: ./.github/actions/setup-repo
with:
node-version: 20
os: ubuntu-latest
# Restore Packages from Cache
- name: Build Packages
uses: ./.github/actions/run-script
with:
script-name: "build"
# Run Unit Tests
- name: Unit Tests
uses: ./.github/actions/run-script
with:
script-name: "test:ci"
deploy-storybook:
needs: unit-tests
if: (needs.check-change-type.outputs.web-components-change == 'true' || needs.check-change-type.outputs.storybook-change == 'true') || github.ref == 'refs/heads/main'
uses: ./.github/workflows/amplify-deploy.yml
with:
os: ubuntu-latest
node-version: 20
amplify-app-id: d17ja0ul7nrdy0
package-name: 'pie-storybook'
package-dist-directory: ./apps/pie-storybook/dist
bucket-name-preview: 'pie-storybook-preview'
bucket-name-main: 'pie-storybook'
secrets: inherit
# TODO: DSW-1151 - Move this into a reusable action so it's not duplicated
browser-tests-components:
needs: [build-ubuntu-node-20, deploy-storybook]
if: needs.check-change-type.outputs.web-components-change == 'true' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
# Checkout the Repo
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
# Setup Repo
- name: Setup Repo
uses: ./.github/actions/setup-repo
with:
node-version: 20
os: ubuntu-latest
# Setup Playwright
- name: Setup Playwright
uses: ./.github/actions/setup-playwright
# Run System / a11y Tests
- name: Run All System / Component / a11y Tests
uses: ./.github/actions/run-script
with:
script-name: "test:browsers:ci --filter='./packages/components/*'"
- uses: actions/upload-artifact@v3
if: always()
with:
name: browsers-report
path: browsers-report/
retention-days: 7
# Run Visual Tests
- name: Run All Visual Tests
uses: ./.github/actions/run-script
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
with:
script-name: "test:visual:ci --filter='{./packages/components/*}[HEAD^1]'"
concurrency: 1
- name: Run Changed Package Visual Tests
uses: ./.github/actions/run-script
if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false) && github.ref != 'refs/heads/main'
with:
script-name: "test:visual:ci --filter='{./packages/components/*}...[origin/main]'"
concurrency: 1
- uses: actions/upload-artifact@v3
if: always()
with:
name: visual-report
path: visual-report/
retention-days: 7
env:
STORYBOOK_AMPLIFY_ID: d17ja0ul7nrdy0
PR_NUMBER: ${{ github.event.number }}
deploy-docs:
needs: unit-tests
uses: ./.github/workflows/amplify-deploy.yml
if: needs.check-change-type.outputs.pie-docs-change == 'true' || github.ref == 'refs/heads/main'
with:
os: ubuntu-latest
node-version: 20
amplify-app-id: dvskdcoepjoyf
package-name: 'pie-docs'
package-dist-directory: ./apps/pie-docs/dist
bucket-name-preview: 'pie-docs-preview'
bucket-name-main: 'pie-docs'
secrets: inherit
browser-tests-docs:
needs: deploy-docs
runs-on: ubuntu-latest
steps:
# Checkout the Repo
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
# Setup Repo
- name: Setup Repo
uses: ./.github/actions/setup-repo
with:
node-version: 20
os: ubuntu-latest
# Setup Playwright
- name: Setup Playwright
uses: ./.github/actions/setup-playwright
# Run System / a11y Tests
- name: Run All System / a11y Tests
uses: ./.github/actions/run-script
with:
script-name: "test:browsers:ci --filter=pie-docs"
- uses: actions/upload-artifact@v3
if: always()
with:
name: browsers-report
path: browsers-report/
retention-days: 7
# Run Visual Tests
- name: Run All Visual Tests
uses: ./.github/actions/run-script
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
with:
script-name: "test:visual:ci --filter=pie-docs[HEAD^1]"
concurrency: 1
- name: Run Changed Package Visual Tests
uses: ./.github/actions/run-script
if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false) && github.ref != 'refs/heads/main'
with:
script-name: "test:visual:ci --filter=pie-docs"
concurrency: 1
- uses: actions/upload-artifact@v3
if: always()
with:
name: visual-report
path: visual-report/
retention-days: 7
env:
DOCS_AMPLIFY_ID: dvskdcoepjoyf
PR_NUMBER: ${{ github.event.number }}
release:
needs: [ 'unit-tests', 'lint-js']
if: github.event_name != 'pull_request'
uses: ./.github/workflows/changeset-release.yml
with:
os: ubuntu-latest
node-version: 20
secrets: inherit
check-all-jobs:
if: always()
needs:
- lint-styles
- lint-js
- build-ubuntu-node-18
- build-windows-node-20
- build-ubuntu-node-20
- unit-tests
- browser-tests-components
- deploy-docs
- deploy-storybook
- browser-tests-docs
runs-on: ubuntu-latest
steps:
- name: Verify if the required jobs succeeded
uses: re-actors/alls-green@release/v1
with:
# "allowed-skips" lists jobs that are optional but should not fail
allowed-skips: browser-tests-components, deploy-docs, deploy-storybook, browser-tests-docs
jobs: ${{ toJSON(needs) }}