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/
|
|
|
|
|
2018-10-27 03:25:45 -04:00
|
|
|
# Note that the browser docker image comes with Chrome and Firefox preinstalled. This is just
|
|
|
|
# needed for jobs that run tests without Bazel. Bazel runs tests with browsers that will be
|
|
|
|
# fetched by the Webtesting rules. Therefore for jobs that run tests with Bazel, we don't need a
|
|
|
|
# docker image with browsers pre-installed.
|
2019-02-01 16:40:33 -05:00
|
|
|
# **NOTE 1**: If you change the version of the `*-browsers` docker image, make sure the
|
|
|
|
# `CI_CHROMEDRIVER_VERSION_ARG` env var (in `.circleci/env.sh`) points to a ChromeDriver
|
|
|
|
# version that is compatible with the Chrome version in the image.
|
|
|
|
# **NOTE 2**: If you change the version of the docker images, also change the `cache_key` suffix.
|
2018-10-27 03:25:45 -04:00
|
|
|
var_1: &default_docker_image circleci/node:10.12
|
|
|
|
var_2: &browsers_docker_image circleci/node:10.12-browsers
|
2019-01-31 17:57:26 -05:00
|
|
|
# We don't want to include the current branch name in the cache key because that would prevent
|
|
|
|
# PRs from being able to restore the cache since the branch names are always different for PRs.
|
|
|
|
# The cache key should only consist of dynamic values that change whenever something in the
|
2019-02-04 11:11:26 -05:00
|
|
|
# cache changes. For example:
|
|
|
|
# 1) yarn lock file changes --> cached "node_modules" are different.
|
|
|
|
# 2) bazel repository definitions change --> cached bazel repositories are different.
|
2019-02-05 13:30:26 -05:00
|
|
|
# **NOTE 1 **: If you change the cache key prefix, also sync the restore_cache fallback to match.
|
|
|
|
# **NOTE 2 **: Keep the static part of the cache key as prefix to enable correct fallbacks.
|
|
|
|
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
|
|
|
|
var_3: &cache_key v2-angular-node-10.12-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}
|
2017-12-12 04:23:09 -05:00
|
|
|
|
2018-04-13 14:53:48 -04:00
|
|
|
# Define common ENV vars
|
2018-10-27 03:25:45 -04:00
|
|
|
var_4: &define_env_vars
|
2018-10-17 12:19:15 -04:00
|
|
|
run:
|
|
|
|
name: Define environment variables
|
2018-10-23 09:34:45 -04:00
|
|
|
command: ./.circleci/env.sh
|
2018-04-13 14:53:48 -04:00
|
|
|
|
2018-08-02 00:02:36 -04:00
|
|
|
var_5: &setup_bazel_remote_execution
|
|
|
|
run:
|
|
|
|
name: "Setup bazel RBE remote execution"
|
2018-12-01 19:08:15 -05:00
|
|
|
command: |
|
|
|
|
openssl aes-256-cbc -d -in .circleci/gcp_token -k "$CI_REPO_NAME" -out /home/circleci/.gcp_credentials
|
|
|
|
echo "export GOOGLE_APPLICATION_CREDENTIALS=/home/circleci/.gcp_credentials" >> $BASH_ENV
|
|
|
|
sudo bash -c "echo 'build --config=remote' >> /etc/bazel.bazelrc"
|
2018-08-02 00:02:36 -04:00
|
|
|
|
2018-10-27 03:25:45 -04:00
|
|
|
# Settings common to each job
|
|
|
|
var_6: &job_defaults
|
|
|
|
working_directory: ~/ng
|
|
|
|
docker:
|
|
|
|
- image: *default_docker_image
|
|
|
|
|
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
|
2018-10-31 16:27:38 -04:00
|
|
|
var_7: &post_checkout
|
2018-10-17 12:19:15 -04:00
|
|
|
post: git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge"
|
2017-07-13 15:16:02 -04:00
|
|
|
|
2018-10-31 16:27:38 -04:00
|
|
|
var_8: &yarn_install
|
2018-10-27 03:25:45 -04:00
|
|
|
run:
|
|
|
|
name: Running Yarn install
|
2019-01-31 07:33:23 -05:00
|
|
|
command: |
|
|
|
|
# Yarn's requests sometimes take more than 10mins to complete.
|
|
|
|
# Print something to stdout, to prevent CircleCI from failing due to not output.
|
|
|
|
while true; do sleep 60; echo "[`date`] Keeping alive..."; done &
|
|
|
|
KEEP_ALIVE_PID=$!
|
|
|
|
yarn install --frozen-lockfile --non-interactive
|
|
|
|
kill $KEEP_ALIVE_PID
|
2018-10-27 03:25:45 -04:00
|
|
|
|
2018-10-31 16:27:38 -04:00
|
|
|
var_9: &setup_circleci_bazel_config
|
2018-10-27 03:25:45 -04:00
|
|
|
run:
|
|
|
|
name: Setting up CircleCI bazel configuration
|
|
|
|
command: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
|
|
|
|
|
2019-02-05 15:21:03 -05:00
|
|
|
# Sets up Yarn by downloading it and installing it globally. We don't use Yarn from the
|
|
|
|
# docker image because this means that we can only use the Yarn version that comes with
|
|
|
|
# a specific version of NodeJS. We want to be able to update Yarn without having to
|
|
|
|
# update the docker image that comes with NodeJS.
|
|
|
|
var_10: &download_yarn
|
|
|
|
run:
|
|
|
|
name: Downloading Yarn
|
2019-02-06 02:49:29 -05:00
|
|
|
command: curl -o- -L https://yarnpkg.com/install.sh | PROFILE=$BASH_ENV bash -s -- --version "$CI_YARN_VERSION"
|
2019-02-05 15:21:03 -05:00
|
|
|
|
2019-02-05 13:30:26 -05:00
|
|
|
var_11: &restore_cache
|
|
|
|
restore_cache:
|
|
|
|
keys:
|
|
|
|
- *cache_key
|
|
|
|
# This fallback should be the cache_key without variables.
|
|
|
|
- v2-angular-node-10.12-
|
|
|
|
|
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
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2018-10-23 09:34:45 -04:00
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2018-10-27 03:25:45 -04:00
|
|
|
- *yarn_install
|
2018-01-25 12:55:27 -05:00
|
|
|
|
2018-12-05 15:16:14 -05:00
|
|
|
- run: 'yarn bazel:format -mode=check ||
|
|
|
|
(echo "BUILD files not formatted. Please run ''yarn bazel:format''" ; exit 1)'
|
2018-03-01 10:15:30 -05:00
|
|
|
# Run the skylark linter to check our Bazel rules
|
2018-12-05 15:16:14 -05:00
|
|
|
- run: 'yarn bazel:lint ||
|
|
|
|
(echo -e "\n.bzl files have lint errors. Please run ''yarn bazel:lint-fix''"; exit 1)'
|
2018-01-25 12:55:27 -05:00
|
|
|
|
2017-06-02 20:03:15 -04:00
|
|
|
- run: ./node_modules/.bin/gulp lint
|
2017-06-21 00:08:20 -04:00
|
|
|
|
2018-04-23 14:46:02 -04:00
|
|
|
test:
|
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:
|
2017-07-13 15:16:02 -04:00
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2018-10-23 09:34:45 -04:00
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2018-10-27 03:25:45 -04:00
|
|
|
- *yarn_install
|
2019-02-06 03:19:51 -05:00
|
|
|
- *setup_circleci_bazel_config
|
2018-01-05 13:53:55 -05:00
|
|
|
|
2018-08-02 00:02:36 -04:00
|
|
|
# Setup remote execution and run RBE-compatible tests.
|
|
|
|
- *setup_bazel_remote_execution
|
2018-10-27 03:25:45 -04:00
|
|
|
- run: yarn bazel test //... --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only,-local
|
2018-08-02 00:02:36 -04:00
|
|
|
# Now run RBE incompatible tests locally.
|
|
|
|
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
|
2018-10-27 03:25:45 -04:00
|
|
|
- run: yarn bazel test //... --build_tag_filters=-ivy-only,local --test_tag_filters=-ivy-only,local
|
2017-12-13 12:18:16 -05:00
|
|
|
|
2018-06-05 14:38:46 -04:00
|
|
|
# Temporary job to test what will happen when we flip the Ivy flag to true
|
|
|
|
test_ivy_aot:
|
|
|
|
<<: *job_defaults
|
|
|
|
resource_class: xlarge
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2018-10-23 09:34:45 -04:00
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2018-10-27 03:25:45 -04:00
|
|
|
- *yarn_install
|
2019-02-06 03:19:51 -05:00
|
|
|
- *setup_circleci_bazel_config
|
2018-08-02 00:02:36 -04:00
|
|
|
- *setup_bazel_remote_execution
|
2018-10-27 03:25:45 -04:00
|
|
|
|
2018-11-10 05:27:08 -05:00
|
|
|
# We need to explicitly specify the --symlink_prefix option because otherwise we would
|
|
|
|
# not be able to easily find the output bin directory when uploading artifacts for size
|
|
|
|
# measurements.
|
|
|
|
- run: yarn test-ivy-aot //... --symlink_prefix=dist/
|
|
|
|
|
|
|
|
# Publish bundle artifacts which will be used to calculate the size change. **Note**: Make
|
|
|
|
# sure that the size plugin from the Angular robot fetches the artifacts from this CircleCI
|
|
|
|
# job (see .github/angular-robot.yml). Additionally any artifacts need to be stored with the
|
|
|
|
# following path format: "{projectName}/{context}/{fileName}". This format is necessary
|
|
|
|
# because otherwise the bot is not able to pick up the artifacts from CircleCI. See:
|
|
|
|
# https://github.com/angular/github-robot/blob/master/functions/src/plugins/size.ts#L392-L394
|
|
|
|
- store_artifacts:
|
|
|
|
path: dist/bin/packages/core/test/bundling/hello_world/bundle.min.js
|
|
|
|
destination: core/hello_world/bundle
|
|
|
|
- store_artifacts:
|
|
|
|
path: dist/bin/packages/core/test/bundling/todo/bundle.min.js
|
|
|
|
destination: core/todo/bundle
|
|
|
|
- store_artifacts:
|
|
|
|
path: dist/bin/packages/core/test/bundling/hello_world/bundle.min.js.br
|
|
|
|
destination: core/hello_world/bundle.br
|
|
|
|
- store_artifacts:
|
|
|
|
path: dist/bin/packages/core/test/bundling/todo/bundle.min.js.br
|
|
|
|
destination: core/todo/bundle.br
|
2017-06-14 19:38:27 -04:00
|
|
|
|
2018-10-25 07:01:24 -04:00
|
|
|
test_aio:
|
2018-10-10 16:55:45 -04:00
|
|
|
<<: *job_defaults
|
2018-10-27 03:25:45 -04:00
|
|
|
docker:
|
|
|
|
# Needed because the AIO tests and the PWA score test depend on Chrome being available.
|
|
|
|
- image: *browsers_docker_image
|
2018-10-10 16:55:45 -04:00
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2018-10-27 03:25:45 -04:00
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2018-10-10 16:55:45 -04:00
|
|
|
# Build aio
|
|
|
|
- run: yarn --cwd aio build --progress=false
|
|
|
|
# Lint the code
|
|
|
|
- run: yarn --cwd aio lint
|
|
|
|
# Run PWA-score tests
|
|
|
|
# (Run before unit and e2e tests, which destroy the `dist/` directory.)
|
2018-10-22 06:06:20 -04:00
|
|
|
- run: yarn --cwd aio test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE
|
2018-10-10 16:55:45 -04:00
|
|
|
# Check the bundle sizes.
|
|
|
|
# (Run before unit and e2e tests, which destroy the `dist/` directory.)
|
2018-10-18 08:43:58 -04:00
|
|
|
- run: yarn --cwd aio payload-size
|
2018-10-10 16:55:45 -04:00
|
|
|
# Run unit tests
|
2019-02-01 17:13:51 -05:00
|
|
|
- run: yarn --cwd aio test --progress=false --watch=false
|
2018-10-10 16:55:45 -04:00
|
|
|
# Run e2e tests
|
2019-02-01 17:13:51 -05:00
|
|
|
- run: yarn --cwd aio e2e --configuration=ci
|
2018-10-10 16:55:45 -04:00
|
|
|
# Run unit tests for Firebase redirects
|
|
|
|
- run: yarn --cwd aio redirects-test
|
2018-10-25 07:01:24 -04:00
|
|
|
|
|
|
|
deploy_aio:
|
|
|
|
<<: *job_defaults
|
2018-10-27 03:25:45 -04:00
|
|
|
docker:
|
|
|
|
# Needed because before deploying the deploy-production script runs the PWA score tests.
|
|
|
|
- image: *browsers_docker_image
|
2018-10-25 07:01:24 -04:00
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2018-10-27 03:25:45 -04:00
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2018-10-18 07:49:30 -04:00
|
|
|
# Deploy angular.io to production (if necessary)
|
2018-10-23 09:34:45 -04:00
|
|
|
- run: setPublicVar CI_STABLE_BRANCH "$(npm info @angular/core dist-tags.latest | sed -r 's/^\s*([0-9]+\.[0-9]+)\.[0-9]+.*$/\1.x/')"
|
2018-10-22 06:06:20 -04:00
|
|
|
- run: yarn --cwd aio deploy-production
|
2018-10-10 16:55:45 -04:00
|
|
|
|
|
|
|
test_aio_local:
|
|
|
|
<<: *job_defaults
|
2018-10-27 03:25:45 -04:00
|
|
|
docker:
|
|
|
|
# Needed because the AIO tests and the PWA score test depend on Chrome being available.
|
|
|
|
- image: *browsers_docker_image
|
2018-10-10 16:55:45 -04:00
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2018-10-27 03:25:45 -04:00
|
|
|
- attach_workspace:
|
|
|
|
at: dist
|
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2018-10-10 16:55:45 -04:00
|
|
|
# Build aio (with local Angular packages)
|
|
|
|
- run: yarn --cwd aio build-local --progress=false
|
|
|
|
# Run PWA-score tests
|
|
|
|
# (Run before unit and e2e tests, which destroy the `dist/` directory.)
|
2018-10-22 06:06:20 -04:00
|
|
|
- run: yarn --cwd aio test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE
|
2018-10-10 16:55:45 -04:00
|
|
|
# Run unit tests
|
2019-02-01 17:13:51 -05:00
|
|
|
- run: yarn --cwd aio test --progress=false --watch=false
|
2018-10-10 16:55:45 -04:00
|
|
|
# Run e2e tests
|
2019-02-01 17:13:51 -05:00
|
|
|
- run: yarn --cwd aio e2e --configuration=ci
|
2018-10-10 16:55:45 -04:00
|
|
|
|
2018-11-05 12:21:27 -05:00
|
|
|
test_aio_local_ivy:
|
|
|
|
<<: *job_defaults
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2018-11-05 12:21:27 -05:00
|
|
|
- attach_workspace:
|
|
|
|
at: dist
|
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2018-11-05 12:21:27 -05:00
|
|
|
# Build aio with Ivy (using local Angular packages)
|
|
|
|
- run: yarn --cwd aio build-with-ivy --progress=false
|
|
|
|
|
2018-10-10 16:55:45 -04:00
|
|
|
test_aio_tools:
|
|
|
|
<<: *job_defaults
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2018-10-27 03:25:45 -04:00
|
|
|
- attach_workspace:
|
|
|
|
at: dist
|
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2018-10-10 16:55:45 -04:00
|
|
|
# Install
|
|
|
|
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
|
|
|
|
- run: yarn --cwd aio extract-cli-command-docs
|
|
|
|
# Run tools tests
|
|
|
|
- run: yarn --cwd aio tools-test
|
|
|
|
- run: ./aio/aio-builds-setup/scripts/test.sh
|
|
|
|
|
2019-01-06 09:37:55 -05:00
|
|
|
test_docs_examples:
|
2018-10-10 16:55:45 -04:00
|
|
|
<<: *job_defaults
|
2018-10-27 03:25:45 -04:00
|
|
|
docker:
|
|
|
|
# Needed because the example e2e tests depend on Chrome.
|
|
|
|
- image: *browsers_docker_image
|
2019-01-07 13:29:25 -05:00
|
|
|
parallelism: 3
|
2018-10-10 16:55:45 -04:00
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2018-10-27 03:25:45 -04:00
|
|
|
- attach_workspace:
|
|
|
|
at: dist
|
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2018-10-10 16:55:45 -04:00
|
|
|
# Install aio
|
|
|
|
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
|
2019-01-06 09:37:55 -05:00
|
|
|
# Run examples tests. The "CIRCLE_NODE_INDEX" will be set if "parallelism" is enabled.
|
2019-01-07 13:29:25 -05:00
|
|
|
# Since the parallelism is set to "3", there will be three parallel CircleCI containers
|
|
|
|
# with either "0", "1" or "2" as node index. This can be passed to the "--shard" argument.
|
2019-01-06 09:37:55 -05:00
|
|
|
- run: yarn --cwd aio example-e2e --setup --local --shard=${CIRCLE_NODE_INDEX}/${CIRCLE_NODE_TOTAL}
|
2018-10-10 16:55:45 -04:00
|
|
|
|
2019-02-05 16:20:05 -05:00
|
|
|
test_docs_examples_ivy:
|
|
|
|
<<: *job_defaults
|
|
|
|
docker:
|
|
|
|
# Needed because the example e2e tests depend on Chrome.
|
|
|
|
- image: *browsers_docker_image
|
|
|
|
parallelism: 3
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
|
|
|
- *restore_cache
|
|
|
|
- attach_workspace:
|
|
|
|
at: dist
|
|
|
|
- *define_env_vars
|
|
|
|
- *download_yarn
|
|
|
|
# Install aio
|
|
|
|
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
|
|
|
|
# Run examples tests with ivy. The "CIRCLE_NODE_INDEX" will be set if "parallelism" is enabled.
|
|
|
|
# Since the parallelism is set to "3", there will be three parallel CircleCI containers
|
|
|
|
# with either "0", "1" or "2" as node index. This can be passed to the "--shard" argument.
|
|
|
|
- run: yarn --cwd aio example-e2e --setup --local --ivy --shard=${CIRCLE_NODE_INDEX}/${CIRCLE_NODE_TOTAL}
|
|
|
|
|
2018-10-17 12:19:15 -04:00
|
|
|
# This job should only be run on PR builds, where `CI_PULL_REQUEST` is not `false`.
|
2018-05-09 13:54:13 -04:00
|
|
|
aio_preview:
|
|
|
|
<<: *job_defaults
|
|
|
|
environment:
|
|
|
|
AIO_SNAPSHOT_ARTIFACT_PATH: &aio_preview_artifact_path 'aio/tmp/snapshot.tgz'
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2018-10-27 03:25:45 -04:00
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2018-10-17 12:19:15 -04:00
|
|
|
- run: ./aio/scripts/build-artifacts.sh $AIO_SNAPSHOT_ARTIFACT_PATH $CI_PULL_REQUEST $CI_COMMIT
|
2018-05-09 13:54:13 -04:00
|
|
|
- store_artifacts:
|
|
|
|
path: *aio_preview_artifact_path
|
|
|
|
# The `destination` needs to be kept in synch with the value of
|
|
|
|
# `AIO_ARTIFACT_PATH` in `aio/aio-builds-setup/Dockerfile`
|
|
|
|
destination: aio/dist/aio-snapshot.tgz
|
2018-12-04 08:50:17 -05:00
|
|
|
- run: node ./aio/scripts/create-preview $CIRCLE_BUILD_NUM
|
2018-05-09 13:54:13 -04:00
|
|
|
|
2018-10-17 12:19:15 -04:00
|
|
|
# This job should only be run on PR builds, where `CI_PULL_REQUEST` is not `false`.
|
2018-08-25 17:40:58 -04:00
|
|
|
test_aio_preview:
|
|
|
|
<<: *job_defaults
|
2018-10-27 03:25:45 -04:00
|
|
|
docker:
|
|
|
|
# Needed because the test-preview script runs e2e tests and the PWA score test with Chrome.
|
|
|
|
- image: *browsers_docker_image
|
2018-08-25 17:40:58 -04:00
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2018-10-27 03:25:45 -04:00
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2019-02-06 03:19:51 -05:00
|
|
|
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
|
2018-08-25 17:40:58 -04:00
|
|
|
- run:
|
|
|
|
name: Wait for preview and run tests
|
2018-10-22 06:06:20 -04:00
|
|
|
command: node aio/scripts/test-preview.js $CI_PULL_REQUEST $CI_COMMIT $CI_AIO_MIN_PWA_SCORE
|
2018-08-25 17:40:58 -04:00
|
|
|
|
2019-01-14 20:47:39 -05:00
|
|
|
|
|
|
|
# The `build-npm-packages` tasks exist for backwards-compatibility with old scripts and
|
|
|
|
# tests that rely on the pre-Bazel `dist/packages-dist` output structure (build.sh).
|
|
|
|
# Having multiple jobs that independently build in this manner duplicates some work; we build
|
|
|
|
# the bazel packages more than once. Even though we have a remote cache, these jobs will
|
|
|
|
# typically run in parallel so up-to-date outputs will not be available at the time the build
|
2018-04-23 14:46:02 -04:00
|
|
|
# starts.
|
2019-01-14 20:47:39 -05:00
|
|
|
|
|
|
|
# Build the view engine npm packages. No new jobs should depend on this.
|
|
|
|
build-npm-packages:
|
2018-04-23 14:46:02 -04:00
|
|
|
<<: *job_defaults
|
|
|
|
resource_class: xlarge
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2018-10-23 09:34:45 -04:00
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2018-10-27 03:25:45 -04:00
|
|
|
- *yarn_install
|
2019-02-05 15:21:03 -05:00
|
|
|
- *setup_circleci_bazel_config
|
2018-08-02 00:02:36 -04:00
|
|
|
- *setup_bazel_remote_execution
|
2018-10-27 03:25:45 -04:00
|
|
|
|
2018-08-02 00:02:36 -04:00
|
|
|
- run: scripts/build-packages-dist.sh
|
2018-04-23 14:46:02 -04:00
|
|
|
|
|
|
|
# Save the npm packages from //packages/... for other workflow jobs to read
|
|
|
|
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: dist
|
|
|
|
paths:
|
|
|
|
- packages-dist
|
2019-01-14 20:47:39 -05:00
|
|
|
|
2019-02-06 03:26:36 -05:00
|
|
|
- save_cache:
|
|
|
|
key: *cache_key
|
|
|
|
paths:
|
|
|
|
- "node_modules"
|
|
|
|
- "~/bazel_repository_cache"
|
|
|
|
|
2019-01-14 20:47:39 -05:00
|
|
|
|
|
|
|
# Build the ivy npm packages.
|
|
|
|
build-ivy-npm-packages:
|
|
|
|
<<: *job_defaults
|
|
|
|
resource_class: xlarge
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2019-01-14 20:47:39 -05:00
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2019-01-14 20:47:39 -05:00
|
|
|
- *yarn_install
|
2019-02-05 15:21:03 -05:00
|
|
|
- *setup_circleci_bazel_config
|
2019-01-14 20:47:39 -05:00
|
|
|
- *setup_bazel_remote_execution
|
|
|
|
|
|
|
|
- run: scripts/build-ivy-npm-packages.sh
|
|
|
|
|
|
|
|
# Save the npm packages from //packages/... for other workflow jobs to read
|
|
|
|
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: dist
|
|
|
|
paths:
|
2018-10-23 12:54:12 -04:00
|
|
|
- packages-dist-ivy-aot
|
2018-04-23 14:46:02 -04:00
|
|
|
|
|
|
|
# We run the integration tests outside of Bazel for now.
|
|
|
|
# They are a separate workflow job so that they can be easily re-run.
|
|
|
|
# When the tests are ported to bazel test targets, they should move to the "test"
|
|
|
|
# job above, as part of the bazel test command. That has flaky_test_attempts so the
|
|
|
|
# need to re-run manually should be alleviated.
|
|
|
|
# See comments inside the integration/run_tests.sh script.
|
|
|
|
integration_test:
|
|
|
|
<<: *job_defaults
|
2019-01-06 06:37:46 -05:00
|
|
|
parallelism: 4
|
2018-10-27 03:25:45 -04:00
|
|
|
docker:
|
|
|
|
# Needed because the integration tests expect Chrome to be installed (e.g cli-hello-world)
|
|
|
|
- image: *browsers_docker_image
|
2018-06-14 10:37:06 -04:00
|
|
|
# Note: we run Bazel in one of the integration tests, and it can consume >2G
|
|
|
|
# of memory. Together with the system under test, this can exhaust the RAM
|
|
|
|
# on a 4G worker so we use a larger machine here too.
|
|
|
|
resource_class: xlarge
|
2018-04-23 14:46:02 -04:00
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2018-04-23 14:46:02 -04:00
|
|
|
- attach_workspace:
|
|
|
|
at: dist
|
2018-10-27 03:25:45 -04:00
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2019-02-06 03:21:26 -05:00
|
|
|
# Some integration tests get their dependencies from the root `node_modules/`.
|
|
|
|
- *yarn_install
|
2019-01-06 06:37:46 -05:00
|
|
|
# Runs the integration tests in parallel across multiple CircleCI container instances. The
|
|
|
|
# amount of container nodes for this job is controlled by the "parallelism" option.
|
|
|
|
- run: ./integration/run_tests.sh ${CIRCLE_NODE_INDEX} ${CIRCLE_NODE_TOTAL}
|
2018-04-23 14:46:02 -04:00
|
|
|
|
|
|
|
# This job updates the content of repos like github.com/angular/core-builds
|
|
|
|
# for every green build on angular/angular.
|
|
|
|
publish_snapshot:
|
|
|
|
<<: *job_defaults
|
|
|
|
steps:
|
2018-10-23 09:34:45 -04:00
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2018-10-17 12:19:15 -04:00
|
|
|
- *define_env_vars
|
2018-04-27 19:21:38 -04:00
|
|
|
# See below - ideally this job should not trigger for non-upstream builds.
|
|
|
|
# But since it does, we have to check this condition.
|
|
|
|
- run:
|
|
|
|
name: Skip this job for Pull Requests and Fork builds
|
|
|
|
# Note, `|| true` on the end makes this step always exit 0
|
|
|
|
command: '[[
|
2018-10-17 12:19:15 -04:00
|
|
|
"$CI_PULL_REQUEST" != "false"
|
|
|
|
|| "$CI_REPO_OWNER" != "angular"
|
|
|
|
|| "$CI_REPO_NAME" != "angular"
|
2018-04-27 19:21:38 -04:00
|
|
|
]] && circleci step halt || true'
|
2018-04-23 14:46:02 -04:00
|
|
|
- attach_workspace:
|
|
|
|
at: dist
|
|
|
|
# CircleCI has a config setting to force SSH for all github connections
|
|
|
|
# This is not compatible with our mechanism of using a Personal Access Token
|
|
|
|
# Clear the global setting
|
|
|
|
- run: git config --global --unset "url.ssh://git@github.com.insteadof"
|
2018-04-27 19:21:38 -04:00
|
|
|
- run:
|
|
|
|
name: Decrypt github credentials
|
|
|
|
command: 'openssl aes-256-cbc -d -in .circleci/github_token -k "${KEY}" -out ~/.git_credentials'
|
2018-04-23 14:46:02 -04:00
|
|
|
- run: ./scripts/ci/publish-build-artifacts.sh
|
|
|
|
|
2018-02-27 18:24:07 -05:00
|
|
|
aio_monitoring:
|
|
|
|
<<: *job_defaults
|
2018-10-27 03:25:45 -04:00
|
|
|
docker:
|
|
|
|
# This job needs Chrome to be globally installed because the tests run with Protractor
|
|
|
|
# which does not load the browser through the Bazel webtesting rules.
|
|
|
|
- image: *browsers_docker_image
|
2018-02-27 18:24:07 -05:00
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2018-10-27 03:25:45 -04:00
|
|
|
- *define_env_vars
|
2019-02-06 02:49:29 -05:00
|
|
|
- *download_yarn
|
2018-09-27 09:35:05 -04:00
|
|
|
- run:
|
|
|
|
name: Run tests against the deployed apps
|
2018-10-22 06:06:20 -04:00
|
|
|
command: ./aio/scripts/test-production.sh $CI_AIO_MIN_PWA_SCORE
|
2018-10-22 09:56:31 -04:00
|
|
|
- run:
|
|
|
|
name: Notify caretaker about failure
|
2019-02-06 03:45:33 -05:00
|
|
|
# `$SLACK_CARETAKER_WEBHOOK_URL` is a secret env var defined in CircleCI project settings.
|
|
|
|
# The URL comes from https://angular-team.slack.com/apps/A0F7VRE7N-circleci.
|
|
|
|
command: 'curl --request POST --header "Content-Type: application/json" --data "{\"text\":\":x: \`$CIRCLE_JOB\` job failed on build $CIRCLE_BUILD_NUM: $CIRCLE_BUILD_URL :scream:\"}" $SLACK_CARETAKER_WEBHOOK_URL'
|
2018-10-22 09:56:31 -04:00
|
|
|
when: on_fail
|
2018-02-27 18:24:07 -05:00
|
|
|
|
2019-01-04 14:58:33 -05:00
|
|
|
legacy-unit-tests-local:
|
|
|
|
<<: *job_defaults
|
|
|
|
docker:
|
|
|
|
- image: *browsers_docker_image
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2019-01-04 14:58:33 -05:00
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2019-01-04 14:58:33 -05:00
|
|
|
- *yarn_install
|
|
|
|
- run: yarn tsc -p packages
|
|
|
|
- run: yarn tsc -p modules
|
|
|
|
- run: yarn karma start ./karma-js.conf.js --single-run --browsers=ChromeNoSandbox
|
|
|
|
|
|
|
|
legacy-unit-tests-saucelabs:
|
|
|
|
<<: *job_defaults
|
|
|
|
# In order to avoid the bottleneck of having a slow host machine, we acquire a better
|
|
|
|
# container for this job. This is necessary because we launch a lot of browsers concurrently
|
|
|
|
# and therefore the tunnel and Karma need to process a lot of file requests and tests.
|
|
|
|
resource_class: xlarge
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2019-01-04 14:58:33 -05:00
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2019-01-04 14:58:33 -05:00
|
|
|
- *yarn_install
|
|
|
|
- run:
|
|
|
|
name: Preparing environment for running tests on Saucelabs.
|
|
|
|
command: |
|
|
|
|
setPublicVar KARMA_JS_BROWSERS $(node -e 'console.log(require("./browser-providers.conf").sauceAliases.CI_REQUIRED.join(","))')
|
|
|
|
setSecretVar SAUCE_ACCESS_KEY $(echo $SAUCE_ACCESS_KEY | rev)
|
|
|
|
- run:
|
|
|
|
name: Starting Saucelabs tunnel
|
|
|
|
command: ./scripts/saucelabs/start-tunnel.sh
|
|
|
|
background: true
|
|
|
|
- run: yarn tsc -p packages
|
|
|
|
- run: yarn tsc -p modules
|
|
|
|
# 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: yarn karma start ./karma-js.conf.js --single-run --browsers=${KARMA_JS_BROWSERS}
|
|
|
|
- run: ./scripts/saucelabs/stop-tunnel.sh
|
|
|
|
|
2019-01-05 08:01:47 -05:00
|
|
|
legacy-misc-tests:
|
|
|
|
<<: *job_defaults
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
2019-02-05 13:30:26 -05:00
|
|
|
- *restore_cache
|
2019-01-05 08:01:47 -05:00
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2019-01-05 08:01:47 -05:00
|
|
|
- *yarn_install
|
|
|
|
- attach_workspace:
|
|
|
|
at: dist
|
|
|
|
- run: yarn gulp check-cycle
|
|
|
|
# TODO: disabled because the Bazel packages-dist does not seem to have map files for
|
|
|
|
# the ESM5/ES2015 output. See: https://github.com/angular/angular/issues/27966
|
|
|
|
# - run: yarn gulp source-map-test
|
2019-01-04 14:58:33 -05:00
|
|
|
|
2019-01-14 20:47:39 -05:00
|
|
|
# Job to run unit tests from angular/material2. Needs a browser since all
|
|
|
|
# component unit tests assume they're running in the browser environment.
|
|
|
|
material-unit-tests:
|
|
|
|
<<: *job_defaults
|
|
|
|
resource_class: xlarge
|
|
|
|
docker:
|
|
|
|
- image: *browsers_docker_image
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
<<: *post_checkout
|
|
|
|
- *define_env_vars
|
2019-02-05 15:21:03 -05:00
|
|
|
- *download_yarn
|
2019-01-14 20:47:39 -05:00
|
|
|
- attach_workspace:
|
|
|
|
at: dist
|
|
|
|
- run: ./scripts/ci/run_angular_material_unit_tests.sh
|
|
|
|
|
2017-06-14 19:38:27 -04:00
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
default_workflow:
|
|
|
|
jobs:
|
|
|
|
- lint
|
2018-04-23 14:46:02 -04:00
|
|
|
- test
|
2018-06-05 14:38:46 -04:00
|
|
|
- test_ivy_aot
|
2019-01-14 20:47:39 -05:00
|
|
|
- build-npm-packages
|
|
|
|
- build-ivy-npm-packages
|
2018-10-25 07:01:24 -04:00
|
|
|
- test_aio
|
2019-01-04 14:58:33 -05:00
|
|
|
- legacy-unit-tests-local
|
|
|
|
- legacy-unit-tests-saucelabs
|
2018-10-25 07:01:24 -04:00
|
|
|
- deploy_aio:
|
|
|
|
requires:
|
|
|
|
- test_aio
|
2019-01-05 08:01:47 -05:00
|
|
|
- legacy-misc-tests:
|
|
|
|
requires:
|
2019-01-14 20:47:39 -05:00
|
|
|
- build-npm-packages
|
2018-10-10 16:55:45 -04:00
|
|
|
- test_aio_local:
|
|
|
|
requires:
|
2019-01-14 20:47:39 -05:00
|
|
|
- build-npm-packages
|
2018-11-05 12:21:27 -05:00
|
|
|
- test_aio_local_ivy:
|
|
|
|
requires:
|
2019-01-14 20:47:39 -05:00
|
|
|
- build-npm-packages
|
2018-10-10 16:55:45 -04:00
|
|
|
- test_aio_tools:
|
|
|
|
requires:
|
2019-01-14 20:47:39 -05:00
|
|
|
- build-npm-packages
|
2019-01-06 09:37:55 -05:00
|
|
|
- test_docs_examples:
|
2018-10-10 16:55:45 -04:00
|
|
|
requires:
|
2019-01-14 20:47:39 -05:00
|
|
|
- build-npm-packages
|
2019-02-05 16:20:05 -05:00
|
|
|
- test_docs_examples_ivy:
|
|
|
|
requires:
|
|
|
|
- build-npm-packages
|
2018-09-20 04:21:53 -04:00
|
|
|
- aio_preview:
|
|
|
|
# Only run on PR builds. (There can be no previews for non-PR builds.)
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: /pull\/\d+/
|
2018-08-25 17:40:58 -04:00
|
|
|
- test_aio_preview:
|
|
|
|
requires:
|
|
|
|
- aio_preview
|
2018-04-23 14:46:02 -04:00
|
|
|
- integration_test:
|
|
|
|
requires:
|
2019-01-14 20:47:39 -05:00
|
|
|
- build-npm-packages
|
2018-04-23 14:46:02 -04:00
|
|
|
- publish_snapshot:
|
|
|
|
# Note: no filters on this job because we want it to run for all upstream branches
|
|
|
|
# We'd really like to filter out pull requests here, but not yet available:
|
|
|
|
# https://discuss.circleci.com/t/workflows-pull-request-filter/14396/4
|
2018-04-27 19:21:38 -04:00
|
|
|
# Instead, the job just exits immediately at the first step.
|
2018-04-23 14:46:02 -04:00
|
|
|
requires:
|
2018-04-23 19:41:10 -04:00
|
|
|
# Only publish if tests and integration tests pass
|
2018-04-23 19:14:34 -04:00
|
|
|
- test
|
2018-06-05 14:38:46 -04:00
|
|
|
- test_ivy_aot
|
2018-04-23 19:41:10 -04:00
|
|
|
- integration_test
|
2018-10-24 09:51:00 -04:00
|
|
|
# Only publish if `aio`/`docs` tests using the locally built Angular packages pass
|
|
|
|
- test_aio_local
|
2018-11-05 12:21:27 -05:00
|
|
|
- test_aio_local_ivy
|
2019-01-06 09:37:55 -05:00
|
|
|
- test_docs_examples
|
2019-02-05 16:20:05 -05:00
|
|
|
- test_docs_examples_ivy
|
|
|
|
# Get the artifacts to publish from the build-packages-dist job
|
2018-04-23 19:14:34 -04:00
|
|
|
# since the publishing script expects the legacy outputs layout.
|
2019-01-14 20:47:39 -05:00
|
|
|
- build-npm-packages
|
|
|
|
- build-ivy-npm-packages
|
2019-01-05 08:01:47 -05:00
|
|
|
- legacy-misc-tests
|
2019-01-04 14:58:33 -05:00
|
|
|
- legacy-unit-tests-local
|
|
|
|
- legacy-unit-tests-saucelabs
|
2019-01-14 20:47:39 -05:00
|
|
|
- material-unit-tests:
|
|
|
|
requires:
|
|
|
|
- build-ivy-npm-packages
|
2019-01-04 14:58:33 -05:00
|
|
|
|
2018-04-23 14:46:02 -04:00
|
|
|
|
2018-02-27 18:24:07 -05:00
|
|
|
aio_monitoring:
|
|
|
|
jobs:
|
|
|
|
- aio_monitoring
|
|
|
|
triggers:
|
|
|
|
- schedule:
|
|
|
|
cron: "0 0 * * *"
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- master
|
2019-01-04 14:58:33 -05:00
|
|
|
|
|
|
|
# TODO:
|
|
|
|
# - don't build the g3 branch
|
|
|
|
# - verify that we are bootstrapping with the right yarn version coming from the docker image
|
|
|
|
# - check local chrome version pulled from docker image
|
|
|
|
# - remove /tools/ngcontainer
|