diff --git a/.bazelrc b/.bazelrc index 4103911d37c..cfc99909ad7 100644 --- a/.bazelrc +++ b/.bazelrc @@ -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 diff --git a/.bazelversion b/.bazelversion index 0ee843cc604..643916c03f1 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.2.0 +7.3.1 diff --git a/.github/actions/setup-build-buddy/action.yml b/.github/actions/setup-build-buddy/action.yml new file mode 100644 index 00000000000..c3b8ec3caa5 --- /dev/null +++ b/.github/actions/setup-build-buddy/action.yml @@ -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 diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index b1d64ca9e3a..98eb166b837 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -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 @@ -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 @@ -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 @@ -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 }} //... @@ -110,6 +122,7 @@ jobs: uses: actions/setup-go@v5 with: go-version: 1.15.x + id: go - name: Install Buildifier run: | diff --git a/wpiutil/BUILD.bazel b/wpiutil/BUILD.bazel index 036f1881e1b..d23d218ce49 100644 --- a/wpiutil/BUILD.bazel +++ b/wpiutil/BUILD.bazel @@ -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([ @@ -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",