daml/ci/configure-bazel.sh
Moritz Kiefer 7d36402412
Initial boilerplate for cross-version compatibility testing (#5665)
This is a first step towards testing cross-version
compatibility. It doesn’t actuall do much yet but hopefully it should
be easier to parallelize once we have the initial boilerplate in place
so ideally I’d like to address most missing things and issues in
separate PRs.

changelog_begin
changelog_end
2020-04-23 12:58:11 +02:00

61 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
cd "$(dirname "$0")/.."
## Functions
step() {
echo "step: $*" >&2
}
is_windows() {
[[ $os = windows ]]
}
## Main
# always run in the project root
cd "$(dirname "$0")/.."
# detect the OS
case $(uname) in
Linux)
os=linux
;;
Darwin)
os=darwin
;;
MINGW*)
os=windows
;;
*)
echo "unknown kernel: $(uname)"
exit 1
;;
esac
cd "$(dirname "$0")"/..
step "configuring bazel"
if [ ! -z "${BAZEL_CONFIG_DIR:-}" ]; then
cd "$BAZEL_CONFIG_DIR"
fi
if is_windows; then
echo "build --config windows" > .bazelrc.local
echo "build --config windows-ci" >> .bazelrc.local
fi
# sets up write access to the shared remote cache if the branch is not a fork
if [[ "${IS_FORK}" = False ]]; then
step "configuring write access to the remote cache"
GOOGLE_APPLICATION_CREDENTIALS=$(mktemp .tmp.XXXXXXXXXX)
echo "$GOOGLE_APPLICATION_CREDENTIALS_CONTENT" > "$GOOGLE_APPLICATION_CREDENTIALS"
unset GOOGLE_APPLICATION_CREDENTIALS_CONTENT
export GOOGLE_APPLICATION_CREDENTIALS
echo "build --remote_http_cache=https://storage.googleapis.com/daml-bazel-cache --remote_upload_local_results=true --google_credentials=${GOOGLE_APPLICATION_CREDENTIALS}" >> .bazelrc.local
fi