forked from aws-amplify/amplify-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
536 lines (506 loc) · 15.4 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
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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# Javascript Node CircleCI 2.1 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2.1
executors:
build-executor:
docker:
- image: cypress/base:12.16.1
resource_class: large
working_directory: ~/amplify-js
js-test-executor:
docker:
- image: cypress/base:12.16.1
- image: verdaccio/verdaccio
resource_class: large
ios-executor:
macos:
xcode: 11.4.1
test_env_vars: &test_env_vars
environment:
NPM_REGISTRY: http://localhost:4873/
NPM_USER: circleci
NPM_PASS: circleci
NPM_EMAIL: [email protected]
commands:
restore_pods:
steps:
- restore_cache:
keys:
- v1-storage-app-pods-{{ checksum "ios/Podfile.lock" }}
- v1-storage-app-pods-
save_pods:
steps:
- save_cache:
key: v1-storage-app-pods-{{ checksum "ios/Podfile.lock" }}
paths:
- ios/Pods
publish_to_verdaccio:
steps:
- run:
name: 'Set registry to Verdaccio and verify'
# If the registry isn't set correctly, fail the job
command: |
yarn config set registry $NPM_REGISTRY
npm set registry $NPM_REGISTRY
CURRENT_REGISTRY=$(yarn config get registry)
if [ "$CURRENT_REGISTRY" = "$NPM_REGISTRY" ]; then
exit 0
fi
exit 1
- run:
# npm-cli-login allows us to log in to verdaccio in a noninteractive way
# logs in with NPM_USER, NPM_PASS, and NPM_EMAIL env vars
name: 'Install and run npm-cli-login'
command: |
npm i -g npm-cli-adduser
npm-cli-adduser
sleep 1
- run:
name: 'Publish to Verdaccio'
command: |
cd ~/amplify-js
git config --global user.email $NPM_EMAIL
git config --global user.name $NPM_USER
git status
git --no-pager diff
./node_modules/lerna/cli.js publish --no-push --canary minor --dist-tag=unstable --preid=unstable --exact --force-publish --yes
prepare_test_env:
steps:
- attach_workspace:
at: /root
- restore_cache:
key: amplify-js-{{ .Branch }}-{{ checksum "~/amplify-js-samples-staging/yarn.lock" }}
- publish_to_verdaccio
prepare_ui_test_env:
steps:
- attach_workspace:
at: /root
- restore_cache:
key: amplify-js-ui
- publish_to_verdaccio
integ_test_js:
parameters:
test_name:
type: string
framework:
type: string
spec:
type: string
steps:
- run:
name: 'Install << parameters.test_name >> sample'
command: |
echo "Current NPM registry: " $(yarn config get registry)
yarn
- run:
name: 'Start << parameters.test_name >> Sample server in background'
command: yarn start
background: true
- run:
name: 'Run cypress tests for << parameters.test_name >> Sample'
command: |
cd ~/amplify-js-samples-staging
yarn cypress:<< parameters.framework >> --spec "cypress/integration/<< parameters.spec >>"
- store_artifacts:
path: ~/amplify-js-samples-staging/cypress/videos
- store_artifacts:
path: ~/amplify-js-samples-staging/cypress/screenshots
integ_test_ui:
parameters:
test_name:
type: string
framework:
type: string
category:
type: string
sample_name:
type: string
spec:
# optional - the script will use sample_name by default
type: string
default: ''
steps:
- run:
name: 'Install << parameters.test_name >> sample'
command: |
cd << parameters.framework >>/<< parameters.category >>/<< parameters.sample_name >>
echo "Current NPM registry: " $(yarn config get registry)
yarn
- run:
name: 'Run << parameters.test_name >> UI tests'
command: |
cd ~/amplify-js-samples-staging-ui
yarn ci:test << parameters.framework >> << parameters.category >> << parameters.sample_name >> << parameters.spec >>
- store_artifacts:
path: ~/amplify-js-samples-staging-ui/cypress/videos
- store_artifacts:
path: ~/amplify-js-samples-staging-ui/cypress/screenshots
ios_install_verdaccio:
steps:
- run:
name: Install Verdaccio
command: npm i -g verdaccio
- run:
name: Run Verdaccio
background: true
command: |
cd ~
verdaccio
integ_test_rn:
steps:
- attach_workspace:
at: ~/
- ios_install_verdaccio
- publish_to_verdaccio
- run:
name: Yarn Install
command: |
echo "Current NPM registry: " $(yarn config get registry)
yarn install --frozen-lockfile --non-interactive
- restore_pods
- run:
name: Install CocoaPods
command: |
cd ios
pod install
- save_pods
- run:
background: true
command: xcrun simctl boot "iPhone 11" || true
name: Start iOS simulator (background)
- run:
background: true
command: yarn start
name: Start Metro Packager (background)
- run:
name: Configure Detox
environment:
HOMEBREW_NO_AUTO_UPDATE: '1'
command: |
brew tap wix/brew
brew install applesimutils
yarn global add detox-cli
- run:
name: Detox Build
command: detox build -c ios.sim.debug
- run:
environment:
JEST_JUNIT_OUTPUT_DIR: 'reports/junit'
JEST_JUNIT_OUTPUT_NAME: 'detox-test-results.xml'
name: Detox Test
command: detox test -c ios.sim.debug -u
- store_test_results:
path: reports/junit
- store_artifacts:
path: reports/junit
jobs:
build:
executor: build-executor
steps:
- checkout
- run: yarn config set workspaces-experimental true
- run: yarn --frozen-lockfile
- run: yarn run bootstrap
- run: yarn run build
- save_cache:
key: amplify-ssh-deps-{{ .Branch }}
paths:
- ~/.ssh
- persist_to_workspace:
root: /root
paths:
- amplify-js
unit_test:
executor: build-executor
steps:
- attach_workspace:
at: /root
- run:
name: 'Run Amplify JS unit tests'
command: |
yarn run test
yarn run coverage
integ_setup:
executor: build-executor
working_directory: ~/
steps:
- run:
name: 'Clone Amplify JS Samples repo, install cypress, install react samples authenticator and link amplify packages'
command: |
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
echo $SSH_HOST_PUBLIC_KEY >> ~/.ssh/known_hosts
git clone $AMPLIFY_JS_SAMPLES_STAGING_URL
cd amplify-js-samples-staging
yarn
- save_cache:
key: amplify-js-{{ .Branch }}-{{ checksum "amplify-js-samples-staging/yarn.lock" }}
paths:
- ~/.cache ## cache both yarn and Cypress
- persist_to_workspace:
root: /root
paths:
- amplify-js-samples-staging
integ_react_auth:
executor: js-test-executor
<<: *test_env_vars
working_directory: ~/amplify-js-samples-staging/samples/react/auth/with-authenticator
steps:
- prepare_test_env
- integ_test_js:
test_name: 'React Authenticator'
framework: react
spec: auth/authenticator.spec.js
integ_angular_auth:
executor: js-test-executor
<<: *test_env_vars
working_directory: ~/amplify-js-samples-staging/samples/angular/auth/amplify-authenticator
steps:
- prepare_test_env
- integ_test_js:
test_name: 'Angular Authenticator'
framework: angular
spec: auth/authenticator.spec.js
integ_vue_auth:
executor: js-test-executor
<<: *test_env_vars
working_directory: ~/amplify-js-samples-staging/samples/vue/auth/amplify-authenticator
steps:
- prepare_test_env
- integ_test_js:
test_name: 'Vue Authenticator'
framework: vue
spec: auth/authenticator.spec.js
integ_react_predictions:
executor: js-test-executor
<<: *test_env_vars
working_directory: ~/amplify-js-samples-staging/samples/react/predictions/multi-user-translation
steps:
- prepare_test_env
- integ_test_js:
test_name: 'React Predictions'
framework: react
spec: predictions/multiuser-translation.spec.js
integ_setup_ui:
executor: build-executor
working_directory: ~/
steps:
- run:
name: 'Clone Amplify JS Samples repo, install cypress, install react samples authenticator and link amplify packages'
command: |
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
echo $SSH_HOST_PUBLIC_KEY >> ~/.ssh/known_hosts
git clone $AMPLIFY_JS_SAMPLES_STAGING_URL amplify-js-samples-staging-ui
cd amplify-js-samples-staging-ui
git checkout ui-components/master
yarn
- save_cache:
key: amplify-js-ui
paths:
- ~/.cache ## cache both yarn and Cypress
- persist_to_workspace:
root: /root
paths:
- amplify-js-samples-staging-ui
integ_react_auth_ui:
executor: js-test-executor
<<: *test_env_vars
working_directory: ~/amplify-js-samples-staging-ui/samples
steps:
- prepare_ui_test_env
- integ_test_ui:
test_name: 'React Authenticator'
framework: react
category: auth
sample_name: amplify-authenticator
- integ_test_ui:
test_name: 'React Typescript Authenticator'
framework: react
category: auth
sample_name: typescript-amplify-authenticator
spec: amplify-authenticator
- integ_test_ui:
test_name: 'React Custom Authenticator'
framework: react
category: auth
sample_name: amplify-authenticator
spec: custom-authenticator
- integ_test_ui:
test_name: 'React Custom Authenticator'
framework: react
category: auth
sample_name: with-authenticator
spec: amplify-authenticator
integ_angular_auth_ui:
executor: js-test-executor
<<: *test_env_vars
working_directory: ~/amplify-js-samples-staging-ui/samples
steps:
- prepare_ui_test_env
- integ_test_ui:
test_name: 'Angular Authenticator'
framework: angular
category: auth
sample_name: amplify-authenticator
- integ_test_ui:
test_name: 'Angular Custom Authenticator'
framework: angular
category: auth
sample_name: amplify-authenticator
spec: custom-authenticator
integ_vue_auth_ui:
executor: js-test-executor
<<: *test_env_vars
working_directory: ~/amplify-js-samples-staging-ui/samples
steps:
- prepare_ui_test_env
- integ_test_ui:
test_name: 'Vue Authenticator'
framework: vue
category: auth
sample_name: amplify-authenticator
- integ_test_ui:
test_name: 'Vue Custom Authenticator'
framework: vue
category: auth
sample_name: amplify-authenticator
spec: custom-authenticator
integ_rn_ios_storage:
executor: ios-executor
<<: *test_env_vars
working_directory: ~/amplify-js-samples-staging/samples/react-native/storage/StorageApp
steps:
- integ_test_rn
deploy:
executor: build-executor
working_directory: ~/amplify-js
steps:
- attach_workspace:
at: /root
- restore_cache:
keys:
- amplify-ssh-deps-{{ .Branch }}
- amplify-ssh-deps
- run:
name: 'Publish to Amplify Package'
command: |
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm whoami
git config --global user.email $GITHUB_EMAIL
git config --global user.name $GITHUB_USER
git status
git --no-pager diff
yarn run publish:$CIRCLE_BRANCH
else
echo "Skipping deploy."
fi
post_release:
executor: build-executor
steps:
- attach_workspace:
at: /root
- restore_cache:
keys:
- amplify-ssh-deps-{{ .Branch }}
- amplify-ssh-deps
- run:
name: 'Post-release steps'
command: |
git config --global user.email $GITHUB_EMAIL
git config --global user.name $GITHUB_USER
git pull origin release
yarn && yarn build
git add ./packages/core/src/Platform/version.ts
git commit -m "chore(release): update version.ts [ci skip]"
git push origin release
git push origin release:master
releasable_branches: &releasable_branches
branches:
only:
- release
- master
- ui-components/master
- 1.0-stable
workflows:
build_test_deploy:
jobs:
- build
- integ_setup:
filters:
<<: *releasable_branches
- integ_setup_ui:
filters:
<<: *releasable_branches
- unit_test:
requires:
- build
- integ_react_auth:
requires:
- integ_setup
- build
filters:
<<: *releasable_branches
- integ_angular_auth:
requires:
- integ_setup
- build
filters:
<<: *releasable_branches
- integ_vue_auth:
requires:
- integ_setup
- build
filters:
<<: *releasable_branches
- integ_react_predictions:
requires:
- integ_setup
- build
filters:
<<: *releasable_branches
- integ_rn_ios_storage:
requires:
- integ_setup
- build
filters:
<<: *releasable_branches
- integ_react_auth_ui:
requires:
- integ_setup_ui
- build
filters:
<<: *releasable_branches
- integ_angular_auth_ui:
requires:
- integ_setup_ui
- build
filters:
<<: *releasable_branches
- integ_vue_auth_ui:
requires:
- integ_setup_ui
- build
filters:
<<: *releasable_branches
- deploy:
filters:
<<: *releasable_branches
requires:
- unit_test
- integ_react_predictions
- integ_react_auth
- integ_angular_auth
- integ_vue_auth
- integ_react_auth_ui
- integ_angular_auth_ui
- integ_vue_auth_ui
- integ_rn_ios_storage
- post_release:
filters:
branches:
only:
- release
requires:
- deploy