Skip to content

Refactor CircleCI configuration #14687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .appveyor.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .buildkite/pipeline.yml

This file was deleted.

132 changes: 94 additions & 38 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,22 @@
# 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" }}
var_1: &default_docker_image circleci/node:12.1
var_2: &browsers_docker_image circleci/node:12.1-browsers
var_3: &browsers_docker_image_node_10 circleci/node:10.12-browsers
var_4: &cache_key angular_devkit-0.11.0-{{ checksum "yarn.lock" }}

# Settings common to each job
anchor_1: &defaults
working_directory: ~/ng
docker:
- image: *default_docker_image
anchor_1_win: &defaults_win
working_directory: ~/ng
resource_class: windows.medium
shell: powershell.exe -ExecutionPolicy Bypass
machine:
image: windows-server-2019

# After checkout, rebase on top of target branch.
anchor_2: &post_checkout
Expand All @@ -38,17 +44,36 @@ anchor_2: &post_checkout
else
echo "This build is not over a PR, nothing to do."
fi
anchor_2_win: &post_checkout_win
run:
name: Rebase PR on target branch
command: >
if (Test-Path env:CIRCLE_PR_NUMBER) {
git config user.name "angular-ci"
git config user.email "angular-ci"
node tools\rebase-pr.js angular/angular-cli $env:CIRCLE_PR_NUMBER }
anchor_3: &restore_cache
restore_cache:
keys:
- *cache_key
# This fallback should be the cache_key without variables.
- angular_devkit-0.7.0-
- angular_devkit-0.11.0-
anchor_4: &attach_options
at: .
anchor_5: &env_win
run:
# Need to install node and yarn before, as the base windows image doesn't have anything.
# TODO: remove when CircleCI provides preconfigured node images/VMs.
name: Setup windows node environment
command: ./.circleci/windows-env.ps1
anchor_6: &ignore_pull_requests
filters:
branches:
ignore:
- /pull\/.*/

# Job definitions
version: 2
version: 2.1
jobs:
install:
<<: *defaults
Expand All @@ -70,7 +95,7 @@ jobs:
<<: *defaults
steps:
- attach_workspace: *attach_options
- run: npm run lint
- run: yarn 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
Expand All @@ -81,13 +106,13 @@ jobs:
<<: *defaults
steps:
- attach_workspace: *attach_options
- run: npm run validate -- --ci
- run: yarn validate -- --ci

test:
<<: *defaults
steps:
- attach_workspace: *attach_options
- run: npm run test -- --full
- run: yarn test -- --full

test-large:
<<: *defaults
Expand All @@ -97,8 +122,8 @@ jobs:
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}
- run: yarn webdriver-update
- run: yarn test-large -- --full --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX}

e2e-cli:
<<: *defaults
Expand All @@ -116,10 +141,10 @@ jobs:
path: /tmp/dist
destination: cli/new-production

e2e-cli-node-12:
e2e-cli-node-10:
<<: *defaults
docker:
- image: *browsers_docker_image_node_12
- image: *browsers_docker_image_node_10
environment:
BASH_ENV: ~/.profile
NPM_CONFIG_PREFIX: ~/.npm-global
Expand Down Expand Up @@ -152,21 +177,14 @@ jobs:
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
- run: yarn admin -- build

build-bazel:
<<: *defaults
Expand All @@ -187,7 +205,7 @@ jobs:
- run:
name: Deployment to Snapshot
command: |
npm run admin -- snapshots --verbose --githubTokenFile=${HOME}/github_token
yarn admin -- snapshots --verbose --githubTokenFile=${HOME}/github_token

publish:
<<: *defaults
Expand All @@ -200,7 +218,46 @@ jobs:
- run:
name: Deployment to NPM
command: |
npm run admin -- publish --verbose
yarn admin -- publish --verbose

# Windows jobs
# CircleCI support for Windows jobs is still in preview.
# Docs: https://github.com/CircleCI-Public/windows-preview-docs
test-win:
<<: *defaults_win
# Skipping cache and workspace for now because it takes 10x longer than on linux.
# TODO: when/if CircleCI makes them faster, use cache and workspaces fully.
# Notes:
# - windows needs its own cache key because binaries in node_modules are different.
# - windows might need its own workspace for the same reason.
# - get cache dir on windows via `yarn cache dir` (was `C:\Users\circleci\AppData\Local\Yarn\Cache\v4` last time)
steps:
- checkout
- *env_win
- *post_checkout_win
- run: node --version
- run: yarn --version
- run: yarn install --frozen-lockfile
# Build and test should be on their own jobs, but restoring workspaces is too slow
# so we do it here.
- run: yarn admin -- build
- run: yarn test -- --full
# Run partial e2e suite on PRs only. Master will run the full e2e suite with sharding.
- run: if (Test-Path env:CIRCLE_PR_NUMBER) { node tests\legacy-cli\run_e2e.js "--glob=tests/{basic,ivy}/**" }

