1
1
# Configuration file for https://circleci.com/gh/angular/flex-layout
2
- # based on the configuration for https://circleci.com/gh/angular/material2
2
+ # based on the configuration for https://circleci.com/gh/angular/components
3
3
# Credit for file goes to Paul Gschwendtner (@DevVersion)
4
4
5
5
# Note: YAML anchors allow an object to be re-used, reducing duplication.
9
9
# To validate changes, use an online parser, eg.
10
10
# http://yaml-online-parser.appspot.com/
11
11
12
- var_1 : &docker_image circleci/node:14.16.1
13
- var_2 : &cache_key v2-ng-layout-{{ .Branch }}-{{ checksum "yarn.lock" }}-0.7.0
12
+ var_1 : &docker_image circleci/node:16.10.0
13
+ var_2 : &docker-browser-image circleci/node:16.10.0-browsers
14
+ # **Note**: When updating the beginning of the cache key, also update the cache key to match
15
+ # the new cache key prefix. This allows us to take advantage of CircleCI's fallback caching.
16
+ # Read more here: https://circleci.com/docs/2.0/caching/#restoring-cache.
17
+ var_3 : &cache_key v9-ng-layout-{{ checksum "yarn.lock" }}
18
+
14
19
15
20
# Settings common to each job
16
- var_3 : &job_defaults
21
+ var_4 : &job_defaults
17
22
working_directory : ~/ng
18
23
docker :
19
24
- image : *docker_image
20
25
21
- # Job step for checking out the source code from GitHub. This also ensures that the source code
22
- # is rebased on top of master.
23
- var_4 : &checkout_code
24
- checkout :
25
- # After checkout, rebase on top of master. By default, PRs are not rebased on top of master,
26
- # which we want. See https://discuss.circleci.com/t/1662
27
- post : git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge"
28
-
29
26
# Restores the cache that could be available for the current Yarn lock file. The cache usually
30
27
# includes the node modules and the build cache.
31
28
var_5 : &restore_cache
@@ -45,34 +42,73 @@ var_6: &save_cache
45
42
# in sync. Unlike in Travis, we don't need to manually purge the node modules if stale because
46
43
# CircleCI automatically discards the cache if the checksum of the lock file has changed.
47
44
var_7 : &yarn_install
48
- run : yarn install --frozen-lockfile --non-interactive
49
-
50
- # Sets up a different Docker image that includes a moe recent Firefox version which
51
- # is needed for headless testing.
52
- var_8 : &docker-firefox-image
53
- # TODO(devversion): Temporarily use a image that includes Firefox 62 because the
54
- # ngcontainer image does include an old Firefox version that does not support headless.
55
- # See the PR that fixes this: https://github.com/angular/angular/pull/26435
56
- - image : circleci/node:14.16.1-browsers
45
+ run :
46
+ name : " Installing project dependencies"
47
+ command : yarn install --frozen-lockfile --non-interactive8
57
48
58
49
# Attaches the release output which has been stored in the workspace to the current job.
59
50
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
60
- var_9 : &attach_release_output
51
+ var_8 : &attach_release_output
61
52
attach_workspace :
62
- at : dist/releases
53
+ at : dist/
63
54
64
- # Anchor that can be used to download and install Yarn globally in the bash environment.
65
- var_10 : &yarn_download
66
- run :
67
- name : " Downloading and installing Yarn"
68
- command : |
69
- touch $BASH_ENV
70
- curl -o- -L https://yarnpkg.com/install.sh | PROFILE=$BASH_ENV bash -s -- --version "1.19.1"
55
+ # Branch filter that we can specify for jobs that should only run on publish branches. This filter
56
+ # is used to ensure that not all upstream branches will be published as Github builds
57
+ # (e.g. revert branches, feature branches)
58
+ var_9 : &publish_branches_filter
59
+ branches :
60
+ only :
61
+ - master
62
+ # 6.0.x, 7.1.x, etc.
63
+ - /\d+\.\d+\.x/
64
+ # 6.x, 7.x, 8.x etc
65
+ - /\d+\.x/
66
+
67
+ # Filter which ensures that jobs only run for pull requests.
68
+ var_19 : &only_on_pull_requests_filter
69
+ branches :
70
+ only :
71
+ - /pull\/\d+/
72
+
73
+ # Branch filter that only matches the main branch.
74
+ var_21 : &only_main_branch_filter
75
+ branches :
76
+ only :
77
+ - master
71
78
72
79
# -----------------------------
73
80
# Container version of CircleCI
74
81
# -----------------------------
75
- version : 2
82
+ version : 2.1
83
+
84
+ # Configures CircleCI orbs for this pipeline. Orbs allow consumption of publicly shared
85
+ # CircleCI commands, jobs, configuration elements or executors. Read more about orbs here:
86
+ # https://circleci.com/docs/2.0/orb-intro/
87
+ orbs :
88
+ # Set up the `queue` orb that allows us to queue up builds across jobs. We use it
89
+ # to make sure that snapshot builds are not deployed out of order, resulting in Git
90
+ # push conflicts.
91
+ queue :
eddiewebb/[email protected]
92
+
93
+
94
+ commands :
95
+ checkout_and_rebase :
96
+ description : Checkout and rebase the repository
97
+ steps :
98
+ - checkout
99
+ # After checkout, rebase on top of target branch.
100
+ - run :
101
+ name : Rebase PR on target branch
102
+ environment :
103
+ CIRCLE_GIT_BASE_REVISION : << pipeline.git.base_revision >>
104
+ CIRCLE_GIT_REVISION : << pipeline.git.revision >>
105
+ command : |
106
+ if [ -n "$CIRCLE_PR_NUMBER" ]; then
107
+ # User is required for rebase.
108
+ git config user.name "angular-ci"
109
+ git config user.email "angular-ci"
110
+ node .circleci/rebase-pr.js
111
+ fi
76
112
77
113
# -----------------------------------------------------------------------------------------
78
114
# Job definitions. Jobs which are defined just here, will not run automatically. Each job
@@ -81,18 +117,15 @@ version: 2
81
117
jobs :
82
118
83
119
# -----------------------------------
84
- # Build job
120
+ # Setup job
85
121
# -----------------------------------
86
122
build :
87
123
<< : *job_defaults
88
124
steps :
89
- - *checkout_code
125
+ - checkout_and_rebase
90
126
- *restore_cache
91
- - *yarn_download
92
127
- *yarn_install
93
128
94
- - run : yarn gulp :publish:build-releases
95
-
96
129
# Note: We want to save the cache in this job because the workspace cache also
97
130
# includes the build cache that will be updated in this job.
98
131
- *save_cache
@@ -102,11 +135,12 @@ jobs:
102
135
# The available browsers are installed through the angular/ngcontainer Docker image.
103
136
# ------------------------------------------------------------------------------------------
104
137
tests_local_browsers :
105
- docker : *docker-firefox-image
138
+ docker :
139
+ - image : *docker-browser-image
140
+ resource_class : xlarge
106
141
steps :
107
- - *checkout_code
142
+ - checkout_and_rebase
108
143
- *restore_cache
109
- - *yarn_download
110
144
- *yarn_install
111
145
112
146
- run : ./scripts/circleci/run-local-browser-tests.sh
@@ -121,9 +155,8 @@ jobs:
121
155
BROWSER_STACK_USERNAME : " adamplumer1"
122
156
BROWSER_STACK_ACCESS_KEY : " WgLjxoB2zQ3tqmsznKnz"
123
157
steps :
124
- - *checkout_code
158
+ - checkout_and_rebase
125
159
- *restore_cache
126
- - *yarn_download
127
160
- *yarn_install
128
161
129
162
- run : ./scripts/circleci/run-browserstack-tests.sh
@@ -141,9 +174,8 @@ jobs:
141
174
# a rate limit exception.
142
175
KARMA_PARALLEL_BROWSERS : 2
143
176
steps :
144
- - *checkout_code
177
+ - checkout_and_rebase
145
178
- *restore_cache
146
- - *yarn_download
147
179
- *yarn_install
148
180
149
181
- run : ./scripts/circleci/run-saucelabs-tests.sh
@@ -154,12 +186,11 @@ jobs:
154
186
tests_ssr :
155
187
<< : *job_defaults
156
188
steps :
157
- - *checkout_code
189
+ - checkout_and_rebase
158
190
- *restore_cache
159
- - *yarn_download
160
191
- *yarn_install
161
192
162
- - run : yarn gulp ci:ssr
193
+ - run : TODO
163
194
164
195
# -------------------------------------------------------------------------
165
196
# Job that pre-render's the universal app with `@angular/platform-server`.
@@ -168,51 +199,47 @@ jobs:
168
199
prerender_build :
169
200
<< : *job_defaults
170
201
steps :
171
- - *checkout_code
202
+ - checkout_and_rebase
172
203
- *restore_cache
173
- - *yarn_download
174
204
- *yarn_install
175
205
176
- - run : yarn gulp ci:prerender
206
+ - run : npm run build universal
177
207
178
208
# -------------------------------------------------------------------------
179
209
# Job that makes sure Angular Layout can be integrated with a basic app
180
210
# -------------------------------------------------------------------------
181
211
hello_world_build :
182
212
<< : *job_defaults
183
213
steps :
184
- - *checkout_code
214
+ - checkout_and_rebase
185
215
- *restore_cache
186
- - *yarn_download
187
216
- *yarn_install
188
217
189
- - run : yarn gulp ci:hw
218
+ - run : npm run build hello-world
190
219
191
220
# -------------------------------------------------------------------------
192
221
# Job that makes sure Angular Layout can be integrated with the demo app
193
222
# -------------------------------------------------------------------------
194
223
aot_build :
195
224
<< : *job_defaults
196
225
steps :
197
- - *checkout_code
226
+ - checkout_and_rebase
198
227
- *restore_cache
199
- - *yarn_download
200
228
- *yarn_install
201
229
202
- - run : yarn gulp ci:aot
230
+ - run : npm run build demo-app
203
231
204
232
# ----------------------------------
205
233
# Lint job. Runs the gulp lint task.
206
234
# ----------------------------------
207
235
lint :
208
236
<< : *job_defaults
209
237
steps :
210
- - *checkout_code
238
+ - checkout_and_rebase
211
239
- *restore_cache
212
- - *yarn_download
213
240
- *yarn_install
214
241
215
- - run : yarn gulp ci:lint
242
+ - run : TODO
216
243
217
244
# -------------------------------------------------------------------------------------------
218
245
# Job that builds all release packages with Gulp. The built packages can be then used in the
@@ -221,55 +248,27 @@ jobs:
221
248
build_release_packages :
222
249
<< : *job_defaults
223
250
steps :
224
- - *checkout_code
251
+ - checkout_and_rebase
225
252
- *restore_cache
226
- - *yarn_download
227
253
- *yarn_install
228
254
229
- - run : yarn gulp ci: build-release-packages
255
+ - run : npm run build @angular/flex-layout
230
256
231
257
# Store the release output in the workspace storage. This means that other jobs
232
258
# in the same workflow can attach the release output to their job.
233
259
- persist_to_workspace :
234
- root : dist/releases
260
+ root : dist/
235
261
paths :
236
262
- " **/*"
237
263
238
- # Since there is no UMD bundle that includes everything, we need to move
239
- # all bundles into a directory. This allows us to store all UMD bundles as job
240
- # artifacts that can be picked up by the Angular Github bot.
241
- - run :
242
- name : Prepare artifacts for publish.
243
- command : |
244
- mkdir -p /tmp/layout-umd-minified-bundles
245
- cp dist/releases/flex-layout/bundles/*.umd.min.js /tmp/layout-umd-minified-bundles
246
- # Publish bundle artifacts which will be used to calculate the size change.
247
- # Note: Make sure that the size plugin from the Angular robot fetches the artifacts
248
- # from this CircleCI job (see .github/angular-robot.yml). Additionally any artifacts need to
249
- # be stored with the following path format: "{projectName}/{context}/{fileName}"
250
- # This format is necessary because otherwise the bot is not able to pick up the
251
- # artifacts from CircleCI. See:
252
- # https://github.com/angular/github-robot/blob/master/functions/src/plugins/size.ts#L392-L394
253
- - store_artifacts :
254
- path : /tmp/layout-umd-minified-bundles
255
- destination : /angular_layout/layout_release_output/
256
-
257
264
# ----------------------------------------
258
265
# Job that publishes the build snapshots
259
266
# ----------------------------------------
260
267
publish_snapshots :
261
268
<< : *job_defaults
262
269
steps :
263
- # Since CircleCI currently does not have any way to easily restrict jobs to only run
264
- # for push builds, we need to manually skip publishing if the jobs runs for a PR.
265
- # https://discuss.circleci.com/t/workflows-pull-request-filter/14396/11
266
- - run :
267
- name : Check whether this job should be skipped.
268
- command : ' [[ -n ${CIRCLE_PR_NUMBER} ]] && circleci step halt || true'
269
-
270
- - *checkout_code
270
+ - checkout_and_rebase
271
271
- *restore_cache
272
- - *yarn_download
273
272
- *yarn_install
274
273
- *attach_release_output
275
274
@@ -313,22 +312,11 @@ workflows:
313
312
jobs :
314
313
- build_release_packages
315
314
- publish_snapshots :
315
+ filters : *publish_branches_filter
316
316
requires :
317
317
- build_release_packages
318
318
319
319
# Lint workflow. As we want to lint in one job, this is a workflow with just one job.
320
320
lint :
321
321
jobs :
322
322
- lint
323
-
324
- # ---------------------------
325
- # General setup for CircleCI
326
- # ---------------------------
327
- general :
328
- branches :
329
- only :
330
- - master
331
- # 5.2.x, 6.0.x, etc
332
- - /\d+\.\d+\.x/
333
- # 5.x, 6.x, etc
334
- - /\d+\.x/
0 commit comments