forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
358 lines (334 loc) · 11.6 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
# Configuration file for https://circleci.com/gh/angular/angular-cli
# Note: YAML anchors allow an object to be re-used, reducing duplication.
# The ampersand declares an alias for an object, then later the `<<: *name`
# syntax dereferences it.
# See http://blog.daemonl.com/2016/02/yaml.html
# To validate changes, use an online parser, eg.
# http://yaml-online-parser.appspot.com/
version: 2.1
orbs:
browser-tools: circleci/browser-tools@1.0.1
# Variables
## IMPORTANT
# Windows needs its own cache key because binaries in node_modules are different.
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
var_1: &cache_key v1-angular_devkit-14.15-{{ checksum "yarn.lock" }}
var_1_win: &cache_key_win v1-angular_devkit-win-12.22-{{ checksum "yarn.lock" }}
var_3: &default_nodeversion '14.15'
# Workspace initially persisted by the `setup` job, and then enhanced by `setup-and-build-win`.
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
var_4: &workspace_location .
# Filter to only release branches on a given job.
var_5: &only_release_branches
filters:
branches:
only:
- master
- /\d+\.\d+\.x/
# Executor Definitions
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors
executors:
action-executor:
parameters:
nodeversion:
type: string
default: *default_nodeversion
docker:
- image: cimg/node:<< parameters.nodeversion >>
working_directory: ~/ng
resource_class: small
test-executor:
parameters:
nodeversion:
type: string
default: *default_nodeversion
docker:
- image: cimg/node:<< parameters.nodeversion >>
working_directory: ~/ng
resource_class: large
windows-executor:
# Same as https://circleci.com/orbs/registry/orb/circleci/windows, but named.
working_directory: ~/ng
resource_class: windows.medium
shell: powershell.exe -ExecutionPolicy Bypass
machine:
# Contents of this image:
# https://circleci.com/docs/2.0/hello-world-windows/#software-pre-installed-in-the-windows-image
image: windows-server-2019-vs2019:stable
# Command Definitions
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands
commands:
custom_attach_workspace:
description: Attach workspace at a predefined location
steps:
- attach_workspace:
at: *workspace_location
setup_windows:
steps:
- run: nvm install 12.22.1
- run: nvm use 12.22.1
- run: npm install -g yarn@1.22.10
- run: node --version
- run: yarn --version
setup_bazel_rbe:
parameters:
key:
type: env_var_name
default: CIRCLE_PROJECT_REPONAME
steps:
- run:
name: 'Setup bazel RBE remote execution'
command: |
touch .bazelrc.user;
# We need ensure that the same default digest is used for encoding and decoding
# with openssl. Openssl versions might have different default digests which can
# cause decryption failures based on the openssl version. https://stackoverflow.com/a/39641378/4317734
openssl aes-256-cbc -d -in .circleci/gcp_token -md md5 -k "${<< parameters.key >>}" -out /home/circleci/.gcp_credentials;
sudo bash -c "echo -e 'build --google_credentials=/home/circleci/.gcp_credentials' >> .bazelrc.user";
# Upload/don't upload local results to cache based on environment
if [[ -n "{$CIRCLE_PULL_REQUEST}" ]]; then
sudo bash -c "echo -e 'build:remote --remote_upload_local_results=false\n' >> .bazelrc.user";
echo "Not uploading local build results to remote cache.";
else
sudo bash -c "echo -e 'build:remote --remote_upload_local_results=true\n' >> .bazelrc.user";
echo "Uploading local build results to remote cache.";
fi
# Enable remote builds
sudo bash -c "echo -e 'build --config=remote' >> .bazelrc.user";
echo "Reading from remote cache for bazel remote jobs.";
install_python:
steps:
- run:
name: 'Install Python 2'
command: |
sudo apt-get update > /dev/null 2>&1
sudo apt-get install -y python
python --version
# Job definitions
jobs:
setup:
executor: action-executor
resource_class: medium
steps:
- checkout
- run:
name: Rebase PR on target branch
command: >
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
# User is required for rebase.
git config user.name "angular-ci"
git config user.email "angular-ci"
# Rebase PR on top of target branch.
node tools/rebase-pr.js angular/angular-cli ${CIRCLE_PR_NUMBER}
else
echo "This build is not over a PR, nothing to do."
fi
- restore_cache:
keys:
- *cache_key
- run: yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
- persist_to_workspace:
root: *workspace_location
paths:
- ./*
- save_cache:
key: *cache_key
paths:
- ~/.cache/yarn
lint:
executor: action-executor
steps:
- custom_attach_workspace
- run: yarn lint
validate:
executor: action-executor
steps:
- custom_attach_workspace
- run:
name: Validate Commit Messages
command: >
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
yarn ng-dev commit-message validate-range <<pipeline.git.base_revision>> <<pipeline.git.revision>>
else
echo "This build is not over a PR, nothing to do."
fi
- run:
name: Validate Code Formatting
command: yarn -s ng-dev format changed <<pipeline.git.base_revision>> --check
- run:
name: Validate NgBot Configuration
command: yarn ng-dev ngbot verify
- run:
name: Validate Circular Dependencies
command: yarn ts-circular-deps:check
- run:
command: yarn -s admin validate
e2e-cli:
parameters:
nodeversion:
type: string
default: *default_nodeversion
snapshots:
type: boolean
default: false
executor:
name: test-executor
nodeversion: << parameters.nodeversion >>
parallelism: 6
steps:
- custom_attach_workspace
- browser-tools/install-chrome
- run:
name: Initialize Environment
command: ./.circleci/env.sh
- run:
name: Execute CLI E2E Tests
command: |
mkdir /mnt/ramdisk/e2e-main
node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX} <<# parameters.snapshots >>--ng-snapshots<</ parameters.snapshots >> --tmpdir=/mnt/ramdisk/e2e-main
- run:
name: Execute CLI E2E Tests Subset with Yarn
command: |
mkdir /mnt/ramdisk/e2e-yarn
node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX} <<# parameters.snapshots >>--ng-snapshots<</ parameters.snapshots >> --yarn --tmpdir=/mnt/ramdisk/e2e-yarn --glob="{tests/basic/**,tests/update/**,tests/commands/add/**}"
test-browsers:
executor:
name: test-executor
environment:
E2E_BROWSERS: true
resource_class: medium
steps:
- custom_attach_workspace
- run:
name: Initialize Environment
command: ./.circleci/env.sh
- run:
name: Initialize Saucelabs
command: setSecretVar SAUCE_ACCESS_KEY $(echo $SAUCE_ACCESS_KEY | rev)
- run:
name: Start Saucelabs Tunnel
command: ./scripts/saucelabs/start-tunnel.sh
background: true
# Waits for the Saucelabs tunnel to be ready. This ensures that we don't run tests
# too early without Saucelabs not being ready.
- run: ./scripts/saucelabs/wait-for-tunnel.sh
- run: node ./tests/legacy-cli/run_e2e ./tests/legacy-cli/e2e/tests/misc/browsers.ts --ve
- run: node ./tests/legacy-cli/run_e2e ./tests/legacy-cli/e2e/tests/misc/browsers.ts
- run: ./scripts/saucelabs/stop-tunnel.sh
build:
executor: action-executor
steps:
- custom_attach_workspace
- run: yarn build
test:
executor: test-executor
resource_class: xlarge
steps:
- custom_attach_workspace
- browser-tools/install-chrome
- setup_bazel_rbe
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- run:
command: yarn bazel:test
no_output_timeout: 20m
snapshot_publish:
executor: action-executor
resource_class: medium
steps:
- custom_attach_workspace
- run:
name: Decrypt Credentials
# Note: when changing the image, you might have to re-encrypt the credentials with a
# matching version of openssl.
# See https://stackoverflow.com/a/43847627/2116927 for more info.
command: |
openssl aes-256-cbc -d -in .circleci/github_token -k "${KEY}" -out ~/github_token -md md5
- run:
name: Deployment to Snapshot
command: |
yarn admin snapshots --verbose --githubTokenFile=${HOME}/github_token
# Windows jobs
e2e-cli-win:
executor: windows-executor
parallelism: 8
steps:
- custom_attach_workspace
- setup_windows
- restore_cache:
keys:
- *cache_key_win
- run: yarn install --frozen-lockfile --cache-folder ../.cache/yarn
- save_cache:
key: *cache_key_win
paths:
- ~/.cache/yarn
# Run partial e2e suite on PRs only. Release branches will run the full e2e suite.
- run:
name: Execute E2E Tests
command: |
if (Test-Path env:CIRCLE_PULL_REQUEST) {
node tests\legacy-cli\run_e2e.js "--glob={tests/basic/**,tests/i18n/extract-ivy*.ts,tests/build/profile.ts}" --nb-shards=$env:CIRCLE_NODE_TOTAL --shard=$env:CIRCLE_NODE_INDEX
} else {
node tests\legacy-cli\run_e2e.js --nb-shards=$env:CIRCLE_NODE_TOTAL --shard=$env:CIRCLE_NODE_INDEX
}
workflows:
version: 2
default_workflow:
jobs:
# Linux jobs
- setup
- lint:
requires:
- setup
- validate:
requires:
- setup
- build:
requires:
- setup
- e2e-cli:
name: e2e-cli
post-steps:
- store_artifacts:
path: /tmp/dist
destination: cli/new-production
requires:
- build
- e2e-cli:
name: e2e-cli-ng-snapshots
snapshots: true
requires:
- e2e-cli
filters:
branches:
only:
- renovate/angular
- master
- e2e-cli:
name: e2e-cli-node-12
nodeversion: '12.20'
<<: *only_release_branches
requires:
- e2e-cli
- test-browsers:
requires:
- build
# Bazel jobs
# These jobs only really depend on Setup, but the build job is very quick to run (~35s) and
# will catch any build errors before proceeding to the more lengthy and resource intensive
# Bazel jobs.
- test:
requires:
- build
# Windows jobs
- e2e-cli-win:
requires:
- test
# Publish jobs
- snapshot_publish:
<<: *only_release_branches
requires:
- build
- test
- e2e-cli