Add Bazel remote cache parity check (#7077)

This commit is contained in:
2026-06-11 08:52:22 -07:00
committed by GitHub
parent 043486f890
commit ccc6953cc2
2 changed files with 119 additions and 0 deletions
+59
View File
@@ -0,0 +1,59 @@
name: Bazel Cache Parity
on:
workflow_dispatch:
schedule:
- cron: '17 11 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs:
warm-cache:
runs-on: [self-hosted, bazel]
steps:
- name: Clean workspace
run: |
git sparse-checkout disable 2>/dev/null || true
git config --local core.sparseCheckout false 2>/dev/null || true
git config --local --unset extensions.worktreeConfig 2>/dev/null || true
rm -f .git/info/sparse-checkout .git/config.worktree 2>/dev/null || true
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false
lfs: false
- name: Ensure Bazel installed
run: ./ci/github_actions/ensure_bazel_installed.sh
- name: Warm remote cache
run: ./scripts/check_bazel_remote_cache_parity.sh warm
verify-cache:
needs: warm-cache
runs-on: [self-hosted, bazel]
strategy:
fail-fast: false
matrix:
probe: [a, b]
steps:
- name: Clean workspace
run: |
git sparse-checkout disable 2>/dev/null || true
git config --local core.sparseCheckout false 2>/dev/null || true
git config --local --unset extensions.worktreeConfig 2>/dev/null || true
rm -f .git/info/sparse-checkout .git/config.worktree 2>/dev/null || true
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false
lfs: false
- name: Ensure Bazel installed
run: ./ci/github_actions/ensure_bazel_installed.sh
- name: Verify remote cache parity
run: ./scripts/check_bazel_remote_cache_parity.sh verify
+60
View File
@@ -0,0 +1,60 @@
#!/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
targets=("$@")
if [ "${#targets[@]}" -eq 0 ]; then
targets=(
"//src/main/cpp/net/eagle0/shardok/library:engine"
"//src/main/scala/net/eagle0/eagle:eagle_server"
)
fi
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"
echo "Targets:"
printf ' %s\n' "${targets[@]}"
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[@]}" "${targets[@]}"