7 Commits

Author SHA1 Message Date
eric
54109136ab chore(release): v1.0.2
Some checks failed
CI / test (ubuntu-latest, linux-x64) (push) Failing after 32s
Docs Pages / deploy (push) Failing after 36s
Copilot Setup Steps / copilot-setup-steps (push) Failing after 36s
CI / test (macos-14, darwin-arm64) (push) Has been cancelled
CI / test (windows-latest, windows) (push) Has been cancelled
2026-03-15 13:08:19 +01:00
eric
3e5ed611fe ci: something 2026-03-15 13:08:07 +01:00
eric
3085d3ce98 ci: something 2026-03-15 13:01:47 +01:00
eric
143db9c20e ci: remove redundant go dep 2026-03-15 12:45:59 +01:00
eric
4f9dff66c1 ci: remove redundant go dep 2026-03-15 12:17:25 +01:00
eric
fbe1eb3fc8 ci: pin bazel version 2026-03-15 12:15:40 +01:00
eric
08f2abc60e ci: print logs instead of paths 2026-03-15 12:06:28 +01:00
20 changed files with 143 additions and 114 deletions

1
.bazelversion Normal file
View File

@@ -0,0 +1 @@
9.0.1

View File

@@ -25,7 +25,7 @@ jobs:
phase8_target: windows phase8_target: windows
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env: env:
USE_BAZEL_VERSION: 9.0.0 USE_BAZEL_VERSION: 9.0.1
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.18.0 - uses: bazel-contrib/setup-bazel@0.18.0
@@ -40,4 +40,4 @@ jobs:
run: | run: |
echo "Phase 8 target: ${{ matrix.phase8_target }}" echo "Phase 8 target: ${{ matrix.phase8_target }}"
targets="$(./tests/ci_test/phase8_ci_targets.sh "${{ matrix.phase8_target }}")" targets="$(./tests/ci_test/phase8_ci_targets.sh "${{ matrix.phase8_target }}")"
bazel test ${targets} bazel test --test_output=errors ${targets}

View File

@@ -23,7 +23,7 @@ jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
USE_BAZEL_VERSION: 9.0.0 USE_BAZEL_VERSION: 9.0.1
environment: environment:
name: github-pages name: github-pages
url: ${{ steps.deployment.outputs.page_url }} url: ${{ steps.deployment.outputs.page_url }}

View File

@@ -1,6 +1,6 @@
module( module(
name = "rules_bun", name = "rules_bun",
version = "1.0.1", version = "1.0.2",
) )
# Core ruleset dependencies. # Core ruleset dependencies.

15
MODULE.bazel.lock generated
View File

