Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit bfe4b99

Browse files
chore(ci): add CircleCi config
1 parent dcf5210 commit bfe4b99

Some content is hidden

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

43 files changed

+6509
-4096
lines changed

.circleci/config.yml

+380
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,380 @@
1+
# Configuration file for https://circleci.com/gh/angular/angular
2+
3+
# Note: YAML anchors allow an object to be re-used, reducing duplication.
4+
# The ampersand declares an alias for an object, then later the `<<: *name`
5+
# syntax dereferences it.
6+
# See http://blog.daemonl.com/2016/02/yaml.html
7+
# To validate changes, use an online parser, eg.
8+
# http://yaml-online-parser.appspot.com/
9+
10+
# CircleCI configuration version
11+
# Version 2.1 allows for extra config reuse features
12+
# https://circleci.com/docs/2.0/reusing-config/#getting-started-with-config-reuse
13+
version: 2.1
14+
15+
# Workspace initially persisted by the `setup` job, and then enhanced by `build-npm-packages` and
16+
# `build-ivy-npm-packages`.
17+
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
18+
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
19+
var_workspace_location: &workspace_location ~/
20+
21+
# Filter to run a job on builds for pull requests only.
22+
var_only_on_pull_requests: &only_on_pull_requests
23+
filters:
24+
branches:
25+
only:
26+
- /pull\/\d+/
27+
28+
# Filter to skip a job on builds for pull requests.
29+
var_skip_on_pull_requests: &skip_on_pull_requests
30+
filters:
31+
branches:
32+
ignore:
33+
- /pull\/\d+/
34+
35+
# Filter to run a job on builds for the master branch only.
36+
var_only_on_master: &only_on_master
37+
filters:
38+
branches:
39+
only:
40+
- master
41+
42+
# Executor Definitions
43+
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors
44+
# **NOTE 1**: Pin to exact images using an ID (SHA). See https://circleci.com/docs/2.0/circleci-images/#using-a-docker-image-id-to-pin-an-image-to-a-fixed-version.
45+
# (Using the tag in not necessary when pinning by ID, but include it anyway for documentation purposes.)
46+
# **NOTE 2**: If you change the version of the docker images, also change the `cache_key` suffix.
47+
# **NOTE 3**: If you change the version of the `*-browsers` docker image, make sure the
48+
# `--versions.chrome` arg in `integration/bazel-schematics/test.sh` specifies a
49+
# ChromeDriver version that is compatible with the Chrome version in the image.
50+
executors:
51+
default-executor:
52+
parameters:
53+
resource_class:
54+
type: string
55+
default: medium
56+
docker:
57+
- image: circleci/node:12.14.1@sha256:f9de24fc0017059cc42ef7d07db060008af65a98b1f0cdd1ef3339213226bf6d
58+
resource_class: << parameters.resource_class >>
59+
working_directory: ~/ng
60+
cloud-sdk:
61+
description: The docker container to use when running gcp-gcs commands
62+
docker:
63+
- image: google/cloud-sdk:alpine
64+
65+
66+
# Command Definitions
67+
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands
68+
commands:
69+
custom_attach_workspace:
70+
description: Attach workspace at a predefined location
71+
steps:
72+
- attach_workspace:
73+
at: *workspace_location
74+
75+
# Install shared libs used by Chrome.
76+
install_chrome_libs:
77+
description: Install shared Chrome libs
78+
steps:
79+
- run:
80+
name: Install shared Chrome libs
81+
command: |
82+
sudo apt-get update
83+
# Install GTK+ graphical user interface (libgtk-3-0), advanced linux sound architecture (libasound2)
84+
# and network security service libraries (libnss3) & X11 Screen Saver extension library (libssx1)
85+
# which are dependendies of chrome & needed for karma & protractor headless chrome tests.
86+
# This is a very small install which takes around 7s in comparing to using the full
87+
# circleci/node:x.x.x-browsers image.
88+
sudo apt-get -y install libgtk-3-0 libasound2 libnss3 libxss1
89+
90+
install_java:
91+
description: Install java
92+
steps:
93+
- run:
94+
name: Install java
95+
command: |
96+
sudo apt-get update
97+
# Install java runtime
98+
sudo apt-get install default-jre
99+
100+
# Initializes the CI environment by setting up common environment variables.
101+
init_environment:
102+
description: Initializing environment (setting up variables)
103+
steps:
104+
- run:
105+
name: Set up environment
106+
environment:
107+
CIRCLE_GIT_BASE_REVISION: << pipeline.git.base_revision >>
108+
CIRCLE_GIT_REVISION: << pipeline.git.revision >>
109+
command: ./.circleci/env.sh
110+
- run:
111+
# Configure git as the CircleCI `checkout` command does.
112+
# This is needed because we only checkout on the setup job.
113+
# Add GitHub to known hosts
114+
name: Configure git
115+
command: |
116+
mkdir -p ~/.ssh
117+
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' >> ~/.ssh/known_hosts
118+
git config --global url."ssh://git@github.com".insteadOf "https://github.com" || true
119+
git config --global gc.auto 0 || true
120+
- install_java
121+
122+
init_saucelabs_environment:
123+
description: Sets up a domain that resolves to the local host.
124+
steps:
125+
- run:
126+
name: Preparing environment for running tests on Saucelabs.
127+
command: |
128+
# For SauceLabs jobs, we set up a domain which resolves to the machine which launched
129+
# the tunnel. We do this because devices are sometimes not able to properly resolve
130+
# `localhost` or `127.0.0.1` through the SauceLabs tunnel. Using a domain that does not
131+
# resolve to anything on SauceLabs VMs ensures that such requests are always resolved
132+
# through the tunnel, and resolve to the actual tunnel host machine (i.e. the CircleCI VM).
133+
# More context can be found in: https://github.com/angular/angular/pull/35171.
134+
setPublicVar SAUCE_LOCALHOST_ALIAS_DOMAIN "angular-ci.local"
135+
setSecretVar SAUCE_ACCESS_KEY $(echo $SAUCE_ACCESS_KEY | rev)
136+
- run:
137+
# Sets up a local domain in the machine's host file that resolves to the local
138+
# host. This domain is helpful in Saucelabs tests where devices are not able to
139+
# properly resolve `localhost` or `127.0.0.1` through the sauce-connect tunnel.
140+
name: Setting up alias domain for local host.
141+
command: echo "127.0.0.1 $SAUCE_LOCALHOST_ALIAS_DOMAIN" | sudo tee -a /etc/hosts
142+
143+
start_saucelabs:
144+
steps:
145+
- run:
146+
name: Starting Saucelabs tunnel service
147+
command: ./lib/saucelabs/sauce-service.sh start-ready-wait
148+
149+
stop_saucelabs:
150+
steps:
151+
- run:
152+
name: Stopping Saucelabs tunnel service
153+
command: ./lib/saucelabs/sauce-service.sh stop
154+
155+
156+
run_e2e_tests:
157+
parameters:
158+
specs:
159+
type: string
160+
steps:
161+
- custom_attach_workspace
162+
- init_environment
163+
- init_saucelabs_environment
164+
- start_saucelabs
165+
- run:
166+
command: yarn grunt test:circleci-protractor --specs="<< parameters.specs >>"
167+
no_output_timeout: 30m
168+
- stop_saucelabs
169+
170+
run_e2e_tests_jquery:
171+
parameters:
172+
specs:
173+
type: string
174+
steps:
175+
- custom_attach_workspace
176+
- init_environment
177+
- init_saucelabs_environment
178+
- start_saucelabs
179+
- run:
180+
environment:
181+
USE_JQUERY: 1
182+
command: yarn grunt test:circleci-protractor --specs="<< parameters.specs >>"
183+
no_output_timeout: 30m
184+
- stop_saucelabs
185+
186+
# Job definitions
187+
# Jobs can include parameters that are passed in the workflow job invocation.
188+
# https://circleci.com/docs/2.0/reusing-config/#authoring-parameterized-jobs
189+
jobs:
190+
setup:
191+
executor: default-executor
192+
steps:
193+
- checkout
194+
- init_environment
195+
- run:
196+
name: Running Yarn install
197+
command: yarn install --frozen-lockfile --non-interactive
198+
# Yarn's requests sometimes take more than 10mins to complete.
199+
no_output_timeout: 45m
200+
- run: yarn grunt package
201+
# Persist any changes at this point to be reused by further jobs.
202+
# **NOTE**: To add new content to the workspace, always persist on the same root.
203+
- persist_to_workspace:
204+
root: *workspace_location
205+
paths:
206+
- ./ng
207+
208+
lint:
209+
executor: default-executor
210+
steps:
211+
- custom_attach_workspace
212+
- init_environment
213+
- run: yarn -s grunt ci-checks
214+
- run: yarn commitplease "${CI_COMMIT_RANGE/.../..}"
215+
- run: yarn grunt validate-angular-files
216+
217+
unit-test:
218+
executor:
219+
name: default-executor
220+
steps:
221+
- custom_attach_workspace
222+
- init_environment
223+
- init_saucelabs_environment
224+
- run: yarn grunt test:promises-aplus
225+
- run:
226+
command: yarn grunt test:jqlite --browsers="$BROWSERS" --reporters=spec
227+
no_output_timeout: 10m
228+
- run:
229+
command: yarn grunt test:modules --browsers="$BROWSERS" --reporters=spec
230+
no_output_timeout: 10m
231+
- run:
232+
command: yarn grunt test:docs --browsers="$BROWSERS" --reporters=spec
233+
no_output_timeout: 10m
234+
235+
unit-test-jquery:
236+
executor:
237+
name: default-executor
238+
steps:
239+
- custom_attach_workspace
240+
- init_environment
241+
- init_saucelabs_environment
242+
- run:
243+
command: yarn grunt test:jquery --browsers="$BROWSERS" --reporters=spec
244+
no_output_timeout: 10m
245+
- run:
246+
command: yarn grunt test:jquery-2.2 --browsers="$BROWSERS" --reporters=spec
247+
no_output_timeout: 10m
248+
- run:
249+
command: yarn grunt test:jquery-2.1 --browsers="$BROWSERS" --reporters=spec
250+
no_output_timeout: 10m
251+
252+
e2e-test-1:
253+
executor:
254+
name: default-executor
255+
steps:
256+
- run_e2e_tests:
257+
specs: test/e2e/tests/**/*.js
258+
259+
e2e-test-2a:
260+
executor:
261+
name: default-executor
262+
steps:
263+
- run_e2e_tests:
264+
specs: build/docs/ptore2e/example-ng*/**/default_test.js
265+
266+
e2e-test-2b:
267+
executor:
268+
name: default-executor
269+
steps:
270+
- run_e2e_tests:
271+
specs: "build/docs/ptore2e/!(example-ng*)/**/default_test.js"
272+
273+
e2e-test-jquery-1:
274+
executor:
275+
name: default-executor
276+
steps:
277+
- run_e2e_tests_jquery:
278+
specs: test/e2e/tests/**/*.js
279+
280+
e2e-test-jquery-2a:
281+
executor:
282+
name: default-executor
283+
steps:
284+
- run_e2e_tests_jquery:
285+
specs: build/docs/ptore2e/example-ng*/**/jquery_test.js
286+
287+
e2e-test-jquery-2b:
288+
executor:
289+
name: default-executor
290+
steps:
291+
- run_e2e_tests_jquery:
292+
specs: build/docs/ptore2e/!(example-ng*)/**/jquery_test.js
293+
294+
deploy-docs:
295+
executor:
296+
name: default-executor
297+
steps:
298+
- custom_attach_workspace
299+
- init_environment
300+
- run: yarn grunt prepareDeploy
301+
# Install dependencies for Firebase functions to prevent parsing errors during deployment
302+
# See https://github.com/angular/angular.js/pull/16453
303+
- run: yarn -cwd $PROJECT_ROOT/scripts/docs.angularjs.org-firebase/functions
304+
- run: yarn firebase deploy --token "$FIREBASE_TOKEN" --only hosting
305+
306+
deploy-code:
307+
executor:
308+
name: default-executor
309+
steps:
310+
- run:
311+
name: Authenticate and configure Docker
312+
command: |
313+
echo $GCLOUD_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
314+
gcloud --quiet config set project ${GOOGLE_PROJECT_ID}
315+
- run:
316+
name: Sync files to code.angularjs.org
317+
command: |
318+
gsutil -m rsync $PROJECT_ROOT/deploy/code gs://code-angularjs-org-338b8.appspot.com
319+
320+
workflows:
321+
version: 2
322+
default_workflow:
323+
jobs:
324+
- setup
325+
- lint:
326+
requires:
327+
- setup
328+
- unit-test:
329+
requires:
330+
- setup
331+
- unit-test-jquery:
332+
requires:
333+
- setup
334+
- e2e-test-1:
335+
requires:
336+
- setup
337+
- e2e-test-2a:
338+
requires:
339+
- setup
340+
- e2e-test-2b:
341+
requires:
342+
- setup
343+
- e2e-test-jquery-1:
344+
requires:
345+
- setup
346+
- e2e-test-jquery-2a:
347+
requires:
348+
- setup
349+
- e2e-test-jquery-2b:
350+
requires:
351+
- setup
352+
- deploy-docs:
353+
filters:
354+
branches:
355+
only:
356+
- latest
357+
requires:
358+
- unit-test
359+
- unit-test-jquery
360+
- e2e-test-1
361+
- e2e-test-2a
362+
- e2e-test-2b
363+
- e2e-test-jquery-1
364+
- e2e-test-jquery-2a
365+
- e2e-test-jquery-2b
366+
- deploy-code:
367+
filters:
368+
branches:
369+
only:
370+
- master
371+
- latest
372+
requires:
373+
- unit-test
374+
- unit-test-jquery
375+
- e2e-test-1
376+
- e2e-test-2a
377+
- e2e-test-2b
378+
- e2e-test-jquery-1
379+
- e2e-test-jquery-2a
380+
- e2e-test-jquery-2b

0 commit comments

Comments
 (0)