-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.yml
More file actions
284 lines (268 loc) · 8.73 KB
/
config.yml
File metadata and controls
284 lines (268 loc) · 8.73 KB
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
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1
orbs:
gcp-cli: circleci/gcp-cli@2.4.0
executors:
node:
docker:
- image: circleci/node:14.17.0-browsers
working_directory: ~/embeddable-explorer
commands:
setup-sandbox-gcs-creds:
steps:
- checkout
- run:
name: Setup GCloud Creds
command: |
echo "$GCLOUD_SERVICE_KEY_SANDBOX" | base64 --ignore-garbage -d > /tmp/google-service-account-key-sandbox.json
[ ! -z "$GCLOUD_SERVICE_KEY_SANDBOX" ] && gcloud auth activate-service-account --key-file=/tmp/google-service-account-key-sandbox.json || exit 0
- restore_cache:
keys:
- v0-dependencies-
setup-explorer-gcs-creds:
steps:
- checkout
- run:
name: Setup GCloud Creds
command: |
echo "$GCLOUD_SERVICE_KEY_EXPLORER" | base64 --ignore-garbage -d > /tmp/google-service-account-key-explorer.json
[ ! -z "$GCLOUD_SERVICE_KEY_EXPLORER" ] && gcloud auth activate-service-account --key-file=/tmp/google-service-account-key-explorer.json || exit 0
- restore_cache:
keys:
- v0-dependencies-
npm-install:
steps:
- run:
name: Installs npm version from package.jsons engines field
command: |
VOLTA_NPM_VERSION=`node -e "console.log(require('./package.json').volta.npm)"`;
sudo npm i -g npm@$VOLTA_NPM_VERSION;
npm -v;
- restore_cache:
name: Restore npm cache
keys:
- npm-cache--{{ checksum "package-lock.json" }}--{{ checksum ".circleci/config.yml" }}
- run:
name: Install npm dependencies with `npm ci`
command: npm ci --prefer-offline
- save_cache:
name: Save npm caches
key: npm-cache--{{ checksum "package-lock.json" }}--{{ checksum ".circleci/config.yml" }}
paths:
- ~/.npm
jobs:
bundlewatch:
executor: node
steps:
- checkout
- attach_workspace:
at: ~/embeddable-explorer
- run:
name: Report bundle size
command: npx bundlewatch
environment:
CI_BRANCH_BASE: main
eslint:
executor: node
steps:
- checkout
- npm-install
- run:
name: Ensure output directory exists
command: mkdir -p /tmp/test-reports/eslint
- restore_cache:
name: Restore eslint cache
keys:
- raw-eslint-cache--{{ checksum ".eslintrc.js" }}--{{ .Branch }}--{{ checksum ".circleci/config.yml" }}
- raw-eslint-cache--{{ checksum ".eslintrc.js" }}--main--{{ checksum ".circleci/config.yml" }}
- run:
name: Linter
command: npm run lint -- --quiet --format junit --output-file /tmp/test-reports/eslint/results.xml
- save_cache:
name: Save eslint cache
key: raw-eslint-cache--{{ checksum ".eslintrc.js" }}--{{ .Branch }}--{{ checksum ".circleci/config.yml" }}--{{ epoch }}
paths:
- .eslintcache
- store_test_results:
path: /tmp/test-reports
prettier:
executor: node
steps:
- checkout
- npm-install
- run:
name: Prettier
command: npm run prettier:check
typescript:
executor: node
steps:
- checkout
- npm-install
- run:
name: TypeScript
command: npm run build -w @apollo/explorer-helpers && npm run build
build-latest-umd-explorer:
executor: node
steps:
- checkout
- npm-install
- run:
name: Build
command: '[ -d build ] || cd packages/explorer && PUBLIC_URL=https://embeddable-explorer.cdn.apollographql.com/_latest npm run build:umd -- --no-progress'
environment:
BUILD_TO_CDN: 'true'
- persist_to_workspace:
root: ~/embeddable-explorer
paths:
- packages/explorer/dist
build-versioned-umd-explorer:
executor: node
steps:
- checkout
- npm-install
- run:
name: Build
command: '[ -d build ] || cd packages/explorer && PUBLIC_URL=https://embeddable-explorer.cdn.apollographql.com/$CIRCLE_SHA1 npm run build:umd -- --no-progress'
environment:
BUILD_TO_CDN: 'true'
- persist_to_workspace:
root: ~/embeddable-explorer
paths:
- packages/explorer/dist
cdn-upload-latest-explorer:
executor: gcp-cli/google
steps:
- setup-explorer-gcs-creds
- gcp-cli/install
- checkout
- attach_workspace:
at: ~/embeddable-explorer
- run:
name: Copy public folder to dist
command: |
cp -R public ~/embeddable-explorer/packages/explorer/dist/public
- run:
name: Upload build artifacts to CDN
command: |
gsutil -m rsync -r ~/embeddable-explorer/packages/explorer/dist gs://embeddable-explorer/_latest
cdn-upload-versioned-explorer:
executor: gcp-cli/google
steps:
- setup-explorer-gcs-creds
- gcp-cli/install
- checkout
- attach_workspace:
at: ~/embeddable-explorer
- run:
name: Upload build artifacts to CDN
command: |
gsutil -m rsync -r ~/embeddable-explorer/packages/explorer/dist gs://embeddable-explorer/$CIRCLE_SHA1
build-latest-umd-sandbox:
executor: node
steps:
- checkout
- npm-install
- run:
name: Build
command: '([ -d build ] || cd packages/sandbox && PUBLIC_URL=https://embeddable-sandbox.cdn.apollographql.com/_latest npm run build:umd -- --no-progress)'
environment:
BUILD_TO_CDN: 'true'
- persist_to_workspace:
root: ~/embeddable-explorer
paths:
- packages/sandbox/dist
build-versioned-umd-sandbox:
executor: node
steps:
- checkout
- npm-install
- run:
name: Build
command: '[ -d build ] || cd packages/sandbox && PUBLIC_URL=https://embeddable-sandbox.cdn.apollographql.com/$CIRCLE_SHA1 npm run build:umd -- --no-progress'
environment:
BUILD_TO_CDN: 'true'
- persist_to_workspace:
root: ~/embeddable-explorer
paths:
- packages/sandbox/dist
cdn-upload-latest-sandbox:
executor: gcp-cli/google
steps:
- setup-sandbox-gcs-creds
- gcp-cli/install
- checkout
- attach_workspace:
at: ~/embeddable-explorer
- run:
name: Copy public folder to dist
command: |
cp -R public ~/embeddable-explorer/packages/sandbox/dist/public
- run:
name: Upload build artifacts to CDN
command: |
gsutil -m rsync -r ~/embeddable-explorer/packages/sandbox/dist gs://embeddable-sandbox/_latest
cdn-upload-versioned-sandbox:
executor: gcp-cli/google
steps:
- setup-sandbox-gcs-creds
- gcp-cli/install
- checkout
- attach_workspace:
at: ~/embeddable-explorer
- run:
name: Upload build artifacts to CDN
command: |
gsutil -m rsync -r ~/embeddable-explorer/packages/sandbox/dist gs://embeddable-sandbox/$CIRCLE_SHA1
workflows:
build-test-deploy:
jobs:
- eslint
- prettier
- typescript
- build-latest-umd-explorer
- build-latest-umd-sandbox
- bundlewatch:
requires:
- build-latest-umd-explorer
- build-latest-umd-sandbox
- cdn-upload-latest-explorer:
context:
- embeddable-explorer-write
requires:
- build-latest-umd-explorer
filters:
branches:
only: main
- build-versioned-umd-explorer:
requires:
- cdn-upload-latest-explorer
- cdn-upload-versioned-explorer:
context:
- embeddable-explorer-write
requires:
- build-versioned-umd-explorer
filters:
branches:
only: main
- cdn-upload-latest-sandbox:
context:
- embeddable-sandbox-write
requires:
- build-latest-umd-sandbox
filters:
branches:
only: main
- build-versioned-umd-sandbox:
requires:
- cdn-upload-latest-sandbox
- cdn-upload-versioned-sandbox:
context:
- embeddable-sandbox-write
requires:
- build-versioned-umd-sandbox
filters:
branches:
only: main
# For running simple node tests, you could optionally use the node/test job from the orb to replicate and replace the job above in fewer lines.
# - node/test