Skip to content
Draft
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
63 changes: 63 additions & 0 deletions .github/actions/bazel-cache/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Checkout Bazel server and disk caches
inputs:
bazel-version:
description: Used custom bazel version (or .bazelversion if empty)
required: false
bazelrc:
description: Used custom rc file (or .bazelrc if empty)
required: false
disk-cache-max-size:
description: Max size for disk cache GC (e.g. 5G)
required: false
default: '5G'
outputs:
disk-cache-flags:
description: Bazel flags for disk cache (use in bazel build/test)
value: ${{ steps.set-flags.outputs.disk-cache-flags }}
runs:
using: 'composite'
steps:
- name: Bazel server cache
uses: actions/cache@v5
env:
BAZEL_VERSION: ${{ inputs.bazel-version || '.bazelversion' }}
BAZELRC: ${{ inputs.bazelrc || '.bazelrc' }}
with:
path: ${{ runner.os == 'Linux' && '/home/runner/.cache/bazel' || '/Users/runner/Library/Caches/Bazel' }}
# Richer hash than disk cache: server cache has no history, so it
# changes often; separate blobs avoid overwriting caches for different
# dep graphs.
key: >-
${{format(
'bazel-{0}-{1}-{2}-{3}',
runner.os,
env.BAZEL_VERSION,
env.BAZELRC,
hashFiles('**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'MODULE.bazel', '.bazelversion', '.bazelrc*')
)}}
restore-keys: |
${{format(
'bazel-{0}-{1}-{2}-',
runner.os,
env.BAZEL_VERSION,
env.BAZELRC
)}}
- name: Bazel disk cache
uses: actions/cache@v5
env:
BAZEL_VERSION: ${{ inputs.bazel-version || '.bazelversion' }}
BAZELRC: ${{ inputs.bazelrc || '.bazelrc' }}
with:
path: ${{ runner.os == 'Linux' && '/home/runner/.bazel-disk-cache' || '/Users/runner/.bazel-disk-cache' }}
key: >-
${{format(
'bazel-disk-{0}-{1}-{2}',
runner.os,
env.BAZEL_VERSION,
env.BAZELRC
)}}
- name: Set disk cache flags output
id: set-flags
run: |
echo "disk-cache-flags=--disk_cache=$HOME/.bazel-disk-cache --experimental_disk_cache_gc_max_size=${{ inputs.disk-cache-max-size }}" >> "$GITHUB_OUTPUT"
shell: bash
51 changes: 31 additions & 20 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,21 @@ jobs:
USE_BAZEL_VERSION: ${{ matrix.bazel-version }}
BAZELRC: ${{ matrix.custom-bazelrc }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: ./.github/actions/bazel-cache
id: bazel-cache
with:
bazel-version: ${{ matrix.bazel-version }}
bazelrc: ${{ matrix.custom-bazelrc }}
- name: Build
run: |
bazel build //...
bazel build ${{ steps.bazel-cache.outputs.disk-cache-flags }} //...
- name: Test
run: |
bazel test --test_output=errors //...
bazel test --test_output=errors ${{ steps.bazel-cache.outputs.disk-cache-flags }} //...

# Imitate the BCR test in .bcr/presubmit.yml. Keep in sync.
bcr_test_module:
bcr-test-module:
strategy:
matrix:
os: [ubuntu-24.04, macos-26]
Expand All @@ -52,37 +57,43 @@ jobs:
run:
working-directory: "example/bzlmod"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: ./.github/actions/bazel-cache
id: bazel-cache
with:
bazel-version: ${{ matrix.bazel-version || '.bazelversion' }}
- name: Run Gazelle
run: "bazel run //:gazelle"
run: "bazel run ${{ steps.bazel-cache.outputs.disk-cache-flags }} //:gazelle"
- name: Build
run: "bazel build //..."
run: "bazel build ${{ steps.bazel-cache.outputs.disk-cache-flags }} //..."
- name: Test
run: "bazel test //..."
run: "bazel test ${{ steps.bazel-cache.outputs.disk-cache-flags }} //..."

test-indexers:
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Install Conan
run: |
python3 -m pip install --upgrade pip
pip install conan
- name: Execute manual integration tests
run: bazel test --test_output=errors //index:integration_tests
- uses: actions/checkout@v6
- uses: ./.github/actions/bazel-cache
id: bazel-cache
- name: Install Conan
run: |
python3 -m pip install --upgrade pip
pip install conan
- name: Execute manual integration tests
run: bazel test --test_output=errors ${{ steps.bazel-cache.outputs.disk-cache-flags }} //index:integration_tests

test-e2e:
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Execute end to end tests
run: bash .github/workflows/test_e2e.sh
- uses: actions/checkout@v6
- name: Execute end to end tests
run: bash .github/workflows/test_e2e.sh

license-headers:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- run: ./scripts/license_check.sh
- uses: actions/checkout@v6
- run: ./scripts/license_check.sh
4 changes: 2 additions & 2 deletions .github/workflows/generate_bzldep_index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
build-plan:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: coursier/cache-action@v6
- uses: coursier/setup-action@v1
with:
apps: scala

# Reuse already resolved info if available
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: .cache/
key: gen-mappings-indexer-cache
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Build / tooling
bazel-*
sandbox/*
/bazel-*
/example/bzlmod/bazel-*
/example/workspace/bazel-*
/sandbox/*
.cache
.scala-build
.metals
Expand Down