-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure release archive contains all required files (#130)
- Add some missing files to the release archive. - Create a separate test for bzlmod e2e testing. - Add archive test to ensure that the archive contains everything needed to run properly. Related to bazelbuild/bazel-central-registry#519 Related to #120.
- Loading branch information
Showing
7 changed files
with
176 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,35 @@ | ||
load("@bazel_binaries//:defs.bzl", "bazel_binaries") | ||
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg") | ||
load("//:bazel_versions.bzl", "CURRENT_BAZEL_VERSION") | ||
load( | ||
"//bazel_integration_test:defs.bzl", | ||
"bazel_integration_test", | ||
) | ||
|
||
bzlformat_pkg(name = "bzlformat") | ||
|
||
filegroup( | ||
name = "all_files", | ||
srcs = glob(["*"]), | ||
visibility = ["//:__subpackages__"], | ||
) | ||
|
||
sh_binary( | ||
name = "e2e_test_runner", | ||
testonly = True, | ||
srcs = ["e2e_test_runner.sh"], | ||
deps = [ | ||
"@bazel_tools//tools/bash/runfiles", | ||
"@cgrindel_bazel_starlib//shlib/lib:assertions", | ||
], | ||
) | ||
|
||
# This test exists to be run as part of the BCR presubmit. | ||
bazel_integration_test( | ||
name = "e2e_test", | ||
bazel_binaries = bazel_binaries, | ||
bazel_version = CURRENT_BAZEL_VERSION, | ||
# Override the default tags. Let this run with bazel test //... | ||
tags = [], | ||
test_runner = ":e2e_test_runner", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env bash | ||
|
||
# --- begin runfiles.bash initialization v2 --- | ||
# Copy-pasted from the Bazel Bash runfiles library v2. | ||
set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash | ||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ | ||
source "$0.runfiles/$f" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ | ||
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e | ||
# --- end runfiles.bash initialization v2 --- | ||
|
||
|
||
# MARK - Locate Deps | ||
|
||
assertions_sh_location=cgrindel_bazel_starlib/shlib/lib/assertions.sh | ||
assertions_sh="$(rlocation "${assertions_sh_location}")" || \ | ||
(echo >&2 "Failed to locate ${assertions_sh_location}" && exit 1) | ||
source "${assertions_sh}" | ||
|
||
|
||
# MARK - Process Args | ||
|
||
bazel="${BIT_BAZEL_BINARY:-}" | ||
workspace_dir="${BIT_WORKSPACE_DIR:-}" | ||
|
||
# Process args | ||
while (("$#")); do | ||
case "${1}" in | ||
*) | ||
fail "Unrecognized argument. ${@}" | ||
;; | ||
esac | ||
done | ||
|
||
[[ -n "${bazel:-}" ]] || exit_with_msg "Must specify the location of the Bazel binary." | ||
[[ -n "${workspace_dir:-}" ]] || exit_with_msg "Must specify the path of the workspace directory." | ||
|
||
|
||
# MARK - Create a WORKSPACE | ||
|
||
cd "${workspace_dir}" | ||
|
||
# Create a WORKSPACE file | ||
touch WORKSPACE | ||
|
||
# Run Bazel info | ||
info_out="$( "${bazel}" info release )" | ||
assert_match "release " "${info_out}" "Expected a release stanza." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env bash | ||
|
||
# --- begin runfiles.bash initialization v2 --- | ||
# Copy-pasted from the Bazel Bash runfiles library v2. | ||
set -o nounset -o pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash | ||
# shellcheck disable=SC1090 | ||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ | ||
source "$0.runfiles/$f" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ | ||
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -o errexit | ||
# --- end runfiles.bash initialization v2 --- | ||
|
||
# MARK - Locate Deps | ||
|
||
assertions_sh_location=cgrindel_bazel_starlib/shlib/lib/assertions.sh | ||
assertions_sh="$(rlocation "${assertions_sh_location}")" || \ | ||
(echo >&2 "Failed to locate ${assertions_sh_location}" && exit 1) | ||
source "${assertions_sh}" | ||
|
||
rules_bazel_integration_test_tar_gz_location=rules_bazel_integration_test/release/rules_bazel_integration_test.tar.gz | ||
rules_bazel_integration_test_tar_gz="$(rlocation "${rules_bazel_integration_test_tar_gz_location}")" || \ | ||
(echo >&2 "Failed to locate ${rules_bazel_integration_test_tar_gz_location}" && exit 1) | ||
|
||
# MARK - Process Args | ||
|
||
bazel="${BIT_BAZEL_BINARY:-}" | ||
workspace_dir="${BIT_WORKSPACE_DIR:-}" | ||
|
||
# Process args | ||
while (("$#")); do | ||
case "${1}" in | ||
*) | ||
fail "Unrecognized argument. ${@}" | ||
;; | ||
esac | ||
done | ||
|
||
[[ -n "${bazel:-}" ]] || exit_with_msg "Must specify the location of the Bazel binary." | ||
[[ -n "${workspace_dir:-}" ]] || exit_with_msg "Must specify the path of the workspace directory." | ||
|
||
# MARK - Create a HOME directory | ||
|
||
# Not sure why, but the download and extract for the Bazel binaries was | ||
# experiencing a permission denied when trying to use the local repository | ||
# cache. | ||
home_dir="${PWD}/home" | ||
mkdir -p "${home_dir}" | ||
export HOME="${home_dir}" | ||
|
||
# MARK - Create a WORKSPACE | ||
|
||
# Extract the contents of the archive into the workspace directory | ||
tar -xf "${rules_bazel_integration_test_tar_gz}" -C "${workspace_dir}" | ||
|
||
# Test the extracted contents | ||
cd "${workspace_dir}" | ||
"${bazel}" test //bazel_integration_test/bzlmod/... |