Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support local Bazel binaries using bazel_binaries.local() #241

Merged
merged 5 commits into from
Nov 3, 2023

Conversation

cgrindel
Copy link
Member

@cgrindel cgrindel commented Nov 3, 2023

Allow a client to execute Bazel integration tests using a local Bazel binary.

bazel_binaries = use_extension(
    "//:extensions.bzl",
    "bazel_binaries",
    dev_dependency = True,
)
bazel_binaries.download(version_file = "//:.bazelversion")
bazel_binaries.download(version = "6.4.0")
bazel_binaries.local(path = "/path/to/bazel", name = "foo"). # <=== An absolute or relative path to a Bazel binary.
use_repo(
    bazel_binaries,
    "bazel_binaries",
    # ...
    "build_bazel_bazel_foo",   # <=== The repository name for the local Bazel binary.
)

Then, you can use the Bazel binary in integration tests by using the name value as the version.

script_test(
    name = "local_bazel_binary_test",
    srcs = ["local_bazel_binary_test.sh"],
    bazel_binaries = bazel_binaries,
    bazel_version = "foo",  # <=== The version is the name specified above.
    deps = [
        "@bazel_tools//tools/bash/runfiles",
        "@cgrindel_bazel_starlib//shlib/lib:assertions",
    ],
)

Copy link
Collaborator

@katre katre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@cgrindel cgrindel enabled auto-merge (squash) November 3, 2023 14:59
@cgrindel cgrindel disabled auto-merge November 3, 2023 16:03
@cgrindel cgrindel merged commit 8ea0d78 into main Nov 3, 2023
5 checks passed
@cgrindel cgrindel deleted the local_bazel branch November 3, 2023 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants