diff --git a/.bazelrc b/.bazelrc index 00fadd4..ce64078 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,4 +1,14 @@ +build:bb --bes_results_url=https://app.buildbuddy.io/invocation/ +build:bb --bes_backend=grpcs://remote.buildbuddy.io +build:bb --remote_cache=grpcs://remote.buildbuddy.io +build:bb --remote_timeout=3600 +build:bb --experimental_remote_cache_compression +build:bb --experimental_remote_cache_compression_threshold=100 +build:bb --workspace_status_command=$(pwd)/workspace_status.sh + run -c opt --show_loading_progress=false --show_progress=false --ui_event_filters=error run:verbose -c dbg --show_loading_progress=true --show_progress=true --ui_event_filters=info,error,debug # https://github.com/mockito/mockito/issues/1879 test --sandbox_tmpfs_path=/tmp + +try-import /tmp/bb.bazelrc diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ad84b67..f18412d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,8 +23,12 @@ jobs: - name: Setup Bazelisk run: go install github.com/bazelbuild/bazelisk@latest && export PATH=$PATH:$(go env GOPATH)/bin - uses: actions/checkout@v4 + - name: Write BuildBuddy config + env: + BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }} + run: echo "build:bb --remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY" > /tmp/bb.bazelrc - name: Run bazel-diff tests - run: ~/go/bin/bazelisk coverage --combined_report=lcov //cli/... --enable_bzlmod=true + run: ~/go/bin/bazelisk coverage --combined_report=lcov //cli/... --enable_bzlmod=true --config=bb test-jre21: runs-on: ubuntu-latest steps: @@ -41,8 +45,12 @@ jobs: - name: Setup Bazelisk run: go install github.com/bazelbuild/bazelisk@latest && export PATH=$PATH:$(go env GOPATH)/bin - uses: actions/checkout@v4 + - name: Write BuildBuddy config + env: + BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }} + run: echo "build:bb --remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY" > /tmp/bb.bazelrc - name: Run bazel-diff tests - run: ~/go/bin/bazelisk coverage --combined_report=lcov //cli/... --enable_bzlmod=false + run: ~/go/bin/bazelisk coverage --combined_report=lcov //cli/... --enable_bzlmod=false --config=bb test-jre11-run-example: runs-on: ubuntu-latest steps: @@ -85,8 +93,12 @@ jobs: - name: Setup Bazelisk run: go install github.com/bazelbuild/bazelisk@latest && export PATH=$PATH:$(go env GOPATH)/bin - uses: actions/checkout@v4 + - name: Write BuildBuddy config + env: + BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }} + run: echo "build:bb --remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY" > /tmp/bb.bazelrc - name: Build deployable JAR - run: ~/go/bin/bazelisk build //cli:bazel-diff_deploy.jar + run: ~/go/bin/bazelisk build //cli:bazel-diff_deploy.jar --config=bb - uses: actions/upload-artifact@v4 with: name: bazel-diff_deploy.jar diff --git a/workspace_status.sh b/workspace_status.sh new file mode 100755 index 0000000..7c78543 --- /dev/null +++ b/workspace_status.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# This script will be run bazel when building process starts to +# generate key-value information that represents the status of the +# workspace. The output should be like +# +# KEY1 VALUE1 +# KEY2 VALUE2 +# +# If the script exits with non-zero code, it's considered as a failure +# and the output will be discarded. + +set -eo pipefail # exit immediately if any command fails. + +function remove_url_credentials() { + which perl >/dev/null && perl -pe 's#//.*?:.*?@#//#' || cat +} + +repo_url=$(git config --get remote.origin.url | remove_url_credentials) +echo "REPO_URL $repo_url" + +commit_sha=$(git rev-parse HEAD) +echo "COMMIT_SHA $commit_sha" + +git_branch=$(git rev-parse --abbrev-ref HEAD) +echo "GIT_BRANCH $git_branch" + +git_tree_status=$(git diff-index --quiet HEAD -- && echo 'Clean' || echo 'Modified') +echo "GIT_TREE_STATUS $git_tree_status"