From a1efc27ff2de3a443cea4941fab940b4d76903f7 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Wed, 7 Mar 2018 17:26:03 -0800 Subject: [PATCH] ci: double our cores on CircleCI (#22641) This should cut our build time in ~half, assuming it's widely parallel. See https://circleci.com/docs/2.0/configuration-reference/#resource_class Also enable bazel repository caching, and store the external repositories in the CircleCI cache for later builds. PR Close #22641 --- .circleci/bazel.rc | 9 +++++++-- .circleci/config.yml | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.circleci/bazel.rc b/.circleci/bazel.rc index 921c6293cf..58e0802184 100644 --- a/.circleci/bazel.rc +++ b/.circleci/bazel.rc @@ -15,11 +15,16 @@ build --experimental_remote_spawn_cache --remote_rest_cache=http://localhost:764 # Prevent unstable environment variables from tainting cache keys build --experimental_strict_action_env +# Save downloaded repositories such as the go toolchain +# This directory can then be included in the CircleCI cache +# It should save time running the first build +build --experimental_repository_cache=/home/circleci/bazel_repository_cache + # Workaround https://github.com/bazelbuild/bazel/issues/3645 # Bazel doesn't calculate the memory ceiling correctly when running under Docker. -# Limit Bazel to consuming resources that fit in CircleCI "medium" class which is the default: +# Limit Bazel to consuming resources that fit in CircleCI "xlarge" class # https://circleci.com/docs/2.0/configuration-reference/#resource_class -build --local_resources=3072,2.0,1.0 +build --local_resources=14336,8.0,1.0 # Retry in the event of flakes, eg. https://circleci.com/gh/angular/angular/31309 test --flaky_test_attempts=2 diff --git a/.circleci/config.yml b/.circleci/config.yml index dcc04f93e1..74d5260504 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,7 +13,7 @@ # 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. var_1: &docker_image angular/ngcontainer:0.1.0 -var_2: &cache_key angular-{{ .Branch }}-{{ checksum "yarn.lock" }}-0.1.0 +var_2: &cache_key v2-angular-{{ .Branch }}-{{ checksum "yarn.lock" }}-0.1.0 # See remote cache documentation in /docs/BAZEL.md var_3: &setup-bazel-remote-cache @@ -59,7 +59,7 @@ jobs: build: <<: *job_defaults - resource_class: large + resource_class: xlarge steps: - checkout: <<: *post_checkout @@ -71,6 +71,7 @@ jobs: - restore_cache: key: *cache_key + - run: ls /home/circleci/bazel_repository_cache || true - run: bazel info release - run: bazel run @yarn//:yarn # Use bazel query so that we explicitly ask for all buildable targets to be built as well @@ -82,6 +83,7 @@ jobs: key: *cache_key paths: - "node_modules" + - "~/bazel_repository_cache" workflows: version: 2