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
13 changes: 0 additions & 13 deletions .github/ci.bazelrc

This file was deleted.

84 changes: 20 additions & 64 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,64 +13,34 @@ on:
jobs:
bazel_test:
runs-on: ubuntu-latest
env:
# This is where bazelisk caches its downloads of Bazel.
BAZELISK_HOME: /home/runner/.cache/bazel_ci/bazelisk
steps:
- uses: actions/checkout@v6
- name: Install Ubuntu dependencies
run: .github/ci_setup.bash
# Restore the most appropriate caches.
#
# In the below: `github.ref` will be either "refs/pull/<pr_number>/merge"
# or "refs/heads/main"; `github.run_number` is a monotonically increasing
# serial number; and `github.run_attempt` is a typically 1.
#
# The `key` declared here will never match (since it encodes the current
# run_number) but illustrates the name we'll use to save the caches when
# we're done.
#
# However, one of the `restore-keys` patterns *should* always match. The
# effects we should see from the `restore-keys` patterns are:
#
# * When building the `main` branch, we'll always pull the most recently
# updated main caches. Both restore keys say "pip-refs/heads/main-" and
# the prior archives are named, e.g., "pip-refs/heads/main-####-#".
# GitHub will use the *most recently saved* archive name that matches
# the restore key prefix (no matter the lexicographic ordering of
# the ####-# part).
#
# * Ditto for the first build of a PR; the first restore key will not
# match anything, so it falls back to the main caches.
#
# * For subsequent builds of a PR, the first restore key, e.g.,
# "pip-refs/pull/###/merge-" should match the most recently saved PR key
# "pip-refs/pull/###/merge-####-#".
- uses: actions/cache/restore@v5
# Cache python dependencies with setup-python.
# Uses the hash of the dependency file (pyproject.toml or requirements.txt)
# as part of the cache key. For pip, this caches the global cache directory.
# Use setup-bazel for disk and repository caching.
- uses: bazel-contrib/[email protected]
with:
path: ~/.cache/pip
# N.B. The "-mumble" suffix below will never match; it's a placeholder
# for the nonce appended to the cache key. Instead, the restore-keys
# will always be used for restoring.
key: pip-${{ github.ref }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
pip-${{ github.ref }}-
pip-refs/heads/main-
- uses: actions/cache/restore@v5
with:
path: ~/.cache/bazel_ci
key: bazel_ci-${{ github.ref }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
bazel_ci-${{ github.ref }}-
bazel_ci-refs/heads/main-
- name: Report cache sizes
run: |
du -ms ~/.cache/pip || true
du -ms ~/.cache/bazel_ci/* || true
# Use the cached Bazelisk version, or download if not found.
bazelisk-cache: true
# Enable the disk cache and share it across all workflows
# (i.e., across master and pull requests).
# We want all builds to start from a warm cache, and we're not too
# concerend about pull request builds "polluting" master builds.
disk-cache: true
# Share repository cache globally as well. If repository-cache is set to true,
# it uses the hash of a few bazel files as the key for the cache. You can set
# your own list of files to use to calculate the key by passing them below.
# Passing an empty string tells setup-bazel to use the same key
# every time, regardless of any changes to any files.
repository-cache: ""
# This dumps configuration details to the log.
bazelrc: common --announce_rc=yes
# Actual testing.
- name: Bazel Test
run: |
ln -s .github/ci.bazelrc user.bazelrc
./bazel test //...
# Save the test outputs to allow for eyeball verification when relevant.
- name: Archive test outputs
Expand All @@ -79,20 +49,6 @@ jobs:
name: test_outputs
path: |
.bazel/testlogs/examples/ball_bin_test/test.outputs/outputs.zip
# Save the updated cache snapshots, so we never do the same work twice.
# By default, actions/cache only saves after a successful workflow, but
# our caches are bags of files where we only ever add new files (not change
# an existing files), so it's always safe to snapshot.
- uses: actions/cache/save@v5
if: always()
with:
path: ~/.cache/pip
key: pip-${{ github.ref }}-${{ github.run_number }}-${{ github.run_attempt }}
- uses: actions/cache/save@v5
if: always()
with:
path: ~/.cache/bazel_ci
key: bazel_ci-${{ github.ref }}-${{ github.run_number }}-${{ github.run_attempt }}
install_test:
runs-on: ubuntu-latest
strategy:
Expand Down
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ bazel_dep(name = "rules_python", version = "1.7.0")
# version of Python, so we'll pin ourselves to exactly that version.
PYTHON_VERSION = "3.11"

# TODO: Remove this line after GHA succeeds
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(python_version = PYTHON_VERSION)
use_repo(python, "python_versions")
Expand Down
Loading