Skip to content

Commit c07fbf6

Browse files
alan-agius4angular-robot[bot]
authored andcommitted
ci: enable HTTP caching for Bazel on Windows
This commit enables Bazel HTTP caching for Windows runs. Before: ``` bazel-e2e-cli-win: 22m 39s ``` After: ``` bazel-e2e-cli-win: 8m 32s ```
1 parent 56423f0 commit c07fbf6

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed
File renamed without changes.

.circleci/bazel.linux.rc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Import config items common to both Linux and Windows setups.
2+
# https://docs.bazel.build/versions/master/guide.html#bazelrc-syntax-and-semantics
3+
import %workspace%/.circleci/bazel.common.rc
4+
5+
build --config=remote

.circleci/bazel.windows.rc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Import config items common to both Linux and Windows setups.
2+
# https://docs.bazel.build/versions/master/guide.html#bazelrc-syntax-and-semantics
3+
import %workspace%/.circleci/bazel.common.rc
4+
5+
build --remote_cache=https://storage.googleapis.com/angular-cli-windows-bazel-cache
6+
build --remote_accept_cached=true
7+
build --remote_upload_local_results=true
8+
build --google_default_credentials

.circleci/dynamic_config.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,19 @@ commands:
144144
type: env_var_name
145145
default: CIRCLE_PROJECT_REPONAME
146146
steps:
147-
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
147+
- run:
148+
name: 'Copy Bazel RC'
149+
shell: bash
150+
command: |
151+
# Conditionally, copy bazel configuration based on the current VM
152+
# operating system running. We detect Windows by checking for `%AppData%`.
153+
if [[ -n "${APPDATA}" ]]; then
154+
cp "./.circleci/bazel.windows.rc" ".bazelrc.user";
155+
else
156+
cp "./.circleci/bazel.linux.rc" ".bazelrc.user";
157+
fi
148158
- devinfra/setup-bazel-remote-exec:
149-
bazelrc: ./.bazelrc.user
159+
shell: bash
150160

151161
install_python:
152162
steps:
@@ -307,7 +317,6 @@ jobs:
307317
steps:
308318
- custom_attach_workspace
309319
- setup_bazel_rbe
310-
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
311320
- when:
312321
# The default nodeversion runs all *excluding* other versions
313322
condition:
@@ -454,6 +463,7 @@ jobs:
454463
- checkout
455464
- rebase_pr_win
456465
- setup_windows
466+
- setup_bazel_rbe
457467
- restore_cache:
458468
keys:
459469
- *cache_key_win

0 commit comments

Comments
 (0)