mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 21:35:42 +00:00
Use CI build scripts for cache parity (#7120)
This commit is contained in:
@@ -2,4 +2,12 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
bazel build //src/main/scala/net/eagle0/eagle:eagle_server
|
bazel_cmd=(bazel)
|
||||||
|
if [ -n "${BAZEL_OUTPUT_USER_ROOT:-}" ]; then
|
||||||
|
bazel_cmd+=("--output_user_root=${BAZEL_OUTPUT_USER_ROOT}")
|
||||||
|
fi
|
||||||
|
if [ -n "${BAZEL_OUTPUT_BASE:-}" ]; then
|
||||||
|
bazel_cmd+=("--output_base=${BAZEL_OUTPUT_BASE}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
"${bazel_cmd[@]}" build "$@" //src/main/scala/net/eagle0/eagle:eagle_server
|
||||||
|
|||||||
@@ -2,4 +2,12 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
bazel build -c opt //src/main/cpp/net/eagle0/shardok:shardok-server
|
bazel_cmd=(bazel)
|
||||||
|
if [ -n "${BAZEL_OUTPUT_USER_ROOT:-}" ]; then
|
||||||
|
bazel_cmd+=("--output_user_root=${BAZEL_OUTPUT_USER_ROOT}")
|
||||||
|
fi
|
||||||
|
if [ -n "${BAZEL_OUTPUT_BASE:-}" ]; then
|
||||||
|
bazel_cmd+=("--output_base=${BAZEL_OUTPUT_BASE}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
"${bazel_cmd[@]}" build -c opt "$@" //src/main/cpp/net/eagle0/shardok:shardok-server
|
||||||
|
|||||||
@@ -28,18 +28,26 @@ esac
|
|||||||
|
|
||||||
tmp_root="${RUNNER_TEMP:-/private/tmp}"
|
tmp_root="${RUNNER_TEMP:-/private/tmp}"
|
||||||
run_id="${GITHUB_RUN_ID:-local}-$$"
|
run_id="${GITHUB_RUN_ID:-local}-$$"
|
||||||
|
output_user_root="${tmp_root%/}/eagle0-bazel-user-root-${run_id}"
|
||||||
output_base="${tmp_root%/}/eagle0-cache-parity-${mode}-${run_id}"
|
output_base="${tmp_root%/}/eagle0-cache-parity-${mode}-${run_id}"
|
||||||
|
|
||||||
echo "Mode: $mode"
|
echo "Mode: $mode"
|
||||||
|
echo "Output user root: $output_user_root"
|
||||||
echo "Output base: $output_base"
|
echo "Output base: $output_base"
|
||||||
|
|
||||||
run_bazel() {
|
run_ci_build_script() {
|
||||||
echo "Bazel args:"
|
local script="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
echo "Build script: $script"
|
||||||
|
echo "Build args:"
|
||||||
printf ' %s\n' "$@"
|
printf ' %s\n' "$@"
|
||||||
|
|
||||||
|
BAZEL_OUTPUT_USER_ROOT="$output_user_root" BAZEL_OUTPUT_BASE="$output_base" "$script" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
cache_check_args() {
|
||||||
local bazel_args=(
|
local bazel_args=(
|
||||||
"--output_base=$output_base"
|
|
||||||
"build"
|
|
||||||
"--remote_download_all"
|
"--remote_download_all"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -51,13 +59,29 @@ run_bazel() {
|
|||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bazel "${bazel_args[@]}" "$@"
|
printf '%s\n' "${bazel_args[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
run_bazel_targets() {
|
||||||
|
bazel_args=()
|
||||||
|
while IFS= read -r arg; do
|
||||||
|
bazel_args+=("$arg")
|
||||||
|
done < <(cache_check_args)
|
||||||
|
|
||||||
|
echo "Bazel args:"
|
||||||
|
printf ' %s\n' "${bazel_args[@]}" "$@"
|
||||||
|
|
||||||
|
bazel "--output_user_root=$output_user_root" "--output_base=$output_base" build "${bazel_args[@]}" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$#" -gt 0 ]; then
|
if [ "$#" -gt 0 ]; then
|
||||||
run_bazel "$@"
|
run_bazel_targets "$@"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run_bazel //src/main/scala/net/eagle0/eagle:eagle_server
|
bazel_args=()
|
||||||
run_bazel -c opt //src/main/cpp/net/eagle0/shardok:shardok-server
|
while IFS= read -r arg; do
|
||||||
|
bazel_args+=("$arg")
|
||||||
|
done < <(cache_check_args)
|
||||||
|
run_ci_build_script scripts/build_eagle_ci.sh "${bazel_args[@]}"
|
||||||
|
run_ci_build_script scripts/build_shardok_ci.sh "${bazel_args[@]}"
|
||||||
|
|||||||
Reference in New Issue
Block a user