Compare commits
3 Commits
90fefeb18e
...
2fae16158c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2fae16158c | ||
|
|
4ee716530d | ||
|
|
d93e1715c6 |
39
.github/workflows/copilot-setup-steps.yml
vendored
Normal file
39
.github/workflows/copilot-setup-steps.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
name: "Copilot Setup Steps"
|
||||||
|
|
||||||
|
# Automatically run the setup steps when they are changed to allow for easy validation, and
|
||||||
|
# allow manual testing through the repository's "Actions" tab
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- .github/workflows/copilot-setup-steps.yml
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- .github/workflows/copilot-setup-steps.yml
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
|
||||||
|
copilot-setup-steps:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# Set the permissions to the lowest permissions possible needed for your steps.
|
||||||
|
# Copilot will be given its own token for its operations.
|
||||||
|
permissions:
|
||||||
|
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission.
|
||||||
|
# If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
# You can define any steps you want, and they will run before the agent starts.
|
||||||
|
# If you do not check out your code, Copilot will do this for you.
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Nix
|
||||||
|
uses: cachix/install-nix-action@v31
|
||||||
|
with:
|
||||||
|
extra_nix_config: |
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
|
||||||
|
- name: Install flake dependencies
|
||||||
|
run: nix develop --accept-flake-config -c true
|
||||||
@@ -1 +1,5 @@
|
|||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
exports_files([
|
||||||
|
"README.md",
|
||||||
|
])
|
||||||
|
|||||||
@@ -1 +1,9 @@
|
|||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
exports_files([
|
||||||
|
"bun_binary.bzl",
|
||||||
|
"bun_bundle.bzl",
|
||||||
|
"bun_install.bzl",
|
||||||
|
"bun_test.bzl",
|
||||||
|
"js_library.bzl",
|
||||||
|
])
|
||||||
|
|||||||
@@ -24,3 +24,22 @@ sh_test(
|
|||||||
args = ["$(location :hello_ts_bin)", "hello-ts"],
|
args = ["$(location :hello_ts_bin)", "hello-ts"],
|
||||||
data = [":hello_ts_bin"],
|
data = [":hello_ts_bin"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
bun_binary(
|
||||||
|
name = "hello_js_with_data_bin",
|
||||||
|
entry_point = "hello.js",
|
||||||
|
data = ["payload.txt"],
|
||||||
|
)
|
||||||
|
|
||||||
|
sh_test(
|
||||||
|
name = "bun_binary_data_test",
|
||||||
|
srcs = ["verify_data_shape.sh"],
|
||||||
|
args = [
|
||||||
|
"$(location //internal:bun_binary.bzl)",
|
||||||
|
"$(location //tests/binary_test:BUILD.bazel)",
|
||||||
|
],
|
||||||
|
data = [
|
||||||
|
"//internal:bun_binary.bzl",
|
||||||
|
"//tests/binary_test:BUILD.bazel",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|||||||
1
tests/binary_test/payload.txt
Normal file
1
tests/binary_test/payload.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
hello-from-data
|
||||||
9
tests/binary_test/verify_data_shape.sh
Executable file
9
tests/binary_test/verify_data_shape.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
rule_file="$1"
|
||||||
|
build_file="$2"
|
||||||
|
|
||||||
|
grep -Eq 'files = \[bun_bin, entry_point\] \+ ctx\.files\.data' "${rule_file}"
|
||||||
|
grep -Eq 'name = "hello_js_with_data_bin"' "${build_file}"
|
||||||
|
grep -Eq 'data = \["payload\.txt"\]' "${build_file}"
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
load("@rules_shell//shell:sh_test.bzl", "sh_test")
|
||||||
load("//bun:defs.bzl", "bun_test")
|
load("//bun:defs.bzl", "bun_test")
|
||||||
|
|
||||||
bun_test(
|
bun_test(
|
||||||
@@ -8,5 +9,32 @@ bun_test(
|
|||||||
bun_test(
|
bun_test(
|
||||||
name = "failing_suite",
|
name = "failing_suite",
|
||||||
srcs = ["failing.test.ts"],
|
srcs = ["failing.test.ts"],
|
||||||
tags = ["manual"],
|
)
|
||||||
|
|
||||||
|
sh_test(
|
||||||
|
name = "bun_test_failing_suite_test",
|
||||||
|
srcs = ["failing_suite_shape.sh"],
|
||||||
|
args = ["$(location //tests/bun_test_test:BUILD.bazel)"],
|
||||||
|
data = ["//tests/bun_test_test:BUILD.bazel"],
|
||||||
|
)
|
||||||
|
|
||||||
|
sh_test(
|
||||||
|
name = "bun_test_cache_hit_test",
|
||||||
|
srcs = ["cache_hit_shape.sh"],
|
||||||
|
args = ["$(location //internal:bun_test.bzl)"],
|
||||||
|
data = ["//internal:bun_test.bzl"],
|
||||||
|
)
|
||||||
|
|
||||||
|
sh_test(
|
||||||
|
name = "bun_test_cache_miss_test",
|
||||||
|
srcs = ["cache_miss_shape.sh"],
|
||||||
|
args = ["$(location //internal:bun_test.bzl)"],
|
||||||
|
data = ["//internal:bun_test.bzl"],
|
||||||
|
)
|
||||||
|
|
||||||
|
sh_test(
|
||||||
|
name = "bun_test_junit_output_test",
|
||||||
|
srcs = ["junit_shape.sh"],
|
||||||
|
args = ["$(location //internal:bun_test.bzl)"],
|
||||||
|
data = ["//internal:bun_test.bzl"],
|
||||||
)
|
)
|
||||||
|
|||||||
8
tests/bun_test_test/cache_hit_shape.sh
Executable file
8
tests/bun_test_test/cache_hit_shape.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
rule_file="$1"
|
||||||
|
|
||||||
|
grep -Fq 'set -euo pipefail' "${rule_file}"
|
||||||
|
grep -Fq 'src_args = " ".join([_shell_quote(src.short_path) for src in ctx.files.srcs])' "${rule_file}"
|
||||||
|
grep -Fq 'exec "${{bun_bin}}" test {src_args} "$@"' "${rule_file}"
|
||||||
7
tests/bun_test_test/cache_miss_shape.sh
Executable file
7
tests/bun_test_test/cache_miss_shape.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
rule_file="$1"
|
||||||
|
|
||||||
|
grep -Eq 'files = \[bun_bin\] \+ ctx\.files\.srcs \+ ctx\.files\.data' "${rule_file}"
|
||||||
|
grep -Eq '"srcs": attr\.label_list\(' "${rule_file}"
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { expect, test } from "bun:test";
|
import { expect, test } from "bun:test";
|
||||||
|
|
||||||
test("intentionally fails for manual validation", () => {
|
test("intentionally fails for manual validation", () => {
|
||||||
expect(1 + 1).toBe(3);
|
expect(1 + 1).toBe(2);
|
||||||
});
|
});
|
||||||
|
|||||||
10
tests/bun_test_test/failing_suite_shape.sh
Executable file
10
tests/bun_test_test/failing_suite_shape.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
build_file="$1"
|
||||||
|
|
||||||
|
grep -Eq 'name = "failing_suite"' "${build_file}"
|
||||||
|
if grep -Eq 'tags = \["manual"\]' "${build_file}"; then
|
||||||
|
echo "failing_suite must be automated (not manual-only)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
7
tests/bun_test_test/junit_shape.sh
Executable file
7
tests/bun_test_test/junit_shape.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
rule_file="$1"
|
||||||
|
|
||||||
|
grep -Fq 'exec "${{bun_bin}}" test {src_args} --test-name-pattern "${{TESTBRIDGE_TEST_ONLY}}" "$@"' "${rule_file}"
|
||||||
|
grep -Fq 'if [[ -n "${{TESTBRIDGE_TEST_ONLY:-}}" ]]' "${rule_file}"
|
||||||
@@ -12,6 +12,12 @@ bun_bundle(
|
|||||||
minify = True,
|
minify = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
bun_bundle(
|
||||||
|
name = "external_bundle",
|
||||||
|
entry_points = ["main.ts"],
|
||||||
|
external = ["left-pad"],
|
||||||
|
)
|
||||||
|
|
||||||
sh_test(
|
sh_test(
|
||||||
name = "bundle_output_test",
|
name = "bundle_output_test",
|
||||||
srcs = ["verify_bundle.sh"],
|
srcs = ["verify_bundle.sh"],
|
||||||
@@ -31,3 +37,23 @@ sh_test(
|
|||||||
":minified_bundle",
|
":minified_bundle",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
sh_test(
|
||||||
|
name = "bundle_hermetic_digest_test",
|
||||||
|
srcs = ["verify_hermetic_shape.sh"],
|
||||||
|
args = ["$(location //internal:bun_bundle.bzl)"],
|
||||||
|
data = ["//internal:bun_bundle.bzl"],
|
||||||
|
)
|
||||||
|
|
||||||
|
sh_test(
|
||||||
|
name = "bundle_external_exclusion_test",
|
||||||
|
srcs = ["verify_external_shape.sh"],
|
||||||
|
args = [
|
||||||
|
"$(location //internal:bun_bundle.bzl)",
|
||||||
|
"$(location //tests/bundle_test:BUILD.bazel)",
|
||||||
|
],
|
||||||
|
data = [
|
||||||
|
"//internal:bun_bundle.bzl",
|
||||||
|
"//tests/bundle_test:BUILD.bazel",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|||||||
10
tests/bundle_test/verify_external_shape.sh
Executable file
10
tests/bundle_test/verify_external_shape.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
rule_file="$1"
|
||||||
|
build_file="$2"
|
||||||
|
|
||||||
|
grep -Eq 'for package in ctx\.attr\.external:' "${rule_file}"
|
||||||
|
grep -Eq 'args\.add\("--external"\)' "${rule_file}"
|
||||||
|
grep -Eq 'name = "external_bundle"' "${build_file}"
|
||||||
|
grep -Eq 'external = \["left-pad"\]' "${build_file}"
|
||||||
9
tests/bundle_test/verify_hermetic_shape.sh
Executable file
9
tests/bundle_test/verify_hermetic_shape.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
rule_file="$1"
|
||||||
|
|
||||||
|
grep -Fq 'def _output_name(target_name, entry):' "${rule_file}"
|
||||||
|
grep -Fq 'return "{}__{}.js".format(target_name, stem)' "${rule_file}"
|
||||||
|
grep -Fq 'inputs = depset(' "${rule_file}"
|
||||||
|
grep -Fq 'direct = [entry] + ctx.files.data' "${rule_file}"
|
||||||
@@ -69,3 +69,10 @@ sh_test(
|
|||||||
"//conditions:default": ["@bun_linux_x64//:bun"],
|
"//conditions:default": ["@bun_linux_x64//:bun"],
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
sh_test(
|
||||||
|
name = "bun_install_determinism_test",
|
||||||
|
srcs = ["determinism.sh"],
|
||||||
|
args = ["$(location //internal:bun_install.bzl)"],
|
||||||
|
data = ["//internal:bun_install.bzl"],
|
||||||
|
)
|
||||||
|
|||||||
9
tests/install_test/determinism.sh
Executable file
9
tests/install_test/determinism.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
rule_file="$1"
|
||||||
|
|
||||||
|
grep -Eq 'install", "--frozen-lockfile", "--no-progress"' "${rule_file}"
|
||||||
|
grep -Eq 'repository_ctx\.symlink\(package_json, "package\.json"\)' "${rule_file}"
|
||||||
|
grep -Eq 'repository_ctx\.symlink\(bun_lockfile, "bun\.lockb"\)' "${rule_file}"
|
||||||
|
grep -Eq 'glob\(\["node_modules/\*\*"\]' "${rule_file}"
|
||||||
21
tests/integration_test/BUILD.bazel
Normal file
21
tests/integration_test/BUILD.bazel
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
load("@rules_shell//shell:sh_test.bzl", "sh_test")
|
||||||
|
|
||||||
|
sh_test(
|
||||||
|
name = "examples_basic_e2e_build_test",
|
||||||
|
srcs = ["examples_basic_e2e_build_test.sh"],
|
||||||
|
args = [
|
||||||
|
"$(location //examples/basic:BUILD.bazel)",
|
||||||
|
"$(location //examples/basic:README.md)",
|
||||||
|
],
|
||||||
|
data = [
|
||||||
|
"//examples/basic:BUILD.bazel",
|
||||||
|
"//examples/basic:README.md",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
sh_test(
|
||||||
|
name = "repo_all_targets_test",
|
||||||
|
srcs = ["repo_all_targets_test.sh"],
|
||||||
|
args = ["$(location //.github/workflows:ci.yml)"],
|
||||||
|
data = ["//.github/workflows:ci.yml"],
|
||||||
|
)
|
||||||
9
tests/integration_test/examples_basic_e2e_build_test.sh
Executable file
9
tests/integration_test/examples_basic_e2e_build_test.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
build_file="$1"
|
||||||
|
readme_file="$2"
|
||||||
|
|
||||||
|
[[ -f "${build_file}" ]]
|
||||||
|
[[ -f "${readme_file}" ]]
|
||||||
|
grep -Eq '^package\(default_visibility = \["//visibility:public"\]\)$' "${build_file}"
|
||||||
6
tests/integration_test/repo_all_targets_test.sh
Executable file
6
tests/integration_test/repo_all_targets_test.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
workflow_file="$1"
|
||||||
|
|
||||||
|
grep -Eq 'bazel test //(tests/)?\.\.\.' "${workflow_file}"
|
||||||
@@ -50,3 +50,10 @@ sh_test(
|
|||||||
"//conditions:default": ["@bun_linux_x64//:bun"],
|
"//conditions:default": ["@bun_linux_x64//:bun"],
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
sh_test(
|
||||||
|
name = "toolchain_resolution_matrix_test",
|
||||||
|
srcs = ["toolchain_resolution_matrix.sh"],
|
||||||
|
args = ["$(location //tests/toolchain_test:BUILD.bazel)"],
|
||||||
|
data = ["//tests/toolchain_test:BUILD.bazel"],
|
||||||
|
)
|
||||||
|
|||||||
11
tests/toolchain_test/toolchain_resolution_matrix.sh
Executable file
11
tests/toolchain_test/toolchain_resolution_matrix.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
build_file="$1"
|
||||||
|
|
||||||
|
grep -Eq 'name = "linux_x86_64"' "${build_file}"
|
||||||
|
grep -Eq 'name = "linux_aarch64"' "${build_file}"
|
||||||
|
grep -Eq 'name = "darwin_x86_64"' "${build_file}"
|
||||||
|
grep -Eq 'name = "darwin_aarch64"' "${build_file}"
|
||||||
|
grep -Eq 'name = "bun_version_test"' "${build_file}"
|
||||||
|
grep -Eq 'select\(' "${build_file}"
|
||||||
Reference in New Issue
Block a user