Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit 3abecb8

Browse files
CaerusKaruAdam Plumer
authored andcommitted
build: migrate to Angular CLI build system
1 parent 0d68bf5 commit 3abecb8

File tree

327 files changed

+27916
-9492
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

327 files changed

+27916
-9492
lines changed

.circleci/config.yml

Lines changed: 104 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 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
33
# Credit for file goes to Paul Gschwendtner (@DevVersion)
44

55
# Note: YAML anchors allow an object to be re-used, reducing duplication.
@@ -9,23 +9,20 @@
99
# To validate changes, use an online parser, eg.
1010
# http://yaml-online-parser.appspot.com/
1111

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+
1419

1520
# Settings common to each job
16-
var_3: &job_defaults
21+
var_4: &job_defaults
1722
working_directory: ~/ng
1823
docker:
1924
- image: *docker_image
2025

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-
2926
# Restores the cache that could be available for the current Yarn lock file. The cache usually
3027
# includes the node modules and the build cache.
3128
var_5: &restore_cache
@@ -45,34 +42,73 @@ var_6: &save_cache
4542
# in sync. Unlike in Travis, we don't need to manually purge the node modules if stale because
4643
# CircleCI automatically discards the cache if the checksum of the lock file has changed.
4744
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
5748

5849
# Attaches the release output which has been stored in the workspace to the current job.
5950
# 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
6152
attach_workspace:
62-
at: dist/releases
53+
at: dist/
6354

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
7178

7279
# -----------------------------
7380
# Container version of CircleCI
7481
# -----------------------------
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
76112
77113
# -----------------------------------------------------------------------------------------
78114
# Job definitions. Jobs which are defined just here, will not run automatically. Each job
@@ -81,18 +117,15 @@ version: 2
81117
jobs:
82118

83119
# -----------------------------------
84-
# Build job
120+
# Setup job
85121
# -----------------------------------
86-
build:
122+
setup:
87123
<<: *job_defaults
88124
steps:
89-
- *checkout_code
125+
- checkout_and_rebase
90126
- *restore_cache
91-
- *yarn_download
92127
- *yarn_install
93128

94-
- run: yarn gulp :publish:build-releases
95-
96129
# Note: We want to save the cache in this job because the workspace cache also
97130
# includes the build cache that will be updated in this job.
98131
- *save_cache
@@ -102,11 +135,12 @@ jobs:
102135
# The available browsers are installed through the angular/ngcontainer Docker image.
103136
# ------------------------------------------------------------------------------------------
104137
tests_local_browsers:
105-
docker: *docker-firefox-image
138+
docker:
139+
- image: *docker-browser-image
140+
resource_class: xlarge
106141
steps:
107-
- *checkout_code
142+
- checkout_and_rebase
108143
- *restore_cache
109-
- *yarn_download
110144
- *yarn_install
111145

112146
- run: ./scripts/circleci/run-local-browser-tests.sh
@@ -121,9 +155,8 @@ jobs:
121155
BROWSER_STACK_USERNAME: "adamplumer1"
122156
BROWSER_STACK_ACCESS_KEY: "WgLjxoB2zQ3tqmsznKnz"
123157
steps:
124-
- *checkout_code
158+
- checkout_and_rebase
125159
- *restore_cache
126-
- *yarn_download
127160
- *yarn_install
128161

129162
- run: ./scripts/circleci/run-browserstack-tests.sh
@@ -141,9 +174,8 @@ jobs:
141174
# a rate limit exception.
142175
KARMA_PARALLEL_BROWSERS: 2
143176
steps:
144-
- *checkout_code
177+
- checkout_and_rebase
145178
- *restore_cache
146-
- *yarn_download
147179
- *yarn_install
148180

149181
- run: ./scripts/circleci/run-saucelabs-tests.sh
@@ -154,12 +186,11 @@ jobs:
154186
tests_ssr:
155187
<<: *job_defaults
156188
steps:
157-
- *checkout_code
189+
- checkout_and_rebase
158190
- *restore_cache
159-
- *yarn_download
160191
- *yarn_install
161192

