angular-cli/.circleci/config.yml
Filipe Silva 37debd7105 ci: remove duplicate anchor keys in circleci cfg
When updating to Pipelines (https://circleci.com/docs/2.0/build-processing/), duplicate keys cause builds to fail.
2019-05-29 17:16:41 -07:00

271 lines
7.5 KiB
YAML

# Configuration file for https://circleci.com/gh/angular/angular-cli
# 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/
# Variables
## IMPORTANT
# If you change the cache key prefix, also sync the restore_cache fallback to match.
# 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_1: &default_docker_image circleci/node:10.12
var_2: &browsers_docker_image circleci/node:10.12-browsers
var_3: &browsers_docker_image_node_12 circleci/node:12.1-browsers
var_4: &cache_key angular_devkit-0.10.0-{{ checksum "yarn.lock" }}
# Settings common to each job
anchor_1: &defaults
working_directory: ~/ng
docker:
- image: *default_docker_image
# After checkout, rebase on top of target branch.
anchor_2: &post_checkout
run:
name: Rebase PR on target branch
command: >
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
# User is required for rebase.
git config user.name "angular-ci"
git config user.email "angular-ci"
# Rebase PR on top of target branch.
node tools/rebase-pr.js angular/angular-cli ${CIRCLE_PR_NUMBER}
else
echo "This build is not over a PR, nothing to do."
fi
anchor_3: &restore_cache
restore_cache:
keys:
- *cache_key
# This fallback should be the cache_key without variables.
- angular_devkit-0.7.0-
anchor_4: &attach_options
at: .
# Job definitions
version: 2
jobs:
install:
<<: *defaults
steps:
- checkout
- *post_checkout
- *restore_cache
- run: yarn install --frozen-lockfile
- persist_to_workspace:
root: .
paths:
- ./*
- save_cache:
key: *cache_key
paths:
- ~/.cache/yarn
lint:
<<: *defaults
steps:
- attach_workspace: *attach_options
- run: npm run lint
- run: 'yarn bazel:format -mode=check ||
(echo "BUILD files not formatted. Please run ''yarn bazel:format''" ; exit 1)'
# Run the skylark linter to check our Bazel rules
- run: 'yarn bazel:lint ||
(echo -e "\n.bzl files have lint errors. Please run ''yarn bazel:lint-fix''"; exit 1)'
validate:
<<: *defaults
steps:
- attach_workspace: *attach_options
- run: npm run validate -- --ci
test:
<<: *defaults
steps:
- attach_workspace: *attach_options
- run: npm run test -- --full
test-large:
<<: *defaults
docker:
- image: *browsers_docker_image
resource_class: large
parallelism: 4
steps:
- attach_workspace: *attach_options
- run: npm run webdriver-update
- run: npm run test-large -- --full --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX}
e2e-cli:
<<: *defaults
docker:
- image: *browsers_docker_image
environment:
BASH_ENV: ~/.profile
NPM_CONFIG_PREFIX: ~/.npm-global
resource_class: xlarge
parallelism: 4
steps:
- attach_workspace: *attach_options
- run: PATH=~/.npm-global/bin:$PATH xvfb-run -a node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX}
- store_artifacts:
path: /tmp/dist
destination: cli/new-production
e2e-cli-node-12:
<<: *defaults
docker:
- image: *browsers_docker_image_node_12
environment:
BASH_ENV: ~/.profile
NPM_CONFIG_PREFIX: ~/.npm-global
resource_class: xlarge
parallelism: 4
steps:
- attach_workspace: *attach_options
- run: PATH=~/.npm-global/bin:$PATH xvfb-run -a node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX}
e2e-cli-ivy:
<<: *defaults
docker:
- image: *browsers_docker_image
environment:
BASH_ENV: ~/.profile
NPM_CONFIG_PREFIX: ~/.npm-global
resource_class: xlarge
parallelism: 4
steps:
- attach_workspace: *attach_options
- run: PATH=~/.npm-global/bin:$PATH xvfb-run -a node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX} --ivy
e2e-cli-ng-snapshots:
<<: *defaults
docker:
- image: *browsers_docker_image
environment:
BASH_ENV: ~/.profile
NPM_CONFIG_PREFIX: ~/.npm-global
resource_class: xlarge
parallelism: 4
steps:
- run:
name: Don't run expensive e2e tests for forks other than renovate-bot and angular
command: >
if [[ "$CIRCLE_PR_USERNAME" != "renovate-bot" ]] &&
[[ "$CIRCLE_PROJECT_USERNAME" != "angular" || $CIRCLE_BRANCH != "master" ]]; then
circleci step halt
fi
- attach_workspace: *attach_options
- run: PATH=~/.npm-global/bin:$PATH xvfb-run -a node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX} --ng-snapshots
build:
<<: *defaults
steps:
- attach_workspace: *attach_options
- run: npm run admin -- build
build-bazel:
<<: *defaults
resource_class: xlarge
steps:
- attach_workspace: *attach_options
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- run: yarn bazel:test
snapshot_publish:
<<: *defaults
steps:
- attach_workspace: *attach_options
- run:
name: Decrypt Credentials
command: |
openssl aes-256-cbc -d -in .circleci/github_token -k "${KEY}" -out ~/github_token
- run:
name: Deployment to Snapshot
command: |
npm run admin -- snapshots --verbose --githubTokenFile=${HOME}/github_token
publish:
<<: *defaults
steps:
- attach_workspace: *attach_options
- run:
name: Decrypt Credentials
command: |
openssl aes-256-cbc -d -in .circleci/npm_token -k "${KEY}" -out ~/.npmrc
- run:
name: Deployment to NPM
command: |
npm run admin -- publish --verbose
workflows:
version: 2
default_workflow:
jobs:
- install
- lint:
requires:
- install
- validate:
requires:
- install
- build:
requires:
- install
filters:
branches:
ignore:
- /docs-preview/
- build-bazel:
requires:
- build
- test:
requires:
- build
- test-large:
requires:
- build
- e2e-cli:
requires:
- build
- e2e-cli-node-12:
requires:
- build
- e2e-cli-ivy:
requires:
- build
- snapshot_publish_docs:
requires:
- install
filters:
branches:
only:
- /docs-preview/
- e2e-cli-ng-snapshots:
requires:
- build
- snapshot_publish:
requires:
- test
- build
- e2e-cli
filters:
branches:
ignore:
- /pull\/.*/
- publish:
requires:
- test
- build
- e2e-cli
- snapshot_publish
filters:
tags:
only: /^v\d+/
branches:
ignore: /.*/