forked from aws-amplify/amplify-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
276 lines (272 loc) · 8.71 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
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
machine:
environment:
PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"
defaults: &defaults
docker:
- image: cypress/base:10
environment:
## this enables colors in the output
TERM: xterm
jobs:
build:
<<: *defaults
working_directory: ~/amplify-js
resource_class: large
steps:
- checkout
- run: yarn config set workspaces-experimental true
- run: yarn
- run: yarn run bootstrap
- run: yarn run build
- run: yarn run coverage
- save_cache:
key: amplify-ssh-deps-{{ .Branch }}
paths:
- ~/.ssh
- persist_to_workspace:
root: /root
paths: amplify-js
unit_test:
<<: *defaults
working_directory: ~/amplify-js
steps:
- attach_workspace:
at: /root
- run:
name: "Run Amplify JS unit tests"
command: |
yarn run test --scope @aws-amplify/auth
yarn run test --scope @aws-amplify/api
yarn run test --scope @aws-amplify/analytics
yarn run test --scope @aws-amplify/cache
yarn run test --scope @aws-amplify/core
yarn run test --scope @aws-amplify/interactions
yarn run test --scope @aws-amplify/pubsub
yarn run test --scope @aws-amplify/predictions
yarn run test --scope @aws-amplify/storage
yarn run test --scope @aws-amplify/xr
yarn run test --scope aws-amplify-react
yarn run test --scope aws-amplify-angular
yarn run test --scope aws-amplify-vue
integration_test_setup:
<<: *defaults
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_predictions:
<<: *defaults
working_directory: ~/
steps:
- attach_workspace:
at: /root
- restore_cache:
key: amplify-js-{{ .Branch }}-{{ checksum "amplify-js-samples-staging/yarn.lock" }}
- run:
name: "Link aws-amplify"
command: |
cd amplify-js/packages/aws-amplify
yarn link
- run:
name: "Link predictions"
command: |
cd amplify-js/packages/predictions
yarn link
- run:
name: "Install Predictions React sample"
command: |
cd amplify-js-samples-staging/samples/react/predictions/multi-user-translation
yarn
yarn link aws-amplify
yarn link @aws-amplify/predictions
- run:
name: "Start Predictions React Sample server in background"
command: |
cd amplify-js-samples-staging/samples/react/predictions/multi-user-translation
yarn start
background: true
- run:
name: "Run cypress tests for Predictions React Sample"
command: |
cd amplify-js-samples-staging
yarn cypress:react --spec "cypress/integration/predictions/multiuser-translation.spec.js"
- store_artifacts:
path: amplify-js-samples-staging/cypress/videos
- store_artifacts:
path: amplify-js-samples-staging/cypress/screenshots
integration_test_react:
<<: *defaults
working_directory: ~/
steps:
- attach_workspace:
at: /root
- restore_cache:
key: amplify-js-{{ .Branch }}-{{ checksum "amplify-js-samples-staging/yarn.lock" }}
- run:
name: "Install React Authenticator sample"
command: |
cd amplify-js-samples-staging/samples/react/auth/with-authenticator
yarn
- run:
name: "Link aws-amplify"
command: |
cd amplify-js/packages/aws-amplify
yarn link
- run:
name: "Link aws-amplify-react"
command: |
cd amplify-js/packages/aws-amplify-react
yarn link
- run:
name: "Install React Authenticator sample"
command: |
cd amplify-js-samples-staging/samples/react/auth/with-authenticator
yarn
yarn link aws-amplify
yarn link aws-amplify-react
- run:
name: "Start React Authenticator Sample server in background"
command: |
cd amplify-js-samples-staging/samples/react/auth/with-authenticator
yarn start
background: true
- run:
name: "Run cypress tests for React Authenticator Sample"
command: |
cd amplify-js-samples-staging
yarn cypress:react --spec "cypress/integration/auth/authenticator.spec.js"
- store_artifacts:
path: amplify-js-samples-staging/cypress/videos
- store_artifacts:
path: amplify-js-samples-staging/cypress/screenshots
integration_test_vue:
<<: *defaults
working_directory: ~/
steps:
- attach_workspace:
at: /root
- restore_cache:
key: amplify-js-{{ .Branch }}-{{ checksum "amplify-js-samples-staging/yarn.lock" }}
- run:
name: "Install Vue Authenticator sample"
command: |
cd amplify-js-samples-staging/samples/vue/auth/amplify-authenticator
yarn
- run:
name: "Link aws-amplify"
command: |
cd amplify-js/packages/aws-amplify
yarn link
- run:
name: "Link aws-amplify-vue"
command: |
cd amplify-js/packages/aws-amplify-vue
yarn link
- run:
name: "Start Vue Authenticator Sample server in background"
command: |
cd amplify-js-samples-staging/samples/vue/auth/amplify-authenticator
yarn start
background: true
- run:
name: "Run cypress tests for Vue Authenticator Sample"
command: |
cd amplify-js-samples-staging
yarn cypress:vue --spec "cypress/integration/auth/authenticator.spec.js"
- store_artifacts:
path: amplify-js-samples-staging/cypress/videos
- store_artifacts:
path: amplify-js-samples-staging/cypress/screenshots
deploy:
<<: *defaults
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
workflows:
version: 2
build_test_deploy:
jobs:
- build
- unit_test:
requires:
- build
- integration_test_setup:
filters:
branches:
only:
- release
- master
requires:
- build
- integ_react_predictions:
filters:
branches:
only:
- release
- master
requires:
- integration_test_setup
- integration_test_react:
filters:
branches:
only:
- release
- master
requires:
- integration_test_setup
- integration_test_vue:
filters:
branches:
only:
- release
- master
requires:
- integration_test_setup
- deploy:
filters:
branches:
only:
- release
- master
- beta
requires:
- unit_test
- integration_test_react
- integration_test_vue