From c4e601f2448493d83c7dd6b219362acde2e8e70b Mon Sep 17 00:00:00 2001 From: Jason Bedard Date: Tue, 13 Jun 2023 16:26:33 -0700 Subject: [PATCH] ci: add bazel 7 prerelease tests (#452) --- .aspect/bazelrc/bazel7.bazelrc | 15 +++++++++++++++ .github/workflows/ci.yaml | 9 +++++++-- .../all/write_aspect_bazelrc_presets.bzl | 4 ++-- 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 .aspect/bazelrc/bazel7.bazelrc diff --git a/.aspect/bazelrc/bazel7.bazelrc b/.aspect/bazelrc/bazel7.bazelrc new file mode 100644 index 0000000..11a1c67 --- /dev/null +++ b/.aspect/bazelrc/bazel7.bazelrc @@ -0,0 +1,15 @@ +# Speed up all builds by not checking if external repository files have been modified. +# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryOptions.java#L244 +build --noexperimental_check_external_repository_files +fetch --noexperimental_check_external_repository_files +query --noexperimental_check_external_repository_files + +# Directories used by sandboxed non-worker execution may be reused to avoid unnecessary setup costs. +# Save time on Sandbox creation and deletion when many of the same kind of action run during the +# build. +# Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories +build --reuse_sandbox_directories + +# Avoid this flag being enabled by remote_download_minimal or remote_download_toplevel +# See https://meroton.com/blog/bazel-6-errors-build-without-the-bytes/ +build --noexperimental_action_cache_store_output_metadata diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 10cf6aa..47bae89 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -41,10 +41,12 @@ jobs: - uses: actions/checkout@v3 - id: bazel_6 run: echo "bazelversion=$(head -n 1 .bazelversion)" >> $GITHUB_OUTPUT + - id: bazel_7 + run: echo "bazelversion=7.0.0-pre.20230530.3" >> $GITHUB_OUTPUT - id: bazel_5 - run: echo "bazelversion=5.4.0" >> $GITHUB_OUTPUT + run: echo "bazelversion=5.4.1" >> $GITHUB_OUTPUT outputs: - # Will look like '["6.0.0", "5.4.0"]' + # Will look like '["", "7.0.0-pre.*", "5.4.1"]' bazelversions: ${{ toJSON(steps.*.outputs.bazelversion) }} matrix-prep-os: @@ -103,6 +105,9 @@ jobs: # Don't test MacOS with Bazel 5 to minimize MacOS minutes (billed at 10X) - bazelversion: 5.4.0 os: macos-latest + # Don't test MacOS with Bazel 7 to minimize MacOS minutes (billed at 10X) + - bazelversion: 7.0.0-pre.20230530.3 + os: macos-latest # Don't test Windows with RBE to minimize Windows minutes (billed at 2X) - config: rbe os: windows-latest diff --git a/lib/tests/bazelrc_presets/all/write_aspect_bazelrc_presets.bzl b/lib/tests/bazelrc_presets/all/write_aspect_bazelrc_presets.bzl index 693a022..4176c90 100644 --- a/lib/tests/bazelrc_presets/all/write_aspect_bazelrc_presets.bzl +++ b/lib/tests/bazelrc_presets/all/write_aspect_bazelrc_presets.bzl @@ -4,8 +4,8 @@ load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", _write_aspect_bazelrc_presets load("@aspect_bazel_lib_host//:defs.bzl", "host") def write_aspect_bazelrc_presets(**kwargs): - if host.bazel_version[0] != "5": - # Don't stamp this target out if we're testing against Bazel 5. The bazel6.bazelrc file is + if host.bazel_version[0] == "6": + # Don't stamp this target out if we're testing against Bazel 5 or 7. The bazel6.bazelrc file is # deleted on CI when testing Bazel 5 which breaks analysis for this target. See # https://github.com/aspect-build/bazel-lib/blob/fff5f10ad8e6921a45816e256f588d8020b3f2ee/.github/workflows/ci.yaml#L145. _write_aspect_bazelrc_presets(**kwargs)