Skip to content

Commit

Permalink
Simplify CI bzlmod matrix setup
Browse files Browse the repository at this point in the history
  • Loading branch information
lalten committed Jan 26, 2024
1 parent 410932a commit 449c9c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
1 change: 0 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ build --cxxopt=-std=c++20
build --incompatible_strict_action_env
build --keep_going
common --experimental_allow_unresolved_symlinks # Only required for Bazel 5
common --noenable_bzlmod # This line is automatically removed in CI for Bazel 5
test --announce_rc
test --keep_going
test --spawn_strategy=sandboxed
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,26 @@ jobs:
matrix:
bazel-version: ["5.x", "6.x", "7.x"]
os: ["ubuntu-latest", "macos-latest"]
bzlmod: ["--enable_bzlmod", "--noenable_bzlmod"]
exclude:
# Don't expect Bazel compatibility issues depending on OS, so speed this up
- bazel-version: "5.x"
os: "macos-latest"
- bazel-version: "6.x"
os: "macos-latest"
# No Bzlmod with Bazel 5
- bazel-version: "5.x"
bzlmod: "--enable_bzlmod"

steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: "~/.cache/bazelisk\n~/.cache/bazel\n"
key: bazel-${{ matrix.bazel-version }}-cache-${{ github.run_id }}
restore-keys: bazel-${{ matrix.bazel-version }}-cache-
key: bazel-${{ matrix.bazel-version }}-${{ matrix.os }}-${{ matrix.bzlmod }}-cache-${{ github.run_id }}
restore-keys: bazel-${{ matrix.bazel-version }}-${{ matrix.os }}-${{ matrix.bzlmod }}-cache-

- run: sed -i.bak '/enable_bzlmod/d' .bazelrc && rm .bazelrc.bak
if: ${{ matrix.bazel-version == '5.x' }}

- run: bazel test //...

- run: bazel test --enable_bzlmod //...
if: ${{ matrix.bazel-version != '5.x' }}
- run: bazel ${{ matrix.bzlmod}} test //...

lint:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 449c9c8

Please sign in to comment.