Skip to content

Commit

Permalink
build: only run bazel 6 unit tests with bzlmod
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard committed Oct 19, 2024
1 parent ac49601 commit d29423a
Show file tree
Hide file tree
Showing 20 changed files with 116 additions and 51 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,11 @@ jobs:
major: 6
bzlmod: 1
folder: e2e/npm_translate_lock_replace_packages
# Don't run bzlmod tests with Bazel 6 to reduce the size of the test matrix
# Don't run workspace tests with Bazel 6 to reduce the size of the test matrix
# and remove the need for bazel 6 workspace support for local development.
- bazel-version:
major: 6
bzlmod: 1
bzlmod: 0
# Don't run workspace smoke test under bzlmod
- bzlmod: 1
folder: e2e/workspace
Expand All @@ -150,27 +151,39 @@ jobs:
folder: e2e/npm_link_package
- bzlmod: 1
folder: e2e/rules_foo
# gyp_no_install_script is broken in an usual way on 6.5.0
# gyp_no_install_script+patch_from_repo+js_run_devserver are broken in an usual way on 6.5.0
# that is not worth investigating as we're dropping Bazel 6 support soon
- bazel-version:
major: 6
bzlmod: 0
folder: e2e/gyp_no_install_script
- bazel-version:
major: 6
folder: e2e/patch_from_repo
# devservers on bazel6+bzlmod also broken in an odd way
- bazel-version:
major: 6
folder: e2e/js_run_devserver
- bazel-version:
major: 6
folder: e2e/webpack_devserver
- bazel-version:
major: 6
folder: e2e/webpack_devserver_esm
# @bazel/runfiles seems broken with non-bzlmod + bazel7
# https://github.com/bazel-contrib/rules_nodejs/issues/3797
- bzlmod: 0
folder: e2e/runfiles
include:
- bazel-version:
major: 7
version: 7.1.1
version: 7.3.2
bzlmod: 1
os: windows
config: local
folder: e2e/bzlmod
- bazel-version:
major: 7
version: 7.1.1
version: 7.3.2
bzlmod: 1
os: macos
config: local
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.7.1", dev_dependenc
bazel_dep(name = "buildifier_prebuilt", version = "7.3.1", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.39.1", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "rules_go", version = "0.50.1", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.7.1", dev_dependency = True, repo_name = "io_bazel_stardoc")
bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True, repo_name = "io_bazel_stardoc")

host = use_extension(
"@aspect_bazel_lib//lib:extensions.bzl",
Expand Down
4 changes: 4 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ load("@io_bazel_stardoc//:deps.bzl", "stardoc_external_deps")

stardoc_external_deps()

load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

load("@stardoc_maven//:defs.bzl", stardoc_pinned_maven_install = "pinned_maven_install")

stardoc_pinned_maven_install()
Expand Down
60 changes: 58 additions & 2 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,49 +1,85 @@
load("@aspect_bazel_lib//lib:docs.bzl", "stardoc_with_diff_test", "update_docs")
load(":docs.bzl", "stardoc_with_diff_test", "update_docs")

stardoc_with_diff_test(
name = "js_binary",
bzl_library_target = "//js/private:js_binary",
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

stardoc_with_diff_test(
name = "js_library",
bzl_library_target = "//js/private:js_library",
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

stardoc_with_diff_test(
name = "js_run_binary",
bzl_library_target = "//js/private:js_run_binary",
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

stardoc_with_diff_test(
name = "js_run_devserver",
bzl_library_target = "//js/private:js_run_devserver",
symbol_names = ["js_run_devserver"],
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

stardoc_with_diff_test(
name = "js_info_files",
bzl_library_target = "//js/private:js_info_files",
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

stardoc_with_diff_test(
name = "js_image_layer",
bzl_library_target = "//js/private:js_image_layer",
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

stardoc_with_diff_test(
name = "npm_package",
bzl_library_target = "//npm/private:npm_package",
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

stardoc_with_diff_test(
name = "npm_link_package",
bzl_library_target = "//npm/private:npm_link_package",
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

stardoc_with_diff_test(
name = "npm_link_all_packages",
bzl_library_target = "//npm/private:npm_translate_lock_generate.docs",
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

stardoc_with_diff_test(
Expand All @@ -52,6 +88,10 @@ stardoc_with_diff_test(
symbol_names = [
"npm_import",
],
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

stardoc_with_diff_test(
Expand All @@ -61,10 +101,18 @@ stardoc_with_diff_test(
"list_patches",
"npm_translate_lock",
],
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

update_docs(
name = "update",
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

# Demonstration delivery target for Aspect Workflows.
Expand All @@ -73,7 +121,11 @@ sh_binary(
name = "docs_delivery_only_on_change",
srcs = ["delivery.sh"],
data = glob(["*.md"]),
tags = ["deliverable"],
tags = [
"deliverable",
"skip-on-bazel6",
"skip-on-rbe",
],
)

# Demonstration delivery target for Aspect Workflows.
Expand All @@ -82,4 +134,8 @@ sh_binary(
name = "docs_delivery",
srcs = ["delivery.sh"],
data = glob(["*.md"]),
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)
18 changes: 18 additions & 0 deletions docs/docs.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
Wrapper around stardoc_with_diff_test that only runs the test if Bazel 7 or greater is being used.
"""

load("@aspect_bazel_lib//lib:docs.bzl", _stardoc_with_diff_test = "stardoc_with_diff_test", _update_docs = "update_docs")
load("@aspect_bazel_lib//lib:utils.bzl", "is_bazel_7_or_greater")

def stardoc_with_diff_test(name, **kwargs):
"""
Wrapper around stardoc_with_diff_test that only runs the test if Bazel 7 or greater is being used.
"""
if is_bazel_7_or_greater():
_stardoc_with_diff_test(name, **kwargs)
else:
# buildifier: disable=print
print("WARNING: Skipping stardoc_with_diff_test for %s because it requires Bazel 7 or greater" % name)

update_docs = _update_docs
8 changes: 0 additions & 8 deletions docs/js_binary.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions docs/js_image_layer.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions docs/js_info_files.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions docs/js_library.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions docs/js_run_binary.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions docs/js_run_devserver.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions docs/npm_import.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions docs/npm_link_all_packages.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions docs/npm_link_package.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions docs/npm_package.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d29423a

Please sign in to comment.