e2e-cli-win:
<<: *defaults_win
parallelism: 4
steps:
- checkout
- *env_win
# TODO: remove commands other than the e2e runner when workspaces on windows are well supported.
- *post_checkout_win
- run: node --version
- run: yarn --version
- run: yarn install --frozen-lockfile
- run: yarn admin -- build
- run: node tests\legacy-cli\run_e2e.js --nb-shards=$env:CIRCLE_NODE_TOTAL --shard=$env:CIRCLE_NODE_INDEX

workflows:
version: 2
Expand All @@ -226,37 +283,36 @@ workflows:
- test:
requires:
- build
- test-win:
requires:
- test
- test-large:
requires:
- build
- e2e-cli:
requires:
- build
- e2e-cli-node-12:
- e2e-cli-ivy:
requires:
- build
- e2e-cli-ivy:
- e2e-cli-ng-snapshots:
<<: *ignore_pull_requests
requires:
- build
- snapshot_publish_docs:
- e2e-cli
- e2e-cli-node-10:
<<: *ignore_pull_requests
requires:
- install
filters:
branches:
only:
- /docs-preview/
- e2e-cli-ng-snapshots:
- e2e-cli
- e2e-cli-win:
<<: *ignore_pull_requests
requires:
- build
- e2e-cli
- snapshot_publish:
<<: *ignore_pull_requests
requires:
- test
- build
- e2e-cli
filters:
branches:
ignore:
- /pull\/.*/
- publish:
requires:
- test
Expand Down
9 changes: 9 additions & 0 deletions .circleci/windows-env.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Install nodejs and yarn via Chocolatey.
choco install nodejs --version 12.1.0 --no-progress
choco install yarn --version 1.16.0 --no-progress

# Add PATH modifications to the Powershell profile. This is the win equivalent of .bash_profile.
# https://docs.microsoft.com/en-us/previous-versions//bb613488(v=vs.85)
new-item -path $profile -itemtype file -force
# Paths for nodejs, npm, and yarn. Use single quotes to prevent interpolation.
Add-Content $profile '$Env:path += ";C:\Program Files\nodejs\;C:\Users\circleci\AppData\Roaming\npm\;C:\Program Files (x86)\Yarn\bin\;"'
2 changes: 1 addition & 1 deletion .github/angular-robot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ merge:

# list of PR statuses that need to be successful
requiredStatuses:
- "continuous-integration/appveyor/pr"
- "ci/circleci: build"
- "ci/circleci: build-bazel"
- "ci/circleci: install"
- "ci/circleci: lint"
- "ci/circleci: validate"
- "ci/circleci: test"
- "ci/circleci: test-win"
- "ci/circleci: test-large"

# the comment that will be added when the merge label is added despite failing checks, leave empty or set to false to disable
Expand Down
12 changes: 0 additions & 12 deletions appveyor-e2e.bat

This file was deleted.

6 changes: 3 additions & 3 deletions lib/bootstrap-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ const oldRequireTs = require.extensions['.ts'];
require.extensions['.ts'] = function (m, filename) {
// If we're in node module, either call the old hook or simply compile the
// file without transpilation. We do not touch node_modules/**.
// We do touch `Angular DevK` files anywhere though.
if (!filename.match(/@angular\/cli\b/) && filename.match(/node_modules/)) {
// To account for Yarn workspaces symlinks, we much check the real path.
if (fs.realpathSync(filename).match(/node_modules/)) {
if (oldRequireTs) {
return oldRequireTs(m, filename);
}
return m._compile(fs.readFileSync(filename), filename);
return m._compile(fs.readFileSync(filename).toString(), filename);
}

debugBuildTs(filename);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"url": "https://github.com/angular/angular-cli.git"
},
"engines": {
"node": ">=10.9.0 <11.0.0",
"node": ">=10.9.0 <13.0.0",
"yarn": ">=1.9.0 <2.0.0"
},
"author": "Angular Authors",
Expand Down
Loading