-
Notifications
You must be signed in to change notification settings - Fork 191
/
config.yml
331 lines (314 loc) · 13.9 KB
/
config.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
version: 2.1
executors:
node:
docker:
- image: mcr.microsoft.com/playwright:v1.40.1
resource_class: large
environment:
NODE_ENV: development
parameters:
current_golden_images_hash:
type: string
default: 4efe2e33f04f30cd4965e4d8e252edc0f3b6cf76
wireit_cache_name:
type: string
default: wireit
commands:
downstream:
steps:
- checkout
- restore_cache:
keys:
- v3c-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}
- restore_cache:
keys:
- v3b-<< pipeline.parameters.wireit_cache_name >>-{{ arch }}-{{ checksum "package.json" }}-
- run:
name: Installing Dependencies
command: yarn --frozen-lockfile --cache-folder ~/.cache/yarn
- save_cache:
paths:
- ~/.cache/yarn
- ~/.cache/ms-playwright
key: v3c-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}
- save_cache:
paths:
- .wireit
key: v3b-wireit-{{ arch }}-{{ checksum "package.json" }}-{{ epoch }}
- attach_workspace:
at: /
run-regressions:
parameters:
regression_theme:
type: string
regression_color:
type: string
regression_scale:
type: string
regression_dir:
type: string
steps:
- restore_cache:
name: Restore Golden Images Cache
keys:
- v2-golden-images-<< pipeline.parameters.current_golden_images_hash >>-<< parameters.regression_theme >>-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.regression_dir >>-
- v2-golden-images-<< pipeline.parameters.current_golden_images_hash >>-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.regression_dir >>-
- v2-golden-images-main-<< parameters.regression_theme >>-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.regression_dir >>-
- v2-golden-images-main-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.regression_dir >>-
- run:
name: Count baseline images
command: find test/visual/screenshots-baseline -type f | wc -l > count_start.txt
- run:
when: always
name: VRT Run
command: |
yarn test:ci --config web-test-runner.config.vrt.js --group vrt-<< parameters.regression_theme >>-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.regression_dir >>
# store results and artifacts before rearranging things for the new cache.
- store_test_results:
path: /root/project/results/
- run:
when: on_success
name: Count current images
command: find test/visual/screenshots-actual/updates -type f | wc -l > count_end.txt
# prevent removing regression tests without requiring a new golden cache
- run:
when: on_success
name: Fail if there are a different number of images...
command: |
echo $(cat count_start.txt)
echo $(cat count_end.txt)
if [[ $(cat count_start.txt) -eq $(cat count_end.txt) ]]; then exit 0; else exit 1; fi
# build diff review site
- run:
when: on_fail
name: Create review site
command: |
branch=$(git symbolic-ref --short HEAD)
node test/visual/review.js --branch=$branch --commit=<< pipeline.git.revision >> --theme="<< parameters.regression_theme >> << parameters.regression_color >> << parameters.regression_scale >> << parameters.regression_dir >>"
yarn rollup -c test/visual/rollup.config.js
- run:
when: on_fail
name: Publish review site
command: |
cp projects/documentation/content/favicon.ico test/visual
branch=$(git symbolic-ref --short HEAD)
hash=$(echo -n $branch-<< parameters.regression_theme >>-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.regression_dir >> | md5sum | cut -c 1-32)
echo hash
yarn netlify deploy --alias=$hash --dir=test/visual
# move "updated" screenshot into the baseline directory before making the new cache
- run:
when: always
command: |
rm -rf test/visual/screenshots-baseline
cp -R test/visual/screenshots-actual/updates test/visual/screenshots-baseline
- save_cache:
when: always
name: Build Golden Images Revision Cache
paths:
- test/visual/screenshots-baseline
key: v2-golden-images-{{ .Revision }}-<< parameters.regression_theme >>-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.regression_dir >>-{{ epoch }}
- save_cache:
name: Build Golden Images Branch Cache
paths:
- test/visual/screenshots-baseline
key: v2-golden-images-{{ .Branch }}-<< parameters.regression_theme >>-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.regression_dir >>-{{ epoch }}
jobs:
commitlint:
executor: node
steps:
- checkout
- restore_cache:
keys:
- v3b-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}
- run:
name: Installing Dependencies
command: yarn --ignore-scripts --frozen-lockfile --cache-folder ~/.cache/yarn
- save_cache:
paths:
- ~/.cache/yarn
- .wireit
key: v3b-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}
- run:
name: Define environment variable with lastest commit's message
command: |
echo 'export COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s")' >> $BASH_ENV
source $BASH_ENV
- run:
name: Lint commit message
command: echo "$COMMIT_MESSAGE" | npx commitlint --config commitlint.config.cjs
test-chromium:
executor: node
steps:
- downstream
- run:
name: Run tests
command: yarn test:ci --config web-test-runner.config.ci-chromium.js --group unit --coverage
- store_test_results:
path: /root/project/results/
- store_artifacts:
path: coverage
test-firefox:
executor: node
parallelism: 5
steps:
- downstream
- run:
name: Run tests
command: |
TEST=$(circleci tests glob packages/*/test/*.test.js | circleci tests split --split-by=timings)
yarn test:start --files $TEST --config web-test-runner.config.ci-firefox.js --group unit-ci
- store_test_results:
path: /root/project/results/
test-webkit:
executor: node
parallelism: 5
steps:
- downstream
- run:
name: Run tests
command: |
TEST=$(circleci tests glob packages/*/test/*.test.js | circleci tests split --split-by=timings)
yarn test:start --files $TEST --config web-test-runner.config.ci-webkit.js --group unit-ci
- store_test_results:
path: /root/project/results/
lint:
executor: node
steps:
- downstream
- run:
name: Lint
command: yarn lint
- run: yarn analyze
- run:
name: Are there changes?
command: git diff-files --exit-code
preview-docs:
executor: node
steps:
- downstream
- run:
name: Generate Docs
command: yarn docs:preview
- run: echo '/* /index.html 200' > projects/documentation/dist/_redirects
- run: |
branch=$(git symbolic-ref --short HEAD)
branch=$(npx slugify-cli $branch)
yarn netlify deploy --alias=$branch
hcm-visual:
executor: node
steps:
- downstream
- restore_cache:
name: Restore Golden Images Cache
keys:
- v2-golden-images-<< pipeline.parameters.current_golden_images_hash >>-hcm-
- v2-golden-images-main-hcm-
- v2-golden-images-main-classic-lightest-medium-ltr-
- run:
name: Count baseline images
command: find test/visual/screenshots-baseline -type f | wc -l > count_start.txt
- run:
when: always
name: VRT Run
command: |
yarn test:ci --config web-test-runner.config.vrt.js --group vrt-hcm
# store results and artifacts before rearranging things for the new cache.
- store_test_results:
path: /root/project/results/
- run:
when: on_success
name: Count current images
command: find test/visual/screenshots-actual/updates -type f | wc -l > count_end.txt
# prevent removing regression tests without requiring a new golden cache
- run:
when: on_success
name: Fail if there are a different number of images...
command: |
echo $(cat count_start.txt)
echo $(cat count_end.txt)
if [[ $(cat count_start.txt) -eq $(cat count_end.txt) ]]; then exit 0; else exit 1; fi
# build diff review site
- run:
when: on_fail
name: Create review site
command: |
branch=$(git symbolic-ref --short HEAD)
node test/visual/review.js --branch=$branch --commit=<< pipeline.git.revision >> --theme="hcm"
yarn rollup -c test/visual/rollup.config.js
- run:
when: on_fail
name: Publish review site
command: |
cp projects/documentation/content/favicon.ico test/visual
branch=$(git symbolic-ref --short HEAD)
hash=$(echo -n $branch-hcm | md5sum | cut -c 1-32)
echo hash
yarn netlify deploy --alias=$hash --dir=test/visual
# move "updated" screenshot into the baseline directory before making the new cache
- run:
when: always
command: |
rm -rf test/visual/screenshots-baseline
cp -R test/visual/screenshots-actual/updates test/visual/screenshots-baseline
- save_cache:
when: always
name: Build Golden Images Revision Cache
paths:
- test/visual/screenshots-baseline
key: v2-golden-images-{{ .Revision }}-hcm-{{ epoch }}
- save_cache:
name: Build Golden Images Branch Cache
paths:
- test/visual/screenshots-baseline
key: v2-golden-images-{{ .Branch }}-hcm-{{ epoch }}
visual:
executor: node
parameters:
theme:
type: string
color:
type: string
scale:
type: string
dir:
type: string
steps:
- downstream
- run-regressions:
regression_theme: << parameters.theme >>
regression_color: << parameters.color >>
regression_scale: << parameters.scale >>
regression_dir: << parameters.dir >>
workflows:
version: 2
commitlint:
jobs:
- commitlint
build:
jobs:
- test-chromium
- test-firefox
- test-webkit
- lint
- hcm-visual:
filters:
branches:
# Forked pull requests have CIRCLE_BRANCH set to pull/XXX
ignore: /pull\/[0-9]+/
- preview-docs:
filters:
branches:
# Forked pull requests have CIRCLE_BRANCH set to pull/XXX
ignore: /pull\/[0-9]+/
- visual:
name: << matrix.theme >>-<< matrix.color >>-<< matrix.scale >>-<< matrix.dir >>
matrix:
parameters:
theme: [classic, express]
color: [lightest, light, dark, darkest]
scale: [medium, large]
dir: [ltr, rtl]
filters:
branches:
# Forked pull requests have CIRCLE_BRANCH set to pull/XXX
ignore: /pull\/[0-9]+/