From 0d9d5679fd8bbec4f4e03a7d98b6d0d499050ac1 Mon Sep 17 00:00:00 2001 From: Milan Vukov Date: Sat, 29 Apr 2023 19:53:12 +0200 Subject: [PATCH] Add remote config for CI (#104) --- .github/workflows/ci.bazelrc | 20 ++++++++++---------- .github/workflows/main.yml | 10 ++++++++-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.bazelrc b/.github/workflows/ci.bazelrc index a897c44f..931eb768 100644 --- a/.github/workflows/ci.bazelrc +++ b/.github/workflows/ci.bazelrc @@ -7,18 +7,18 @@ build --announce_rc build --repository_cache=~/.cache/bazel-repo # Set up remote cache. -build --bes_results_url=https://app.buildbuddy.io/invocation/ -build --bes_backend=grpcs://remote.buildbuddy.io -build --remote_cache=grpcs://remote.buildbuddy.io -build --remote_timeout=3600 -build --remote_download_toplevel -build --experimental_remote_cache_compression +build:remote --bes_results_url=https://app.buildbuddy.io/invocation/ +build:remote --bes_backend=grpcs://remote.buildbuddy.io +build:remote --remote_cache=grpcs://remote.buildbuddy.io +build:remote --remote_timeout=3600 +build:remote --remote_download_toplevel +build:remote --experimental_remote_cache_compression # buildbuddy suggestions: -build --experimental_profile_include_primary_output -build --experimental_profile_include_target_label -build --experimental_remote_build_event_upload=minimal -build --noslim_profile +build:remote --experimental_profile_include_primary_output +build:remote --experimental_profile_include_target_label +build:remote --experimental_remote_build_event_upload=minimal +build:remote --noslim_profile # Don't spam CI logs. build --show_progress_rate_limit=60 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f306408d..6c533a10 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -79,8 +79,14 @@ jobs: env: # Bazelisk will download bazel to here, ensure it is cached between runs. XDG_CACHE_HOME: ~/.cache/bazel-repo + BUILDBUDDY_ORG_API_KEY: ${{ secrets.BUILDBUDDY_ORG_API_KEY }} working-directory: ${{ matrix.folder }} run: | + if [[ ! -z "${BUILDBUDDY_ORG_API_KEY}" ]]; then + BAZEL_REMOTE_CONFIG=( + --config=remote + --remote_header=x-buildbuddy-api-key="${BUILDBUDDY_ORG_API_KEY}" + ) + fi bazel --bazelrc=$GITHUB_WORKSPACE/.github/workflows/ci.bazelrc --bazelrc=.bazelrc \ - test ${{ matrix.config_option }} //... \ - --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} + test "${BAZEL_REMOTE_CONFIG[@]}" ${{ matrix.config_option }} //...