Skip to content

Commit

Permalink
Change back to buildbuddy
Browse files Browse the repository at this point in the history
  • Loading branch information
pjreiniger committed Sep 19, 2024
1 parent 6b66e31 commit b797b47
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 12 deletions.
21 changes: 19 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,26 @@ build:build_cpp --test_tag_filters=+allwpilib-build-cpp --build_tag_filters=+all
build:no_example --test_tag_filters=-wpi-example --build_tag_filters=-wpi-example
test:no_example --test_tag_filters=-wpi-example --build_tag_filters=-wpi-example

# 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

# Additional suggestions from buildbuddy for speed
build:build_buddy --experimental_remote_cache_compression
build:build_buddy --experimental_remote_cache_compression_threshold=100
build:build_buddy --noslim_profile
build:build_buddy --experimental_profile_include_target_label
build:build_buddy --experimental_profile_include_primary_output
build:build_buddy --nolegacy_important_outputs

build:build_buddy_readonly --noremote_upload_local_results

# This config should be used locally. It downloads more than the CI version
build:remote_user --config=remote
build:remote_user --config=build_buddy
build:remote_user --config=build_buddy_readonly
build:remote_user --remote_download_toplevel

# This config should be used on CI. It downloads at little as possible to complete the build
build:ci --config=build_buddy
build:ci --remote_download_minimal
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.2.0
7.3.1
27 changes: 27 additions & 0 deletions .github/actions/setup-build-buddy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Setup BuildBuddy acache'
description: 'Sets up the build buddy cache to be readonly / writing based on the presence of environment variables'

inputs:
token:
description: 'Build Buddy API token'

runs:
using: "composite"
steps:
- name: Setup without key
env:
API_KEY: ${{ inputs.token }}
if: ${{ env.API_KEY == '' }}
shell: bash
run: |
echo "No API key secret detected, will setup readonly cache"
echo "build:ci --build_buddy_readonly" > bazel_auth.rc
- name: Set with key
env:
API_KEY: ${{ inputs.token }}
if: ${{ env.API_KEY != '' }}
shell: bash
run: |
echo "API Key detected!"
echo "build:build_buddy --remote_header=x-buildbuddy-api-key=${{ env.API_KEY }}" > bazel_auth.rc
31 changes: 22 additions & 9 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ jobs:
distribution: 'zulu'
java-version: 17
architecture: x64

- name: Set artifactory cache key
run: echo "build:ci --remote_cache=https://frcmaven.wpi.edu/artifactory/wpilib-generic-cache-bazel-local" > bazel_auth.rc

- id: Setup_build_buddy
uses: ./.github/actions/setup-build-buddy
with:
token: ${{ secrets.BUILDBUDDY_API_KEY }}

- name: Build Release
run: bazel --output_user_root=C:\\bazelroot ${{ matrix.action }} -k ... --config=ci -c opt ${{ matrix.config }} --verbose_failures
Expand All @@ -51,9 +53,11 @@ jobs:
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }

- name: Set artifactory cache key
run: echo "build:ci --remote_cache=https://frcmaven.wpi.edu/artifactory/wpilib-generic-cache-bazel-local" > bazel_auth.rc

- id: Setup_build_buddy
uses: ./.github/actions/setup-build-buddy
with:
token: ${{ secrets.BUILDBUDDY_API_KEY }}

- name: Build Release
run: bazel ${{ matrix.action }} -k ... --config=ci -c opt ${{ matrix.config }} --nojava_header_compilation --verbose_failures
Expand All @@ -76,9 +80,11 @@ jobs:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: bazelbuild/setup-bazelisk@v3

- name: Set artifactory cache key
run: echo "build:ci --remote_cache=https://wpilib.jfrog.io/artifactory/wpilib-generic-cache-bazel-local" > bazel_auth.rc

- id: Setup_build_buddy
uses: ./.github/actions/setup-build-buddy
with:
token: ${{ secrets.BUILDBUDDY_API_KEY }}

- name: Build and Test Release
run: bazel ${{ matrix.action }} ... --config=ci -c opt ${{ matrix.config }} -k --verbose_failures
Expand All @@ -99,6 +105,12 @@ jobs:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: bazelbuild/setup-bazelisk@v3

- id: Setup_build_buddy
uses: ./.github/actions/setup-build-buddy
with:
token: ${{ secrets.BUILDBUDDY_API_KEY }}

- name: Build and Test
run: bazel test -k --config=ci --config=linux --config=${{ matrix.config }} //...

Expand All @@ -110,6 +122,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: 1.15.x
id: go

- name: Install Buildifier
run: |
Expand Down
11 changes: 11 additions & 0 deletions wpiutil/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ load("@rules_java//java:defs.bzl", "java_binary", "java_library")
load("@rules_python//python:defs.bzl", "py_binary")
load("//shared/bazel/rules/gen:gen-resources.bzl", "generate_resources")

cc_library(
name = "argparse-headers",
hdrs = glob([
"src/main/native/thirdparty/argparse/include/**/*",
]),
includes = ["src/main/native/thirdparty/argparse/include"],
strip_include_prefix = "src/main/native/thirdparty/argparse/include",
visibility = ["//wpiutil:__subpackages__"],
)

cc_library(
name = "expected-headers",
hdrs = glob([
Expand Down Expand Up @@ -161,6 +171,7 @@ cc_library(
strip_include_prefix = "src/main/native/include",
visibility = ["//visibility:public"],
deps = [
":argparse-headers",
":concurrentqueue-headers",
":expected-headers",
":fmtlib-headers",
Expand Down

0 comments on commit b797b47

Please sign in to comment.