Skip to content
Merged
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
18 changes: 18 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,24 @@ build:apple_on_linux --action_env=PATH=external/rules_applecross++apple_cross_to
build:apple_on_linux --action_env=RULES_APPLECROSS_RESOURCE_OUTPUT_MODE=relaxed
build:apple_on_linux --action_env=RULES_APPLECROSS_RELAX_ACTOOL_ICON_COMPOSER=1

# BuildBuddy's remote cache and build results (--config=buildbuddy): no key
# here. CI's runs on main and its releases turn it on with the key, in a
# file of the job's own (tools/ci/ci_bazel.sh, from the BUILDBUDDY_API_KEY
# secret), and only main's builds and the release jobs upload to it; pull
# requests don't use it (GitHub's cache alone). A builder with a key of
# their own puts the same lines in .bazelrc.user. What a job downloads is Bazel's
# default, the top-level outputs (what the scripts copy, run and test); the
# writers download every output (--remote_download_all), so the disk cache
# GitHub's cache keeps for runs without a key stays whole. Compressed
# (zstd), and the build event stream without the legacy list of each
# target's outputs, which BuildBuddy doesn't read.
build:buildbuddy --bes_results_url=https://app.buildbuddy.io/invocation/
build:buildbuddy --bes_backend=grpcs://remote.buildbuddy.io
build:buildbuddy --remote_cache=grpcs://remote.buildbuddy.io
build:buildbuddy --remote_timeout=10m
build:buildbuddy --remote_cache_compression
build:buildbuddy --nolegacy_important_outputs

# Per-machine settings (untracked): e.g. --override_module for a fork
# checked out beside isomer.
try-import %workspace%/.bazelrc.user
Expand Down
28 changes: 20 additions & 8 deletions .github/actions/bazel_cache/action.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
# Bazel's caches for a CI job, from GitHub's cache (actions/cache), and its
# settings (tools/ci/ci_bazel.sh setup): the repository cache (downloads)
# and the disk cache (actions' outputs) of the job's group, linux, android or
# apple (where it builds, so what it caches is of use to it), keyed by
# and the disk cache (actions' outputs) of the job's group, ubuntu (the web,
# Linux and Android, built together on x86_64 Ubuntu), apple or windows
# (where it builds, so what it caches is of use to it), keyed by
# MODULE.bazel and the SwiftPM graphs, the disk cache by commit too, the
# newest of the group's restored when this commit's isn't there. Only main's
# builds write them (.github/actions/bazel_cache_save); every other job reads them.
# They live in the home directory, outside the checkout: Bazel 9 refuses a
# repository contents cache inside the main repository.
# They live in the home directory, outside the checkout (Bazel 9 refuses a
# repository contents cache inside the main repository), or where the job's
# ISOMER_BAZEL_CACHE says (a runner's second disk).
# BuildBuddy's remote cache too, when the job hands this its key
# (buildbuddy-api-key, the repository's BUILDBUDDY_API_KEY secret, which
# the workflow passes only in runs on main and a published release's):
# given to tools/ci/ci_bazel.sh's setup step alone, which keeps it out of
# the checkout and the log.
name: Bazel's cache
description: Restores the job group's Bazel caches and writes Bazel's settings
inputs:
group:
description: linux, android or apple
description: ubuntu, apple or windows
required: true
disk:
description: Whether to restore the disk cache too ("false" for the repository cache alone)
default: "true"
buildbuddy-api-key:
description: BuildBuddy's API key (empty, as on a fork's pull request, for GitHub's cache alone)
default: ""
outputs:
repository-hit:
description: Whether the repository cache's own key was found
Expand All @@ -26,17 +36,19 @@ runs:
- id: repository
uses: actions/cache/restore@v4
with:
path: ~/.cache/isomer-bazel/repository
path: ${{ env.ISOMER_BAZEL_CACHE || '~/.cache/isomer-bazel' }}/repository
key: bazel-repository-${{ inputs.group }}-${{ hashFiles('MODULE.bazel', 'examples/MODULE.bazel', '**/Package.resolved') }}
restore-keys: bazel-repository-${{ inputs.group }}-
- if: inputs.disk != 'false'
uses: actions/cache/restore@v4
with:
path: ~/.cache/isomer-bazel/disk
path: ${{ env.ISOMER_BAZEL_CACHE || '~/.cache/isomer-bazel' }}/disk
key: bazel-disk-${{ inputs.group }}-${{ hashFiles('MODULE.bazel', 'examples/MODULE.bazel', '**/Package.resolved') }}-${{ github.sha }}
restore-keys: |
bazel-disk-${{ inputs.group }}-${{ hashFiles('MODULE.bazel', 'examples/MODULE.bazel', '**/Package.resolved') }}-
bazel-disk-${{ inputs.group }}-
- name: Bazel's settings
shell: bash
run: tools/ci/ci_bazel.sh setup "$HOME/.cache/isomer-bazel"
env:
BUILDBUDDY_API_KEY: ${{ inputs.buildbuddy-api-key }}
run: tools/ci/ci_bazel.sh setup "${ISOMER_BAZEL_CACHE:-$HOME/.cache/isomer-bazel}"
8 changes: 4 additions & 4 deletions .github/actions/bazel_cache_save/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Bazel's cache, saved
description: Trims and saves the job group's Bazel caches
inputs:
group:
description: linux, android or apple
description: ubuntu, apple or windows
required: true
gigabytes:
description: The disk cache's size at most, in GB
Expand All @@ -20,13 +20,13 @@ runs:
steps:
- name: The disk cache, trimmed
shell: bash
run: tools/ci/ci_bazel.sh trim "$HOME/.cache/isomer-bazel" "${{ inputs.gigabytes }}"
run: tools/ci/ci_bazel.sh trim "${ISOMER_BAZEL_CACHE:-$HOME/.cache/isomer-bazel}" "${{ inputs.gigabytes }}"
- uses: actions/cache/save@v4
with:
path: ~/.cache/isomer-bazel/disk
path: ${{ env.ISOMER_BAZEL_CACHE || '~/.cache/isomer-bazel' }}/disk
key: bazel-disk-${{ inputs.group }}-${{ hashFiles('MODULE.bazel', 'examples/MODULE.bazel', '**/Package.resolved') }}-${{ github.sha }}
- if: inputs.repository-hit != 'true'
uses: actions/cache/save@v4
with:
path: ~/.cache/isomer-bazel/repository
path: ${{ env.ISOMER_BAZEL_CACHE || '~/.cache/isomer-bazel' }}/repository
key: bazel-repository-${{ inputs.group }}-${{ hashFiles('MODULE.bazel', 'examples/MODULE.bazel', '**/Package.resolved') }}
Loading