Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/actions/setup-bazel-self-hosted/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Licensed under the Apache-2.0 license

name: 'Setup Bazel (Self-Hosted)'
description: 'Configure Bazel for self-hosted runners with local persistent caching'
runs:
using: "composite"
steps:
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: false
disk-cache: false
repository-cache: false
output-base: ${{ runner.workspace }}/.bazel
bazelrc: |
build --disk_cache=/home/github-runner/.cache/bazel-disk
common --repository_cache=/home/github-runner/.cache/bazel-repo
Comment on lines +15 to +17

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can control which file this gets written to (e.g. self-hosted.bazelrc), we could use a try-import in the project's .bazelrc to import it if-and-only-if it exists.

In our .bazelrc, we'd add something like this:

# User bazelrc file
# =================
# See https://bazel.build/configure/best-practices#bazelrc-file
#
# Note: this should be at the bottom of the file, so that user-specified
# options override anything in this file
# (https://bazel.build/run/bazelrc#imports)
try-import %workspace%/self-hosted.bazelrc

18 changes: 3 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ jobs:
- uses: actions/checkout@v6

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: false
disk-cache: false
repository-cache: false
uses: ./.github/actions/setup-bazel-self-hosted

- name: Presubmit Checks
# The presubmit workflow performs formatting checks, license checks
Expand All @@ -40,11 +36,7 @@ jobs:
- uses: actions/checkout@v6

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: false
disk-cache: false
repository-cache: false
uses: ./.github/actions/setup-bazel-self-hosted

- name: Run tests
# See workflows.json for the `ci` definition.
Expand All @@ -59,11 +51,7 @@ jobs:
- uses: actions/checkout@v6

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: false
disk-cache: false
repository-cache: false
uses: ./.github/actions/setup-bazel-self-hosted

- name: Build
# See workflows.json for the `default` definition.
Expand Down