2017-07-13 15:16:02 -04:00
|
|
|
# Configuration file for https://circleci.com/gh/angular/angular
|
|
|
|
|
|
|
|
# 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/
|
|
|
|
|
2017-12-12 04:23:09 -05:00
|
|
|
# Variables
|
|
|
|
|
|
|
|
## IMPORTANT
|
|
|
|
# If you change the `docker_image` version, also change the `cache_key` suffix and the version of
|
|
|
|
# `com_github_bazelbuild_buildtools` in the `/WORKSPACE` file.
|
2018-04-10 14:50:43 -04:00
|
|
|
var_1: &docker_image angular/ngcontainer:0.2.0
|
|
|
|
var_2: &cache_key v2-angular-{{ .Branch }}-{{ checksum "yarn.lock" }}-0.2.0
|
2017-12-12 04:23:09 -05:00
|
|
|
|
2018-04-13 14:53:48 -04:00
|
|
|
# Define common ENV vars
|
|
|
|
var_3: &define_env_vars
|
|
|
|
run: echo "export PROJECT_ROOT=$(pwd)" >> $BASH_ENV
|
|
|
|
|
2018-01-25 12:55:27 -05:00
|
|
|
# See remote cache documentation in /docs/BAZEL.md
|
2018-04-13 14:53:48 -04:00
|
|
|
var_4: &setup-bazel-remote-cache
|
2018-01-25 12:55:27 -05:00
|
|
|
run:
|
|
|
|
name: Start up bazel remote cache proxy
|
|
|
|
command: ~/bazel-remote-proxy -backend circleci://
|
|
|
|
background: true
|
|
|
|
|
2017-07-13 15:16:02 -04:00
|
|
|
# Settings common to each job
|
|
|
|
anchor_1: &job_defaults
|
2017-06-14 19:38:27 -04:00
|
|
|
working_directory: ~/ng
|
|
|
|
docker:
|
2017-12-12 04:23:09 -05:00
|
|
|
- image: *docker_image
|
2017-06-14 19:38:27 -04:00
|
|
|
|
2017-07-13 15:16:02 -04:00
|
|
|
# After checkout, rebase on top of master.
|
|
|
|
# Similar to travis behavior, but not quite the same.
|
|
|
|
# See https://discuss.circleci.com/t/1662
|
|
|
|
anchor_2: &post_checkout
|
2017-12-12 04:23:09 -05:00
|
|
|
post: git pull --ff-only origin "refs/pull/${CIRCLE_PULL_REQUEST//*pull\//}/merge"
|
2017-07-13 15:16:02 -04:00
|
|
|
|
2017-06-02 20:03:15 -04:00
|
|
|
version: 2
|
|
|
|
jobs:
|
2017-06-14 19:38:27 -04:00
|
|
|
lint:
|
2017-07-13 15:16:02 -04:00
|
|
|
<<: *job_defaults
|
2017-06-02 20:03:15 -04:00
|
|
|
steps:
|
2017-06-22 17:55:33 -04:00
|
|
|
- checkout:
|
2017-07-13 15:16:02 -04:00
|
|
|
<<: *post_checkout
|
2018-01-25 12:55:27 -05:00
|
|
|
|
2018-03-01 10:15:30 -05:00
|
|
|
# Check BUILD.bazel formatting before we have a node_modules directory
|
|
|
|
# Then we don't need any exclude pattern to avoid checking those files
|
|
|
|
- run: 'buildifier -mode=check $(find . -type f \( -name BUILD.bazel -or -name BUILD \)) ||
|
|
|
|
(echo "BUILD files not formatted. Please run ''yarn buildifier''" ; exit 1)'
|
|
|
|
# Run the skylark linter to check our Bazel rules
|
2018-04-10 14:50:43 -04:00
|
|
|
# deprecated-api is disabled because we use actions.new_file(genfiles_dir)
|
|
|
|
# which has no replacement, see https://github.com/bazelbuild/bazel/issues/4858
|
2018-03-01 10:15:30 -05:00
|
|
|
- run: 'find . -type f -name "*.bzl" |
|
2018-04-10 14:50:43 -04:00
|
|
|
xargs java -jar /usr/local/bin/Skylint_deploy.jar --disable-checks=deprecated-api ||
|
2018-01-05 13:53:55 -05:00
|
|
|
(echo -e "\n.bzl files have lint errors. Please run ''yarn skylint''"; exit 1)'
|
2018-01-25 12:55:27 -05:00
|
|
|
|
2017-06-02 20:03:15 -04:00
|
|
|
- restore_cache:
|
2017-12-12 04:23:09 -05:00
|
|
|
key: *cache_key
|
2017-06-21 00:08:20 -04:00
|
|
|
|
2017-10-19 05:19:45 -04:00
|
|
|
- run: yarn install --frozen-lockfile --non-interactive
|
2017-06-02 20:03:15 -04:00
|
|
|
- run: ./node_modules/.bin/gulp lint
|
2017-06-21 00:08:20 -04:00
|
|
|
|
2017-06-14 19:38:27 -04:00
|
|
|
build:
|
2017-07-13 15:16:02 -04:00
|
|
|
<<: *job_defaults
|
2018-03-07 20:26:03 -05:00
|
|
|
resource_class: xlarge
|
2017-06-14 19:38:27 -04:00
|
|
|
steps:
|
2018-04-13 14:53:48 -04:00
|
|
|
- *define_env_vars
|
2017-07-13 15:16:02 -04:00
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2018-01-25 12:55:27 -05:00
|
|
|
# See remote cache documentation in /docs/BAZEL.md
|
|
|
|
- run: .circleci/setup_cache.sh
|
|
|
|
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
|
|
|
|
- *setup-bazel-remote-cache
|
|
|
|
|
2017-06-14 19:38:27 -04:00
|
|
|
- restore_cache:
|
2017-12-12 04:23:09 -05:00
|
|
|
key: *cache_key
|
2018-01-05 13:53:55 -05:00
|
|
|
|
2018-03-07 20:26:03 -05:00
|
|
|
- run: ls /home/circleci/bazel_repository_cache || true
|
2017-12-05 14:36:08 -05:00
|
|
|
- run: bazel info release
|
2017-09-21 09:39:43 -04:00
|
|
|
- run: bazel run @yarn//:yarn
|
2018-04-10 14:11:45 -04:00
|
|
|
# Use bazel query so that we explicitly ask for all buildable targets to be built as well
|
|
|
|
# This avoids waiting for the slowest build target to finish before running the first test
|
2017-12-13 12:18:16 -05:00
|
|
|
# See https://github.com/bazelbuild/bazel/issues/4257
|
2018-04-10 14:11:45 -04:00
|
|
|
# NOTE: Angular developers should typically just bazel build //packages/... or bazel test //packages/...
|
|
|
|
- run: bazel query --output=label //... | xargs bazel test
|
2017-12-13 12:18:16 -05:00
|
|
|
|
2018-03-15 18:36:11 -04:00
|
|
|
# We run the integration tests outside of Bazel for now.
|
|
|
|
# See comments inside this script.
|
|
|
|
- run: xvfb-run --auto-servernum ./integration/run_tests.sh
|
|
|
|
|
2018-02-02 18:25:33 -05:00
|
|
|
# CircleCI will allow us to go back and view/download these artifacts from past builds.
|
|
|
|
# Also we can use a service like https://buildsize.org/ to automatically track binary size of these artifacts.
|
|
|
|
- store_artifacts:
|
|
|
|
path: dist/bin/packages/core/test/bundling/hello_world/bundle.min.js
|
|
|
|
destination: packages/core/test/bundling/hello_world/bundle.min.js
|
2018-04-02 19:34:48 -04:00
|
|
|
- store_artifacts:
|
|
|
|
path: dist/bin/packages/core/test/bundling/todo/bundle.min.js
|
|
|
|
destination: packages/core/test/bundling/todo/bundle.min.js
|
2018-02-06 20:56:35 -05:00
|
|
|
- store_artifacts:
|
|
|
|
path: dist/bin/packages/core/test/bundling/hello_world/bundle.min.js.brotli
|
|
|
|
destination: packages/core/test/bundling/hello_world/bundle.min.js.brotli
|
2018-04-02 19:34:48 -04:00
|
|
|
- store_artifacts:
|
|
|
|
path: dist/bin/packages/core/test/bundling/todo/bundle.min.js.brotli
|
|
|
|
destination: packages/core/test/bundling/todo/bundle.min.js.brotli
|
2018-02-02 18:25:33 -05:00
|
|
|
|
2017-06-02 20:03:15 -04:00
|
|
|
- save_cache:
|
2017-12-12 04:23:09 -05:00
|
|
|
key: *cache_key
|
2017-06-02 20:03:15 -04:00
|
|
|
paths:
|
|
|
|
- "node_modules"
|
2018-03-07 20:26:03 -05:00
|
|
|
- "~/bazel_repository_cache"
|
2017-06-14 19:38:27 -04:00
|
|
|
|
2018-02-27 18:24:07 -05:00
|
|
|
aio_monitoring:
|
|
|
|
<<: *job_defaults
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
|
|
|
- restore_cache:
|
|
|
|
key: *cache_key
|
|
|
|
- run: xvfb-run --auto-servernum ./aio/scripts/test-production.sh
|
|
|
|
|
2017-06-14 19:38:27 -04:00
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
default_workflow:
|
|
|
|
jobs:
|
|
|
|
- lint
|
|
|
|
- build
|
2018-02-27 18:24:07 -05:00
|
|
|
aio_monitoring:
|
|
|
|
jobs:
|
|
|
|
- aio_monitoring
|
|
|
|
triggers:
|
|
|
|
- schedule:
|
|
|
|
cron: "0 0 * * *"
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- master
|