From f19dcf40d95e33f67cfb71b76f579047ebe56b32 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 26 Jan 2024 09:22:20 +0100 Subject: [PATCH] Simplify CI bzlmod matrix setup --- .bazelrc | 1 - .github/workflows/ci.yaml | 22 +++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.bazelrc b/.bazelrc index 424fd1c..c1cf743 100644 --- a/.bazelrc +++ b/.bazelrc @@ -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 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4d680bb..bc958ff 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 test ${{ matrix.bzlmod}} -- //... lint: runs-on: ubuntu-latest