Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
build: use bazel disk_cache (#1408)
Browse files Browse the repository at this point in the history
* ci: rename cache key

* ci: remove unneeded yarn install since it's already run in previous step

* build: set `noshow_progress`, `announce_rc` and `repository_cache` bazel flags

* ci: add disk_cache

* ci: add `--incompatible_strict_action_env`

* ci: update cache key
  • Loading branch information
alan-agius4 authored and vikerman committed Dec 19, 2019
1 parent 192c479 commit 2f9ad88
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,13 @@ build --define=compile=legacy
# Turn on managed directories feature in Bazel
# This allows us to avoid installing a second copy of node_modules
common --experimental_allow_incremental_repository_updates

# Turn on --incompatible_strict_action_env which was on by default
# in Bazel 0.21.0 but turned off again in 0.22.0. Follow
# https://github.com/bazelbuild/bazel/issues/7026 for more details.
# This flag is needed to so that the bazel cache is not invalidated
# when running bazel via `yarn bazel`.
# See https://github.com/angular/angular/issues/27514.
build --incompatible_strict_action_env
run --incompatible_strict_action_env
test --incompatible_strict_action_env
12 changes: 11 additions & 1 deletion .circleci/bazel.rc
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
# Echo all the configuration settings and their source
build --announce_rc

# Don't be spammy in the logs
build --noshow_progress

# Bazel configuration that will be copied to /etc/bazel.bazelrc in CircleCI containers.
# This allows us adding specific configuration flags for builds within CircleCI.
# See more: https://docs.bazel.build/versions/master/user-manual.html#where-are-the-bazelrc-files

# Save downloaded repositories in a location that can be cached by CircleCI. This helps us
# speeding up the analysis time significantly with Bazel managed node dependencies on the CI.
build --experimental_repository_cache=/home/circleci/bazel_repository_cache
build --repository_cache=/home/circleci/bazel_repository_cache

# Retry in the event of flakes, eg. https://circleci.com/gh/angular/universal/1768
test --flaky_test_attempts=2

# More details on failures
build --verbose_failures=true

# Setup disk cache
build --disk_cache=/home/circleci/bazel_disk_cache
test --disk_cache=/home/circleci/bazel_disk_cache
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# (Using the tag in not necessary when pinning by ID, but include it anyway for documentation purposes.)
# **NOTE 2**: If you change the version of the docker images, also change the `cache_key` suffix.
var_1: &docker_image circleci/node:10.16-browsers@sha256:d2a96fe1cbef51257ee626b5f645e64dade3e886f00ba9cb7e8ea65b4efe8db1
var_2: &cache_key v2-nguniversal-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-node-10.16
var_2: &cache_key v7-nguniversal-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-node-10.16

# Settings common to each job
var_3: &job_defaults
Expand Down Expand Up @@ -45,6 +45,7 @@ var_6: &save_cache
paths:
- "node_modules"
- "~/bazel_repository_cache"
- "~/bazel_disk_cache"

# Job step that ensures that the node module dependencies are installed and up-to-date. We use
# Yarn with the frozen lockfile option in order to make sure that lock file and package.json are
Expand Down Expand Up @@ -120,7 +121,7 @@ jobs:
steps:
- *checkout_code
- *restore_cache
- *yarn_install
- *copy_bazel_config

- run: scripts/build-modules-dist.sh

Expand All @@ -143,7 +144,6 @@ jobs:
- *checkout_code
- *restore_cache
- *setup_env_variables
- *yarn_install
- *attach_release_output
- run: ./integration/run_tests.sh

Expand Down

0 comments on commit 2f9ad88

Please sign in to comment.