fix bazel cache use on CI (#17363)

This commit is contained in:
Gary Verhaegen 2023-09-05 18:51:18 +02:00 committed by GitHub
parent 430b8cec6b
commit a87818464e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 11 deletions

View File

@ -1,7 +1,7 @@
# Bazel distributed cache, can be temporarily disabled by passing the following
# flag: --noremote_accept_cached
build:darwin --remote_cache=https://bazel-cache.da-ext.net/macos/202308
build:linux --remote_cache=https://bazel-cache.da-ext.net/ubuntu/202308
build:darwin --remote_cache=https://storage.googleapis.com/daml-bazel-cache/macos/202308
build:linux --remote_cache=https://storage.googleapis.com/daml-bazel-cache/ubuntu/202308
# Don't push local build results to the remote cache.
build --remote_upload_local_results=false
# Do still push local build results to the local disk cache.

View File

@ -40,7 +40,7 @@ else
fi
# Bazel test only builds targets that are dependencies of a test suite so do a full build first.
$bazel build //... \
$bazel build //compiler/... \
--build_tag_filters "${tag_filter:1}" \
--profile build-profile.json \
--experimental_profile_include_target_label \
@ -79,7 +79,7 @@ stop_postgresql # in case it's running from a previous build
start_postgresql
# Run the tests.
$bazel test //... \
$bazel test //compiler/... \
--build_tag_filters "${tag_filter:1}" \
--test_tag_filters "${tag_filter:1}" \
--test_env "POSTGRESQL_HOST=${POSTGRESQL_HOST}" \

View File

@ -22,10 +22,10 @@ cd "$(dirname "$0")/.."
# detect the OS
case $(uname) in
Linux)
os=linux
os=ubuntu
;;
Darwin)
os=darwin
os=macos
;;
MINGW*)
os=windows
@ -76,7 +76,9 @@ if is_windows; then
# We include an extra version at the end that we can bump manually.
CACHE_SUFFIX="$SUFFIX-v14"
CACHE_URL="$CACHE_URL/$CACHE_SUFFIX"
echo "build:windows-ci --remote_cache=https://bazel-cache.da-ext.net/$CACHE_SUFFIX" >> .bazelrc.local
echo "build:windows-ci --remote_cache=https://storage.googleapis.com/daml-bazel-cache/$CACHE_SUFFIX" >> .bazelrc.local
else
CACHE_URL="$CACHE_URL/$os/202308"
fi
# sets up write access to the shared remote cache if the branch is not a fork
@ -86,5 +88,5 @@ if [[ "${IS_FORK}" = False ]]; then
echo "$GOOGLE_APPLICATION_CREDENTIALS_CONTENT" > "$GOOGLE_APPLICATION_CREDENTIALS"
unset GOOGLE_APPLICATION_CREDENTIALS_CONTENT
export GOOGLE_APPLICATION_CREDENTIALS
echo "build --remote_cache=$CACHE_URL --remote_upload_local_results=true --google_credentials=${GOOGLE_APPLICATION_CREDENTIALS}" >> .bazelrc.local
echo "build --remote_cache=\"$CACHE_URL\" --remote_upload_local_results=true --google_credentials=${GOOGLE_APPLICATION_CREDENTIALS}" >> .bazelrc.local
fi

View File

@ -157,5 +157,5 @@ gsCachePath mbSuffix = "gs://daml-bazel-cache/" <> suffix <> "/ac/*"
where suffix = fromMaybe "*-v*" mbSuffix
cacheUrl :: String -> String
cacheUrl path = "https://bazel-cache.da-ext.net/" <> path
cacheUrl path = "https://storage.googleapis.com/daml-bazel-cache/" <> path

View File

@ -1,7 +1,7 @@
# Bazel distributed cache, can be temporarily disabled by passing the following
# flag: --noremote_accept_cached
build:darwin --remote_cache=https://bazel-cache.da-ext.net/macos/202308
build:linux --remote_cache=https://bazel-cache.da-ext.net/ubuntu/202308
build:darwin --remote_cache=https://storage.googleapis.com/daml-bazel-cache/macos/202308
build:linux --remote_cache=https://storage.googleapis.com/daml-bazel-cache/ubuntu/202308
# Don't push local build results to the remote cache.
build --remote_upload_local_results=false
# Do still push local build results to the local disk cache.