diff --git a/.travis.yml b/.travis.yml index 8409da713..5e8fc29a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -116,7 +116,7 @@ matrix: # For the linux wheel build, we use a shared cache between all # wheels, but not between different travis runs, because that # caused timeouts in the past. See the "cache: false" line below. - - export MOUNT_BAZEL_CACHE="-v $HOME/ray-bazel-cache:/root/ray-bazel-cache -e TRAVIS=true" + - export MOUNT_BAZEL_CACHE="-v $HOME/ray-bazel-cache:/root/ray-bazel-cache -e TRAVIS=true -e TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST" # This command should be kept in sync with ray/python/README-building-wheels.md, # except the `$MOUNT_BAZEL_CACHE` part. diff --git a/ci/travis/bazel_cache_credential.json.enc b/ci/travis/bazel_cache_credential.json.enc new file mode 100644 index 000000000..ede884d9d Binary files /dev/null and b/ci/travis/bazel_cache_credential.json.enc differ diff --git a/ci/travis/install-bazel.sh b/ci/travis/install-bazel.sh index 0627bae6c..645d1c9e5 100755 --- a/ci/travis/install-bazel.sh +++ b/ci/travis/install-bazel.sh @@ -3,6 +3,8 @@ # Cause the script to exit if a single command fails set -e +ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd) + platform="unknown" unamestr="$(uname)" if [[ "$unamestr" == "Linux" ]]; then @@ -26,4 +28,17 @@ if [[ "$TRAVIS" == "true" ]]; then # Use bazel disk cache if this script is running in Travis. mkdir -p $HOME/ray-bazel-cache echo "build --disk_cache=$HOME/ray-bazel-cache" >> $HOME/.bazelrc + + # Use ray google cloud cache + echo "build --remote_cache=https://storage.googleapis.com/ray-bazel-cache" >> $HOME/.bazelrc + if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then + # If we are in master build, we can write to the cache as well. + openssl aes-256-cbc -K $encrypted_1c30b31fe1ee_key \ + -iv $encrypted_1c30b31fe1ee_iv \ + -in $ROOT_DIR/bazel_cache_credential.json.enc \ + -out $HOME/bazel_cache_credential.json -d + echo "build --google_credentials=$HOME/bazel_cache_credential.json" >> $HOME/.bazelrc + else + echo "build --remote_upload_local_results=false" >> $HOME/.bazelrc + fi fi