[bazel] Use the new gitlib-bazel.wpi.edu cache server (#8342)

This is owned by WPI, so we can make it as big or small as we want.
This lets us check in more of the bazel build.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
This commit is contained in:
Austin Schuh
2025-11-08 16:59:26 -08:00
committed by GitHub
parent 5c9c45fadb
commit 04fb95a897
3 changed files with 76 additions and 24 deletions

View File

@@ -1,4 +1,3 @@
try-import %workspace%/bazel_auth.rc
try-import %workspace%/user.bazelrc
common --noenable_bzlmod --enable_workspace
@@ -37,15 +36,19 @@ build:no_example --test_tag_filters=-wpi-example --build_tag_filters=-wpi-exampl
test:no_example --test_tag_filters=-wpi-example --build_tag_filters=-wpi-example
common:skip_robotpy --test_tag_filters=-robotpy --build_tag_filters=-robotpy
# Build Buddy Cache Setup
build:build_buddy --bes_results_url=https://app.buildbuddy.io/invocation/
build:build_buddy --bes_backend=grpcs://remote.buildbuddy.io
build:build_buddy --remote_cache=grpcs://remote.buildbuddy.io
build:build_buddy --remote_timeout=3600
# Build Buddy BES Setup
build:build_buddy_bes --bes_results_url=https://app.buildbuddy.io/invocation/
build:build_buddy_bes --bes_backend=grpcs://remote.buildbuddy.io
# Additional suggestions from buildbuddy for speed
build:build_buddy --experimental_remote_cache_compression
build:build_buddy --experimental_remote_cache_compression_threshold=100
# Common Cache Settings
build:common_cache --remote_timeout=3600
build:common_cache --remote_cache_compression
build:common_cache --experimental_remote_cache_compression_threshold=100
# Build Buddy Cache Setup
build:build_buddy --config=common_cache
build:build_buddy --config=build_buddy_bes
build:build_buddy --remote_cache=grpcs://remote.buildbuddy.io
build:build_buddy --noslim_profile
build:build_buddy --experimental_profile_include_target_label
build:build_buddy --experimental_profile_include_primary_output
@@ -53,13 +56,20 @@ build:build_buddy --nolegacy_important_outputs
common:build_buddy_readonly --noremote_upload_local_results
# Bazel-remote cache setup
build:remote_cache --config=common_cache
build:remote_cache --remote_cache=grpcs://gitlib-bazel.wpi.edu
common:remote_cache_readonly --noremote_upload_local_results
# This config should be used locally. It downloads more than the CI version
build:remote_user --config=build_buddy
build:remote_user --config=build_buddy_readonly
build:remote_user --config=remote_cache
build:remote_user --config=remote_cache_readonly
build:remote_user --remote_download_toplevel
build:ci --config=build_buddy
build:ci --config=remote_cache
build:ci --remote_download_minimal
build:ci --progress_report_interval=60 --show_progress_rate_limit=60
build --build_metadata=REPO_URL=https://github.com/wpilibsuite/allwpilib.git
@@ -73,3 +83,5 @@ common:ci --repo_env="WPI_PUBLISH_CLASSIFIER_FILTER=headers,sources,linuxsystemc
# Instead, skip the cross transition for ARM on x86, and the reverse on x86.
common:ci_windows_x86 --repo_env="WPI_PUBLISH_CLASSIFIER_FILTER=headers,sources,linuxsystemcore,linuxsystemcoredebug,linuxsystemcorestatic,linuxsystemcorestaticdebug,linuxx86-64,linuxx86-64debug,linuxx86-64static,linuxx86-64staticdebug,osxuniversal,osxuniversaldebug,osxuniversalstatic,osxuniversalstaticdebug,windowsx86-64,windowsx86-64debug,windowsx86-64static,windowsx86-64staticdebug"
common:ci_windows_arm --repo_env="WPI_PUBLISH_CLASSIFIER_FILTER=headers,sources,linuxsystemcore,linuxsystemcoredebug,linuxsystemcorestatic,linuxsystemcorestaticdebug,linuxx86-64,linuxx86-64debug,linuxx86-64static,linuxx86-64staticdebug,osxuniversal,osxuniversaldebug,osxuniversalstatic,osxuniversalstaticdebug,windowsarm64,windowsarm64debug,windowsarm64static,windowsarm64staticdebug"
try-import %workspace%/bazel_auth.rc

View File

@@ -0,0 +1,37 @@
name: 'Setup Bazel Remote cache'
description: 'Sets up bazel-remote cache using basic auth from GitHub secrets'
inputs:
username:
description: 'Bazel remote cache username'
password:
description: 'Bazel remote cache password'
remote_url:
description: 'Bazel remote cache base URL (no credentials or protocol, e.g. gitlib-bazel.wpi.edu)'
default: 'gitlib-bazel.wpi.edu'
runs:
using: "composite"
steps:
- name: Setup bazel-remote (skip when no creds)
env:
CACHE_USER: ${{ inputs.username }}
CACHE_PASS: ${{ inputs.password }}
REMOTE_URL: ${{ inputs.remote_url }}
if: ${{ env.CACHE_USER == '' || env.CACHE_PASS == '' }}
shell: bash
run: |
echo "No bazel-remote credentials detected; leaving caching as previously configured"
echo "build:ci --config=remote_cache_readonly" >> bazel_auth.rc
- name: Setup bazel-remote (with creds)
env:
CACHE_USER: ${{ inputs.username }}
CACHE_PASS: ${{ inputs.password }}
REMOTE_URL: ${{ inputs.remote_url }}
if: ${{ env.CACHE_USER != '' && env.CACHE_PASS != '' }}
shell: bash
run: |
echo "Bazel-remote credentials detected; configuring bazel_auth.rc"
URL_WITH_CREDS="grpcs://${CACHE_USER}:${CACHE_PASS}@${REMOTE_URL}"
echo "build:remote_cache --remote_cache=${URL_WITH_CREDS}" >> bazel_auth.rc

View File

@@ -26,13 +26,14 @@ jobs:
java-version: 21
architecture: x64
- id: Setup_build_buddy
uses: ./.github/actions/setup-build-buddy
- id: Setup_bazel_remote
uses: ./.github/actions/setup-bazel-remote
with:
token: ${{ secrets.BUILDBUDDY_API_KEY }}
username: ${{ secrets.BAZEL_CACHE_USERNAME }}
password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
- name: bazel ${{ matrix.action }}
run: bazel ${{ matrix.action }} -k ... --config=ci ${{ matrix.config }} --verbose_failures
run: bazel ${{ matrix.action }} ... --config=ci ${{ matrix.config }} --verbose_failures
shell: bash
build-mac:
@@ -47,13 +48,14 @@ jobs:
distribution: 'temurin'
java-version: 21
- id: Setup_build_buddy
uses: ./.github/actions/setup-build-buddy
- id: Setup_bazel_remote
uses: ./.github/actions/setup-bazel-remote
with:
token: ${{ secrets.BUILDBUDDY_API_KEY }}
username: ${{ secrets.BAZEL_CACHE_USERNAME }}
password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
- name: bazel test (release)
run: bazel test -k ... --config=ci -c opt --nojava_header_compilation --verbose_failures
run: bazel test ... --config=ci -c opt --nojava_header_compilation --verbose_failures
shell: bash
build-linux:
@@ -70,10 +72,11 @@ jobs:
with: { fetch-depth: 0 }
- uses: bazelbuild/setup-bazelisk@v3
- id: Setup_build_buddy
uses: ./.github/actions/setup-build-buddy
- id: Setup_bazel_remote
uses: ./.github/actions/setup-bazel-remote
with:
token: ${{ secrets.BUILDBUDDY_API_KEY }}
username: ${{ secrets.BAZEL_CACHE_USERNAME }}
password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
- uses: bazel-contrib/setup-bazel@0.15.0
with:
@@ -82,7 +85,7 @@ jobs:
bazelisk-version: 1.x
- name: bazel ${{ matrix.action }} (release)
run: bazel ${{ matrix.action }} ... --config=ci -c opt ${{ matrix.config }} -k --verbose_failures
run: bazel ${{ matrix.action }} ... --config=ci -c opt ${{ matrix.config }} --verbose_failures
buildifier:
name: "buildifier"