Files
eagle0/scripts/check_bazel_remote_cache_parity.sh
T

64 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
usage() {
echo "Usage: $0 <warm|verify> [bazel targets...]"
echo
echo "warm: build targets normally so local results can upload to the remote cache"
echo "verify: require all target actions to be available from remote cache"
}
if [ "$#" -lt 1 ]; then
usage
exit 2
fi
mode="$1"
shift
case "$mode" in
warm | verify)
;;
*)
usage
exit 2
;;
esac
tmp_root="${RUNNER_TEMP:-/private/tmp}"
run_id="${GITHUB_RUN_ID:-local}-$$"
output_base="${tmp_root%/}/eagle0-cache-parity-${mode}-${run_id}"
echo "Mode: $mode"
echo "Output base: $output_base"
run_bazel() {
echo "Bazel args:"
printf ' %s\n' "$@"
local bazel_args=(
"--output_base=$output_base"
"build"
"--remote_download_all"
)
if [ "$mode" = "verify" ]; then
bazel_args+=(
"--remote_upload_local_results=false"
"--experimental_remote_require_cached"
"--disk_cache="
)
fi
bazel "${bazel_args[@]}" "$@"
}
if [ "$#" -gt 0 ]; then
run_bazel "$@"
exit 0
fi
run_bazel //src/main/scala/net/eagle0/eagle:eagle_server
run_bazel -c opt //src/main/cpp/net/eagle0/shardok:shardok-server