@@ -34,8 +34,9 @@
"https://bcr.bazel.build/modules/bazel_features/1.3.0/MODULE.bazel": "cdcafe83ec318cda34e02948e81d790aab8df7a929cec6f6969f13a489ccecd9", "https://bcr.bazel.build/modules/bazel_features/1.3.0/MODULE.bazel": "cdcafe83ec318cda34e02948e81d790aab8df7a929cec6f6969f13a489ccecd9",
"https://bcr.bazel.build/modules/bazel_features/1.30.0/MODULE.bazel": "a14b62d05969a293b80257e72e597c2da7f717e1e69fa8b339703ed6731bec87", "https://bcr.bazel.build/modules/bazel_features/1.30.0/MODULE.bazel": "a14b62d05969a293b80257e72e597c2da7f717e1e69fa8b339703ed6731bec87",
"https://bcr.bazel.build/modules/bazel_features/1.33.0/MODULE.bazel": "8b8dc9d2a4c88609409c3191165bccec0e4cb044cd7a72ccbe826583303459f6", "https://bcr.bazel.build/modules/bazel_features/1.33.0/MODULE.bazel": "8b8dc9d2a4c88609409c3191165bccec0e4cb044cd7a72ccbe826583303459f6",
"https://bcr.bazel.build/modules/bazel_features/1.33.0/source.json": "13617db3930328c2cd2807a0f13d52ca870ac05f96db9668655113265147b2a6",
"https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7", "https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7",
"https://bcr.bazel.build/modules/bazel_features/1.42.1/MODULE.bazel": "275a59b5406ff18c01739860aa70ad7ccb3cfb474579411decca11c93b951080",
"https://bcr.bazel.build/modules/bazel_features/1.42.1/source.json": "fcd4396b2df85f64f2b3bb436ad870793ecf39180f1d796f913cc9276d355309",
"https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a", "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a",
"https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8",
"https://bcr.bazel.build/modules/bazel_skylib/1.1.1/MODULE.bazel": "1add3e7d93ff2e6998f9e118022c84d163917d912f5afafb3058e3d2f1545b5e", "https://bcr.bazel.build/modules/bazel_skylib/1.1.1/MODULE.bazel": "1add3e7d93ff2e6998f9e118022c84d163917d912f5afafb3058e3d2f1545b5e",
@@ -51,8 +52,8 @@
"https://bcr.bazel.build/modules/bazel_skylib/1.8.1/MODULE.bazel": "88ade7293becda963e0e3ea33e7d54d3425127e0a326e0d17da085a5f1f03ff6", "https://bcr.bazel.build/modules/bazel_skylib/1.8.1/MODULE.bazel": "88ade7293becda963e0e3ea33e7d54d3425127e0a326e0d17da085a5f1f03ff6",
"https://bcr.bazel.build/modules/bazel_skylib/1.8.2/MODULE.bazel": "69ad6927098316848b34a9142bcc975e018ba27f08c4ff403f50c1b6e646ca67", "https://bcr.bazel.build/modules/bazel_skylib/1.8.2/MODULE.bazel": "69ad6927098316848b34a9142bcc975e018ba27f08c4ff403f50c1b6e646ca67",
"https://bcr.bazel.build/modules/bazel_skylib/1.8.2/source.json": "34a3c8bcf233b835eb74be9d628899bb32999d3e0eadef1947a0a562a2b16ffb", "https://bcr.bazel.build/modules/bazel_skylib/1.8.2/source.json": "34a3c8bcf233b835eb74be9d628899bb32999d3e0eadef1947a0a562a2b16ffb",
"https://bcr.bazel.build/modules/buildozer/8.2.1/MODULE.bazel": "61e9433c574c2bd9519cad7fa66b9c1d2b8e8d5f3ae5d6528a2c2d26e68d874d", "https://bcr.bazel.build/modules/buildozer/8.5.1/MODULE.bazel": "a35d9561b3fc5b18797c330793e99e3b834a473d5fbd3d7d7634aafc9bdb6f8f",
"https://bcr.bazel.build/modules/buildozer/8.2.1/source.json": "7c33f6a26ee0216f85544b4bca5e9044579e0219b6898dd653f5fb449cf2e484", "https://bcr.bazel.build/modules/buildozer/8.5.1/source.json": "e3386e6ff4529f2442800dee47ad28d3e6487f36a1f75ae39ae56c70f0cd2fbd",
"https://bcr.bazel.build/modules/google_benchmark/1.8.2/MODULE.bazel": "a70cf1bba851000ba93b58ae2f6d76490a9feb74192e57ab8e8ff13c34ec50cb", "https://bcr.bazel.build/modules/google_benchmark/1.8.2/MODULE.bazel": "a70cf1bba851000ba93b58ae2f6d76490a9feb74192e57ab8e8ff13c34ec50cb",
"https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4", "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4",
"https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/MODULE.bazel": "22c31a561553727960057361aa33bf20fb2e98584bc4fec007906e27053f80c6", "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/MODULE.bazel": "22c31a561553727960057361aa33bf20fb2e98584bc4fec007906e27053f80c6",
@@ -112,8 +113,8 @@
"https://bcr.bazel.build/modules/rules_cc/0.1.5/MODULE.bazel": "88dfc9361e8b5ae1008ac38f7cdfd45ad738e4fa676a3ad67d19204f045a1fd8", "https://bcr.bazel.build/modules/rules_cc/0.1.5/MODULE.bazel": "88dfc9361e8b5ae1008ac38f7cdfd45ad738e4fa676a3ad67d19204f045a1fd8",
"https://bcr.bazel.build/modules/rules_cc/0.2.0/MODULE.bazel": "b5c17f90458caae90d2ccd114c81970062946f49f355610ed89bebf954f5783c", "https://bcr.bazel.build/modules/rules_cc/0.2.0/MODULE.bazel": "b5c17f90458caae90d2ccd114c81970062946f49f355610ed89bebf954f5783c",
"https://bcr.bazel.build/modules/rules_cc/0.2.13/MODULE.bazel": "eecdd666eda6be16a8d9dc15e44b5c75133405e820f620a234acc4b1fdc5aa37", "https://bcr.bazel.build/modules/rules_cc/0.2.13/MODULE.bazel": "eecdd666eda6be16a8d9dc15e44b5c75133405e820f620a234acc4b1fdc5aa37",
"https://bcr.bazel.build/modules/rules_cc/0.2.14/MODULE.bazel": "353c99ed148887ee89c54a17d4100ae7e7e436593d104b668476019023b58df8", "https://bcr.bazel.build/modules/rules_cc/0.2.17/MODULE.bazel": "1849602c86cb60da8613d2de887f9566a6d354a6df6d7009f9d04a14402f9a84",
"https://bcr.bazel.build/modules/rules_cc/0.2.14/source.json": "55d0a4587c5592fad350f6e698530f4faf0e7dd15e69d43f8d87e220c78bea54", "https://bcr.bazel.build/modules/rules_cc/0.2.17/source.json": "3832f45d145354049137c0090df04629d9c2b5493dc5c2bf46f1834040133a07",
"https://bcr.bazel.build/modules/rules_cc/0.2.8/MODULE.bazel": "f1df20f0bf22c28192a794f29b501ee2018fa37a3862a1a2132ae2940a23a642", "https://bcr.bazel.build/modules/rules_cc/0.2.8/MODULE.bazel": "f1df20f0bf22c28192a794f29b501ee2018fa37a3862a1a2132ae2940a23a642",
"https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6", "https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6",
"https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8", "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8",
@@ -193,7 +194,7 @@
"//bun:extensions.bzl%bun": { "//bun:extensions.bzl%bun": {
"general": { "general": {
"bzlTransitiveDigest": "314UOH4dQIGBHGpxCwA7yzI++E2J3bjIc20m5MZhM7U=", "bzlTransitiveDigest": "314UOH4dQIGBHGpxCwA7yzI++E2J3bjIc20m5MZhM7U=",
"usagesDigest": "Pk8TCTd2EBKQ8R+VSF0M7sU9apLb/5tBy/dP2pjs3AU=", "usagesDigest": "8lJhlTN0tALSLMIVpAoPHAUJ7DsvdI3M6FYRhgsDFtU=",
"recordedInputs": [ "recordedInputs": [
"REPO_MAPPING:,bazel_tools bazel_tools" "REPO_MAPPING:,bazel_tools bazel_tools"
], ],
@@ -284,7 +285,7 @@
"//bun:extensions.bzl%bun_install": { "//bun:extensions.bzl%bun_install": {
"general": { "general": {
"bzlTransitiveDigest": "314UOH4dQIGBHGpxCwA7yzI++E2J3bjIc20m5MZhM7U=", "bzlTransitiveDigest": "314UOH4dQIGBHGpxCwA7yzI++E2J3bjIc20m5MZhM7U=",
"usagesDigest": "2qW6PUxkK7CgK8mcsgVvlIbuJS/cBBkw5mylpKlqftE=", "usagesDigest": "x+qjsT8RcvKKj6+UXY1J8kq8wHRbimCNctw3IUTdYzY=",
"recordedInputs": [ "recordedInputs": [
"REPO_MAPPING:,bazel_tools bazel_tools" "REPO_MAPPING:,bazel_tools bazel_tools"
], ],

View File

@@ -80,7 +80,7 @@ Release announcements should provide a copy-pasteable module snippet in the
standard ruleset form: standard ruleset form:
```starlark ```starlark
bazel_dep(name = "rules_bun", version = "1.0.1") bazel_dep(name = "rules_bun", version = "1.0.2")
``` ```
Then add the Bun repositories and register the toolchains in `MODULE.bazel`: Then add the Bun repositories and register the toolchains in `MODULE.bazel`:

View File

@@ -1,3 +1,3 @@
1.0.1 1.0.2
stable stable
0 0

View File

@@ -15,7 +15,7 @@
... ...
}: }:
let let
bazelVersion = "9.0.0"; bazelVersion = "9.0.1";
in in
repo-lib.lib.mkRepo { repo-lib.lib.mkRepo {
inherit self nixpkgs; inherit self nixpkgs;
@@ -108,12 +108,6 @@
version.args = [ "--version" ]; version.args = [ "--version" ];
banner.color = "YELLOW"; banner.color = "YELLOW";
}) })
(repo-lib.lib.tools.fromPackage {
name = "Go";
package = pkgs.go;
version.args = [ "version" ];
banner.color = "CYAN";
})
(repo-lib.lib.tools.fromPackage { (repo-lib.lib.tools.fromPackage {
name = "Bazel"; name = "Bazel";
package = bazel9; package = bazel9;
@@ -123,20 +117,17 @@
]; ];
shell.packages = [ shell.packages = [
pkgs.gopls
pkgs.gotools
pkgs.bazel-buildtools pkgs.bazel-buildtools
self.packages.${system}.release self.packages.${system}.release
]; ];
checks.tests = { checks.tests = {
command = "bazel test //tests/..."; command = "bazelisk test //tests/...";
stage = "pre-push"; stage = "pre-push";
passFilenames = false; passFilenames = false;
runtimeInputs = [ runtimeInputs = [
bazel9 bazel9
pkgs.bun pkgs.bun
pkgs.go
]; ];
}; };
}; };

View File

@@ -197,7 +197,10 @@ sh_test(
name = "bundle_sourcemap_shape_test", name = "bundle_sourcemap_shape_test",
size = "small", size = "small",
srcs = ["verify_sourcemap_shape.sh"], srcs = ["verify_sourcemap_shape.sh"],
tags = ["exclusive"], tags = [
"exclusive",
"no-sandbox",
],
data = [ data = [
"BUILD.bazel", "BUILD.bazel",
"//:repo_runtime_files", "//:repo_runtime_files",
@@ -238,7 +241,10 @@ sh_test(
name = "bun_build_compile_flag_shape_test", name = "bun_build_compile_flag_shape_test",
size = "small", size = "small",
srcs = ["verify_flag_aquery.sh"], srcs = ["verify_flag_aquery.sh"],
tags = ["exclusive"], tags = [
"exclusive",
"no-sandbox",
],
data = [ data = [
"BUILD.bazel", "BUILD.bazel",
"cli.ts", "cli.ts",

View File

@@ -6,40 +6,7 @@ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
source "${script_dir}/../nested_bazel_test.sh" source "${script_dir}/../nested_bazel_test.sh"
setup_nested_bazel_cmd setup_nested_bazel_cmd
find_workspace_root() { rules_bun_root="$(find_nested_bazel_workspace_root "${BASH_SOURCE[0]}")"
local candidate
local module_path
local search_dir
for candidate in \
"${TEST_SRCDIR:-}/${TEST_WORKSPACE:-}" \
"${TEST_SRCDIR:-}/_main"; do
if [[ -n ${candidate} && -f "${candidate}/MODULE.bazel" ]]; then
printf '%s\n' "${candidate}"
return 0
fi
done
if [[ -n ${TEST_SRCDIR:-} ]]; then
module_path="$(find "${TEST_SRCDIR}" -maxdepth 3 -name MODULE.bazel -print -quit 2>/dev/null || true)"
if [[ -n ${module_path} ]]; then
dirname "${module_path}"
return 0
fi
fi
search_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
candidate="$(cd "${search_dir}/../.." && pwd -P)"
if [[ -f "${candidate}/MODULE.bazel" ]]; then
printf '%s\n' "${candidate}"
return 0
fi
echo "Unable to locate rules_bun workspace root" >&2
exit 1
}
rules_bun_root="$(find_workspace_root)"
cleanup() { cleanup() {
local status="$1" local status="$1"

View File

@@ -6,40 +6,7 @@ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
source "${script_dir}/../nested_bazel_test.sh" source "${script_dir}/../nested_bazel_test.sh"
setup_nested_bazel_cmd setup_nested_bazel_cmd
find_workspace_root() { rules_bun_root="$(find_nested_bazel_workspace_root "${BASH_SOURCE[0]}")"
local candidate
local module_path
local search_dir
for candidate in \
"${TEST_SRCDIR:-}/${TEST_WORKSPACE:-}" \
"${TEST_SRCDIR:-}/_main"; do
if [[ -n ${candidate} && -f "${candidate}/MODULE.bazel" ]]; then
printf '%s\n' "${candidate}"
return 0
fi
done
if [[ -n ${TEST_SRCDIR:-} ]]; then
module_path="$(find "${TEST_SRCDIR}" -maxdepth 3 -name MODULE.bazel -print -quit 2>/dev/null || true)"
if [[ -n ${module_path} ]]; then
dirname "${module_path}"
return 0
fi
fi
search_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
candidate="$(cd "${search_dir}/../.." && pwd -P)"
if [[ -f "${candidate}/MODULE.bazel" ]]; then
printf '%s\n' "${candidate}"
return 0
fi
echo "Unable to locate rules_bun workspace root" >&2
exit 1
}
rules_bun_root="$(find_workspace_root)"
cleanup() { cleanup() {
local status="$1" local status="$1"

View File

@@ -17,7 +17,7 @@ check_pattern() {
} }
check_pattern '^name:[[:space:]]+CI$' "missing workflow name CI" check_pattern '^name:[[:space:]]+CI$' "missing workflow name CI"
check_pattern 'USE_BAZEL_VERSION:[[:space:]]+9\.0\.0' "missing Bazel 9.0.0 pin" check_pattern 'USE_BAZEL_VERSION:[[:space:]]+9\.0\.1' "missing Bazel 9.0.1 pin"
check_pattern 'os:[[:space:]]+ubuntu-latest' "missing ubuntu matrix entry" check_pattern 'os:[[:space:]]+ubuntu-latest' "missing ubuntu matrix entry"
check_pattern 'phase8_target:[[:space:]]+linux-x64' "missing linux-x64 matrix target" check_pattern 'phase8_target:[[:space:]]+linux-x64' "missing linux-x64 matrix target"
check_pattern 'os:[[:space:]]+macos-14' "missing macos matrix entry" check_pattern 'os:[[:space:]]+macos-14' "missing macos matrix entry"

View File

@@ -148,7 +148,10 @@ sh_test(
name = "bun_install_workspace_parity_test", name = "bun_install_workspace_parity_test",
size = "large", size = "large",
srcs = ["workspace_parity.sh"], srcs = ["workspace_parity.sh"],
tags = ["exclusive"], tags = [
"exclusive",
"no-sandbox",
],
args = select({ args = select({
":linux_x86_64": ["$(location @bun_linux_x64//:bun)"], ":linux_x86_64": ["$(location @bun_linux_x64//:bun)"],
":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"], ":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"],
@@ -185,7 +188,10 @@ sh_test(
name = "bun_install_repeatability_test", name = "bun_install_repeatability_test",
size = "small", size = "small",
srcs = ["repeatability.sh"], srcs = ["repeatability.sh"],
tags = ["exclusive"], tags = [
"exclusive",
"no-sandbox",
],
args = select({ args = select({
":linux_x86_64": ["$(location @bun_linux_x64//:bun)"], ":linux_x86_64": ["$(location @bun_linux_x64//:bun)"],
":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"], ":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"],
@@ -214,7 +220,10 @@ sh_test(
name = "bun_install_lifecycle_scripts_test", name = "bun_install_lifecycle_scripts_test",
size = "small", size = "small",
srcs = ["lifecycle_scripts.sh"], srcs = ["lifecycle_scripts.sh"],
tags = ["exclusive"], tags = [
"exclusive",
"no-sandbox",
],
args = select({ args = select({
":linux_x86_64": ["$(location @bun_linux_x64//:bun)"], ":linux_x86_64": ["$(location @bun_linux_x64//:bun)"],
":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"], ":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"],

View File

@@ -8,7 +8,7 @@ setup_nested_bazel_cmd
bun_path="$1" bun_path="$1"
rules_bun_root="$(cd "${script_dir}/../.." && pwd -P)" rules_bun_root="$(find_nested_bazel_workspace_root "${BASH_SOURCE[0]}")"
workdir="$(mktemp -d)" workdir="$(mktemp -d)"
cleanup() { cleanup() {

View File

@@ -8,7 +8,7 @@ setup_nested_bazel_cmd
bun_path="$1" bun_path="$1"
rules_bun_root="$(cd "${script_dir}/../.." && pwd -P)" rules_bun_root="$(find_nested_bazel_workspace_root "${BASH_SOURCE[0]}")"
workdir="$(mktemp -d)" workdir="$(mktemp -d)"
cleanup() { cleanup() {

View File

@@ -8,7 +8,7 @@ setup_nested_bazel_cmd
bun_path="${1:-bun}" bun_path="${1:-bun}"
rules_bun_root="$(cd "${script_dir}/../.." && pwd -P)" rules_bun_root="$(find_nested_bazel_workspace_root "${BASH_SOURCE[0]}")"
workdir="$(mktemp -d)" workdir="$(mktemp -d)"
cleanup() { cleanup() {

View File

@@ -5,4 +5,4 @@ workflow_file="$1"
grep -Fq './tests/ci_test/phase8_ci_targets.sh "${{ matrix.phase8_target }}"' "${workflow_file}" grep -Fq './tests/ci_test/phase8_ci_targets.sh "${{ matrix.phase8_target }}"' "${workflow_file}"
grep -Fq 'targets="$(./tests/ci_test/phase8_ci_targets.sh "${{ matrix.phase8_target }}")"' "${workflow_file}" grep -Fq 'targets="$(./tests/ci_test/phase8_ci_targets.sh "${{ matrix.phase8_target }}")"' "${workflow_file}"
grep -Fq 'bazel test ${targets}' "${workflow_file}" grep -Fq 'bazel test --test_output=errors ${targets}' "${workflow_file}"

View File

@@ -1,24 +1,108 @@
#!/usr/bin/env bash #!/usr/bin/env bash
setup_nested_bazel_cmd() { setup_nested_bazel_cmd() {
if command -v bazel >/dev/null 2>&1; then local bazel_bin
bazel_cmd=(bazel) local nested_bazel_base
elif command -v bazelisk >/dev/null 2>&1; then local -a scrubbed_env_vars
bazel_cmd=(bazelisk)
if bazel_bin="$(command -v bazel 2>/dev/null)"; then
:
elif bazel_bin="$(command -v bazelisk 2>/dev/null)"; then
:
else else
echo "bazel or bazelisk is required on PATH" >&2 echo "bazel or bazelisk is required on PATH" >&2
exit 1 exit 1
fi fi
nested_bazel_base="${TEST_TMPDIR:-${TMPDIR:-/tmp}}/rules_bun_nested_bazel"
mkdir -p "${nested_bazel_base}"
nested_bazel_root="$(mktemp -d "${nested_bazel_base}/session.XXXXXX")"
mkdir -p "${nested_bazel_root}/tmp"
scrubbed_env_vars=(
BAZEL_TEST
BUILD_EXECROOT
COVERAGE_DIR
GTEST_OUTPUT
GTEST_SHARD_INDEX
GTEST_SHARD_STATUS_FILE
GTEST_TMP_DIR
GTEST_TOTAL_SHARDS
JAVA_RUNFILES
PYTHON_RUNFILES
RUNFILES_DIR
RUNFILES_MANIFEST_FILE
RUNFILES_MANIFEST_ONLY
TEST_BINARY
TEST_INFRASTRUCTURE_FAILURE_FILE
TEST_LOGSPLITTER_OUTPUT_FILE
TEST_PREMATURE_EXIT_FILE
TEST_SHARD_INDEX
TEST_SHARD_STATUS_FILE
TEST_SRCDIR
TEST_TARGET
TEST_TMPDIR
TEST_TOTAL_SHARDS
TEST_UNDECLARED_OUTPUTS_ANNOTATIONS
TEST_UNDECLARED_OUTPUTS_ANNOTATIONS_DIR
TEST_UNDECLARED_OUTPUTS_DIR
TEST_UNDECLARED_OUTPUTS_MANIFEST
TEST_UNDECLARED_OUTPUTS_ZIP
TEST_UNUSED_RUNFILES_LOG_FILE
TEST_WARNINGS_OUTPUT_FILE
XML_OUTPUT_FILE
)
nested_bazel_env=(env)
for env_var in "${scrubbed_env_vars[@]}"; do
nested_bazel_env+=("-u" "${env_var}")
done
nested_bazel_env+=("TMPDIR=${nested_bazel_root}/tmp")
bazel_cmd=(
"${nested_bazel_env[@]}"
"${bazel_bin}"
"--batch"
"--ignore_all_rc_files"
"--output_user_root=${nested_bazel_root}/output_user_root"
)
}
find_nested_bazel_workspace_root() {
local script_path="${1:-${BASH_SOURCE[0]}}"
local candidate
local script_dir
for candidate in \
"${TEST_SRCDIR:-}/${TEST_WORKSPACE:-}" \
"${TEST_SRCDIR:-}/_main"; do
if [[ -n ${candidate} && -f "${candidate}/MODULE.bazel" ]]; then
printf '%s\n' "${candidate}"
return 0
fi
done
script_dir="$(cd "$(dirname "${script_path}")" && pwd -P)"
candidate="$(cd "${script_dir}/../.." && pwd -P)"
if [[ -f "${candidate}/MODULE.bazel" ]]; then
printf '%s\n' "${candidate}"
return 0
fi
echo "Unable to locate rules_bun workspace root" >&2
exit 1
} }
shutdown_nested_bazel_workspace() { shutdown_nested_bazel_workspace() {
local workspace_dir="${1:-}" local workspace_dir="${1:-}"
if [[ -z ${workspace_dir} || ! -d ${workspace_dir} ]]; then if [[ -n ${workspace_dir} && -d ${workspace_dir} ]]; then
return 0
fi
( (
cd "${workspace_dir}" cd "${workspace_dir}"
"${bazel_cmd[@]}" shutdown >/dev/null 2>&1 "${bazel_cmd[@]}" shutdown >/dev/null 2>&1
) || true ) || true
fi
if [[ -n ${nested_bazel_root:-} && -d ${nested_bazel_root} ]]; then
rm -rf "${nested_bazel_root}"
fi
} }

View File

@@ -44,7 +44,10 @@ sh_test(
name = "npm_translate_lock_workspace_test", name = "npm_translate_lock_workspace_test",
size = "small", size = "small",
srcs = ["npm_translate_lock_workspace_test.sh"], srcs = ["npm_translate_lock_workspace_test.sh"],
tags = ["exclusive"], tags = [
"exclusive",
"no-sandbox",
],
args = select({ args = select({
":linux_x86_64": ["$(location @bun_linux_x64//:bun)"], ":linux_x86_64": ["$(location @bun_linux_x64//:bun)"],
":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"], ":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"],

View File

@@ -8,7 +8,7 @@ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
source "${script_dir}/../nested_bazel_test.sh" source "${script_dir}/../nested_bazel_test.sh"
setup_nested_bazel_cmd setup_nested_bazel_cmd
rules_bun_root="$(cd "${script_dir}/../.." && pwd -P)" rules_bun_root="$(find_nested_bazel_workspace_root "${BASH_SOURCE[0]}")"
workdir="$(mktemp -d)" workdir="$(mktemp -d)"
cleanup() { cleanup() {