Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 0d436fd

Browse files
authored
Travis: cache bazel builds between runs. (#181)
1 parent fd9ac51 commit 0d436fd

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

.travis.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,32 @@ matrix:
99
env: BAZEL_OS=darwin
1010

1111
compiler: clang
12+
13+
# - Limit memory.
14+
# - Enable thread safety analysis (only works with clang).
1215
env: BAZEL_OPTIONS="--local_resources=4096,2,1.0 --copt=-Werror=thread-safety"
1316

17+
cache:
18+
directories:
19+
- $HOME/bazel-cache
20+
1421
before_install:
1522
# OS X does not have clang-format by default, and has a different sed.
1623
- if \[ "$TRAVIS_OS_NAME" == "linux" \]; then
1724
tools/format.sh ;
1825
fi
19-
- wget https://github.com/bazelbuild/bazel/releases/download/0.11.1/bazel-0.11.1-installer-${BAZEL_OS}-x86_64.sh
20-
- chmod +x bazel-0.11.1-installer-${BAZEL_OS}-x86_64.sh
21-
- ./bazel-0.11.1-installer-${BAZEL_OS}-x86_64.sh --user
26+
- wget https://github.com/bazelbuild/bazel/releases/download/0.17.1/bazel-0.17.1-installer-${BAZEL_OS}-x86_64.sh
27+
- chmod +x bazel-0.17.1-installer-${BAZEL_OS}-x86_64.sh
28+
- ./bazel-0.17.1-installer-${BAZEL_OS}-x86_64.sh --user
29+
- echo "build --disk_cache=$HOME/bazel-cache" > ~/.bazelrc
30+
- echo "build --experimental_strict_action_env" >> ~/.bazelrc
2231

2332
script:
24-
# We can't use --noshow_progress because Travis terminates the
25-
# build after 10 mins without output.
33+
# Limit the amount of progress output. We can't use --noshow_progress because
34+
# Travis terminates the build after 10 mins without output.
2635
- bazel build $BAZEL_OPTIONS --experimental_ui_actions_shown=1 -k $(bazel query "kind(rule, //...)" | grep -v :_)
2736
- bazel test $BAZEL_OPTIONS --experimental_ui_actions_shown=1 -k $(bazel query "kind(test, //...) except attr('tags', 'manual|noci', //...)" | grep -v :_)
37+
38+
before_cache:
39+
# Before uploading cache.
40+
- du -sk $HOME/bazel-cache

0 commit comments

Comments
 (0)