From b4e2fc8b1dfbda23e32437e276e0c8f3357fa1a8 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Wed, 10 Jan 2024 16:49:11 +0900 Subject: [PATCH] chore: include the examples in the release artifact (#37) Summary: - chore: package the examples with the distribution tarball - chore: set the MODULE.bazel version to 0 --- .bazelignore | 10 +++++++++- .bazelrc | 5 +++++ .bcr/presubmit.yml | 2 +- BUILD.bazel | 2 ++ MODULE.bazel | 9 ++++++++- ci/package.sh | 4 ++++ examples/BUILD.bazel | 14 ++++++++++++++ 7 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 examples/BUILD.bazel diff --git a/.bazelignore b/.bazelignore index 1e107f5..2f4ee11 100644 --- a/.bazelignore +++ b/.bazelignore @@ -1 +1,9 @@ -examples +examples/check_glob/bazel-bin +examples/check_glob/bazel-out +examples/check_glob/bazel-testlogs +examples/check_glob/bazel-optional_attributes + +examples/optional_attributes/bazel-bin +examples/optional_attributes/bazel-out +examples/optional_attributes/bazel-testlogs +examples/optional_attributes/bazel-optional_attributes diff --git a/.bazelrc b/.bazelrc index 9bdffa1..e8047d9 100644 --- a/.bazelrc +++ b/.bazelrc @@ -6,3 +6,8 @@ common --incompatible_strict_action_env common --enable_bzlmod try-import user.bazelrc + +# To update these lines, execute +# `bazel run @rules_bazel_integration_test//tools:update_deleted_packages` +build --deleted_packages=examples/check_glob,examples/optional_attributes +query --deleted_packages=examples/check_glob,examples/optional_attributes diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml index b9e4582..db0a441 100644 --- a/.bcr/presubmit.yml +++ b/.bcr/presubmit.yml @@ -1,6 +1,6 @@ --- bcr_test_module: - module_path: "examples/bzlmod" + module_path: "examples/check_glob" matrix: platform: ["debian10", "macos", "ubuntu2004"] tasks: diff --git a/BUILD.bazel b/BUILD.bazel index ed71b3f..1849b99 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -10,6 +10,8 @@ filegroup( ":def.bzl", ":deps.bzl", "//internal:distribution", + # Needed for BCR registry to run the pre-submit tests + "//examples:distribution", ], visibility = ["//internal/pkg:__pkg__"], ) diff --git a/MODULE.bazel b/MODULE.bazel index 4c47b5a..5351ba6 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,6 +1,6 @@ module( name = "rules_shellcheck", - version = "0.2.4", + version = "0.0.0", compatibility_level = 1, ) @@ -17,4 +17,11 @@ use_repo( "shellcheck_windows_x86_64", ) +# Dev dependencies + bazel_dep(name = "rules_pkg", version = "0.9.1", dev_dependency = True) +bazel_dep( + name = "rules_bazel_integration_test", + version = "0.21.0", + dev_dependency = True, +) diff --git a/ci/package.sh b/ci/package.sh index 6e943e3..3e30085 100755 --- a/ci/package.sh +++ b/ci/package.sh @@ -26,6 +26,8 @@ main() { _log "Extracting the tarball into a temporary directory to run examples" tar -xvf "$tarball" -C "$TMPDIR" + pushd $TMPDIR + # Then run examples with the packaged artifacts examples=( check_glob @@ -41,6 +43,8 @@ main() { ... popd done + + popd _log "Success" } diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel new file mode 100644 index 0000000..6d81939 --- /dev/null +++ b/examples/BUILD.bazel @@ -0,0 +1,14 @@ +filegroup( + name = "distribution", + srcs = glob( + [ + "check_glob/**", + "optional_attributes/**", + ], + exclude = [ + "**/.gitignore", + "**/MODULE.bazel.lock", + ], + ), + visibility = ["//:__pkg__"], +)