162-
- run: yarn gulp ci:ssr
193+
- run: TODO
163194

164195
# -------------------------------------------------------------------------
165196
# Job that pre-render's the universal app with `@angular/platform-server`.
@@ -168,51 +199,47 @@ jobs:
168199
prerender_build:
169200
<<: *job_defaults
170201
steps:
171-
- *checkout_code
202+
- checkout_and_rebase
172203
- *restore_cache
173-
- *yarn_download
174204
- *yarn_install
175205

176-
- run: yarn gulp ci:prerender
206+
- run: npm run build universal
177207

178208
# -------------------------------------------------------------------------
179209
# Job that makes sure Angular Layout can be integrated with a basic app
180210
# -------------------------------------------------------------------------
181211
hello_world_build:
182212
<<: *job_defaults
183213
steps:
184-
- *checkout_code
214+
- checkout_and_rebase
185215
- *restore_cache
186-
- *yarn_download
187216
- *yarn_install
188217

189-
- run: yarn gulp ci:hw
218+
- run: npm run build hello-world
190219

191220
# -------------------------------------------------------------------------
192221
# Job that makes sure Angular Layout can be integrated with the demo app
193222
# -------------------------------------------------------------------------
194223
aot_build:
195224
<<: *job_defaults
196225
steps:
197-
- *checkout_code
226+
- checkout_and_rebase
198227
- *restore_cache
199-
- *yarn_download
200228
- *yarn_install
201229

202-
- run: yarn gulp ci:aot
230+
- run: npm run build demo-app
203231

204232
# ----------------------------------
205233
# Lint job. Runs the gulp lint task.
206234
# ----------------------------------
207235
lint:
208236
<<: *job_defaults
209237
steps:
210-
- *checkout_code
238+
- checkout_and_rebase
211239
- *restore_cache
212-
- *yarn_download
213240
- *yarn_install
214241

215-
- run: yarn gulp ci:lint
242+
- run: TODO
216243

217244
# -------------------------------------------------------------------------------------------
218245
# Job that builds all release packages with Gulp. The built packages can be then used in the
@@ -221,12 +248,11 @@ jobs:
221248
build_release_packages:
222249
<<: *job_defaults
223250
steps:
224-
- *checkout_code
251+
- checkout_and_rebase
225252
- *restore_cache
226-
- *yarn_download
227253
- *yarn_install
228254

229-
- run: yarn gulp ci:build-release-packages
255+
- run: npm run build @angular/flex-layout
230256

231257
# Store the release output in the workspace storage. This means that other jobs
232258
# in the same workflow can attach the release output to their job.
@@ -235,41 +261,14 @@ jobs:
235261
paths:
236262
- "**/*"
237263

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-
257264
# ----------------------------------------
258265
# Job that publishes the build snapshots
259266
# ----------------------------------------
260267
publish_snapshots:
261268
<<: *job_defaults
262269
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
271271
- *restore_cache
272-
- *yarn_download
273272
- *yarn_install
274273
- *attach_release_output
275274

@@ -292,9 +291,9 @@ workflows:
292291

293292
# Build and test workflow. A workflow includes multiple jobs that run in parallel. All jobs
294293
# that build and test source code should be part of this workflow
295-
build:
294+
setup:
296295
jobs:
297-
- build
296+
- setup
298297

299298
unit_tests:
300299
jobs:
@@ -305,30 +304,27 @@ workflows:
305304

306305
integration_tests:
307306
jobs:
308-
- prerender_build
309-
- hello_world_build
310-
- aot_build
307+
- prerender_build:
308+
requires:
309+
- setup
310+
- hello_world_build:
311+
requires:
312+
- setup
313+
- aot_build:
314+
requires:
315+
- setup
311316

312317
release_output:
313318
jobs:
314-
- build_release_packages
319+
- build_release_packages:
320+
requires:
321+
- setup
315322
- publish_snapshots:
323+
filters: *publish_branches_filter
316324
requires:
317325
- build_release_packages
318326

319327
# Lint workflow. As we want to lint in one job, this is a workflow with just one job.
320328
lint:
321329
jobs:
322330
- 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

Comments
 (0)