mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[build][bazel] Combine remote setup CI actions (#8893)
When the bazel remote cache was switched from buildbuddy to a self hosted server in #8342, I asked that the buildbuddy hooks be remain so that I could still use their caching service for local builds. The downside of this was that my forks builds aren't leveraging buildbuddy, so if I'm fiddling with something heavy like a wpimath robotpy thing, my CI builds never update a cache and never are warm when I push fixups. This PR combines the `setup-bazel-remote` and `setup-build-buddy` actions which set up the bazel remote cache. Rather than having two different version, the correct one will be choosen in the following order: 1. Use wpi's server with write access if the `bazel_remote` information is set (This basically would only happen on main branch in `wpilibsuite/allwpilib` since secrets aren't accessible from builds originating in forks) 2. Use buildbuddy if the key it is present (This would work for my fork builds) 3. Fall back to the readonly version of wpi's server As seen [here](https://github.com/bzlmodRio/allwpilib/actions/runs/25777428163/job/75712863120#step:7:28) the build in my fork will run with buildbuddy, and my PR's build here should fall back to readonly mode.
This commit is contained in:
34
.github/workflows/bazel.yml
vendored
34
.github/workflows/bazel.yml
vendored
@@ -66,11 +66,12 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
with: { fetch-depth: 0 }
|
||||
|
||||
- id: Setup_bazel_remote
|
||||
uses: ./.github/actions/setup-bazel-remote
|
||||
- id: Setup_bazel_cache
|
||||
uses: ./.github/actions/setup-bazel-cache
|
||||
with:
|
||||
username: ${{ secrets.BAZEL_CACHE_USERNAME }}
|
||||
password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
|
||||
bazel_remote_username: ${{ secrets.BAZEL_CACHE_USERNAME }}
|
||||
bazel_remote_password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
|
||||
buildbuddy_token: ${{ secrets.BUILDBUDDY_API_KEY }}
|
||||
|
||||
- name: Install apt dependencies
|
||||
if: runner.os == 'Linux'
|
||||
@@ -165,14 +166,15 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
with: { fetch-depth: 0 }
|
||||
|
||||
- id: Setup_bazel_remote
|
||||
uses: ./.github/actions/setup-bazel-remote
|
||||
- id: Setup_bazel_cache
|
||||
uses: ./.github/actions/setup-bazel-cache
|
||||
with:
|
||||
username: ${{ secrets.BAZEL_CACHE_USERNAME }}
|
||||
password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
|
||||
bazel_remote_username: ${{ secrets.BAZEL_CACHE_USERNAME }}
|
||||
bazel_remote_password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
|
||||
buildbuddy_token: ${{ secrets.BUILDBUDDY_API_KEY }}
|
||||
|
||||
- name: Run Non-RobotPy pregeneration
|
||||
run: bazel run //:write_pregenerated_files
|
||||
run: bazel run --config=ci //:write_pregenerated_files
|
||||
|
||||
- name: Check Output
|
||||
run: git --no-pager diff --exit-code HEAD
|
||||
@@ -194,21 +196,23 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
with: { fetch-depth: 0 }
|
||||
|
||||
- id: Setup_build_buddy
|
||||
uses: ./.github/actions/setup-build-buddy
|
||||
- id: Setup_bazel_cache
|
||||
uses: ./.github/actions/setup-bazel-cache
|
||||
with:
|
||||
token: ${{ secrets.BUILDBUDDY_API_KEY }}
|
||||
bazel_remote_username: ${{ secrets.BAZEL_CACHE_USERNAME }}
|
||||
bazel_remote_password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
|
||||
buildbuddy_token: ${{ secrets.BUILDBUDDY_API_KEY }}
|
||||
|
||||
# You should ensure the headers are correct before trying to pregen files
|
||||
- name: Test Scan Headers
|
||||
run: bazel test //... -k --test_tag_filters=robotpy_scan_headers --build_tests_only
|
||||
run: bazel test --config=ci //... -k --test_tag_filters=robotpy_scan_headers --build_tests_only
|
||||
shell: bash
|
||||
|
||||
- name: Run yaml file generation
|
||||
run: bazel run //:write_robotpy_update_yaml_files
|
||||
run: bazel run --config=ci //:write_robotpy_update_yaml_files
|
||||
|
||||
- name: Run build file generation
|
||||
run: bazel run //:write_robotpy_generated_pybind_files
|
||||
run: bazel run --config=ci //:write_robotpy_generated_pybind_files
|
||||
|
||||
- name: Check Output
|
||||
run: git --no-pager diff --exit-code HEAD
|
||||
|
||||
Reference in New Issue
Block a user