From 29193033db19ce6c0eb8d18fce5965ea11f71e13 Mon Sep 17 00:00:00 2001 From: Jason Bedard Date: Tue, 1 Oct 2024 10:29:55 -0700 Subject: [PATCH] chore: add bazel8 ci --- .aspect/bazelrc/correctness.bazelrc | 2 +- .aspect/bazelrc/performance.bazelrc | 19 +++++++++++++------ .github/workflows/bazel8.bazelrc | 15 +++++++++++++++ .github/workflows/ci.yaml | 11 +++++++++++ MODULE.bazel | 2 +- 5 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/bazel8.bazelrc diff --git a/.aspect/bazelrc/correctness.bazelrc b/.aspect/bazelrc/correctness.bazelrc index f381062ae..a14669899 100644 --- a/.aspect/bazelrc/correctness.bazelrc +++ b/.aspect/bazelrc/correctness.bazelrc @@ -24,7 +24,7 @@ test --test_verbose_timeout_warnings # Allow the Bazel server to check directory sources for changes. Ensures that the Bazel server # notices when a directory changes, if you have a directory listed in the srcs of some target. # Recommended when using -# [copy_directory](https://github.com/aspect-build/bazel-lib/blob/main/docs/copy_directory.md) and +# [copy_directory](https://github.com/bazel-contrib/bazel-lib/blob/main/docs/copy_directory.md) and # [rules_js](https://github.com/aspect-build/rules_js) since npm package are source directories # inputs to copy_directory actions. # Docs: https://bazel.build/reference/command-line-reference#flag--host_jvm_args diff --git a/.aspect/bazelrc/performance.bazelrc b/.aspect/bazelrc/performance.bazelrc index acc48c59e..fc404c2fb 100644 --- a/.aspect/bazelrc/performance.bazelrc +++ b/.aspect/bazelrc/performance.bazelrc @@ -1,9 +1,3 @@ -# Don't apply `--noremote_upload_local_results` and `--noremote_accept_cached` to the disk cache. -# If you have both `--noremote_upload_local_results` and `--disk_cache`, then this fixes a bug where -# Bazel doesn't write to the local disk cache as it treats as a remote cache. -# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_remote_results_ignore_disk -build --incompatible_remote_results_ignore_disk - # 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. @@ -18,3 +12,16 @@ build --experimental_reuse_sandbox_directories # author. # Docs: https://bazel.build/reference/command-line-reference#flag--legacy_external_runfiles build --nolegacy_external_runfiles + +# Avoid creating a runfiles tree for binaries or tests until it is needed. +# Docs: https://bazel.build/reference/command-line-reference#flag--build_runfile_links +# See https://github.com/bazelbuild/bazel/issues/6627 +# +# This may break local workflows that `build` a binary target, then run the resulting program +# outside of `bazel run`. In those cases, the script will need to call +# `bazel build --build_runfile_links //my/binary:target` and then execute the resulting program. +build --nobuild_runfile_links + +# Needed prior to Bazel 8; see +# https://github.com/bazelbuild/bazel/issues/20577 +coverage --build_runfile_links diff --git a/.github/workflows/bazel8.bazelrc b/.github/workflows/bazel8.bazelrc new file mode 100644 index 000000000..dbd40ee84 --- /dev/null +++ b/.github/workflows/bazel8.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 +common --noexperimental_check_external_repository_files + +# Don't report when the root module's lower bound for a dependency happens to be less than the resolved version. +# This is expected and should NOT prompt an engineer to update our lower bound to match. +# WARNING: For repository 'aspect_bazel_lib', the root module requires module version aspect_bazel_lib@1.30.2, +# but got aspect_bazel_lib@1.31.2 in the resolved dependency graph. +common --check_direct_dependencies=off + +# 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 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fa1e907e2..97c80e226 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,6 +30,7 @@ jobs: m=${v::1} a=( "major:$m, version:\"$v\"" + "major:8, version:\"8.0.0\"" "major:6, version:\"6.5.0\"" ) printf -v j '{%s},' "${a[@]}" @@ -135,6 +136,9 @@ jobs: - bazel-version: major: 6 bzlmod: 0 + # Don't run tests with Bazel 8 pre-releases by default + - bazel-version: + major: 8 # Don't run workspace smoke test under bzlmod - bzlmod: 1 folder: e2e/workspace @@ -174,6 +178,13 @@ jobs: - bzlmod: 0 folder: e2e/runfiles include: + # Include only the bzlmod unit tests with bazel8 + - bazel-version: + major: 8 + bzlmod: 1 + folder: . + os: ubuntu + config: local - bazel-version: major: 7 version: 7.4.0 diff --git a/MODULE.bazel b/MODULE.bazel index 663dfd746..55b1b1232 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -9,7 +9,7 @@ module( # Lower-bounds (minimum) versions for direct runtime dependencies. # Do not bump these unless rules_js requires a newer version to function. -bazel_dep(name = "aspect_bazel_lib", version = "2.8.1") +bazel_dep(name = "aspect_bazel_lib", version = "2.9.2") bazel_dep(name = "bazel_features", version = "1.9.0") bazel_dep(name = "bazel_skylib", version = "1.5.0") bazel_dep(name = "platforms", version = "0.0.5")