diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33118bd..df192ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: USE_BAZEL_VERSION: 9.0.0 steps: - uses: actions/checkout@v4 - - uses: bazel-contrib/setup-bazel@0.15.0 + - uses: bazel-contrib/setup-bazel@0.18.0 with: bazelisk-cache: true repository-cache: true @@ -36,6 +36,8 @@ jobs: disk-cache: ci-${{ matrix.phase8_target }} cache-save: ${{ github.event_name != 'pull_request' }} - name: Run tests (${{ matrix.phase8_target }}) + shell: bash run: | echo "Phase 8 target: ${{ matrix.phase8_target }}" - bazel test //tests/... + targets="$(./tests/ci_test/phase8_ci_targets.sh "${{ matrix.phase8_target }}")" + bazel test ${targets} diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index eeaa683..e607f1c 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -30,7 +30,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: bazel-contrib/setup-bazel@0.15.0 + - uses: bazel-contrib/setup-bazel@0.18.0 with: bazelisk-cache: true repository-cache: true diff --git a/tests/ci_test/BUILD.bazel b/tests/ci_test/BUILD.bazel index ffe0e4a..aabc41d 100644 --- a/tests/ci_test/BUILD.bazel +++ b/tests/ci_test/BUILD.bazel @@ -8,6 +8,14 @@ sh_test( data = ["//.github/workflows:ci.yml"], ) +sh_test( + name = "phase8_ci_targets_test", + size = "small", + srcs = ["phase8_ci_targets_test.sh"], + args = ["$(location :phase8_ci_targets.sh)"], + data = [":phase8_ci_targets.sh"], +) + sh_test( name = "native_wrapper_shape_test", size = "small", diff --git a/tests/ci_test/phase8_ci_matrix_shape_test.sh b/tests/ci_test/phase8_ci_matrix_shape_test.sh index 74bb0f5..3047044 100755 --- a/tests/ci_test/phase8_ci_matrix_shape_test.sh +++ b/tests/ci_test/phase8_ci_matrix_shape_test.sh @@ -22,6 +22,17 @@ check_pattern 'os:[[:space:]]+ubuntu-latest' "missing ubuntu matrix entry" check_pattern 'phase8_target:[[:space:]]+linux-x64' "missing linux-x64 matrix target" check_pattern 'os:[[:space:]]+macos-14' "missing macos matrix entry" check_pattern 'phase8_target:[[:space:]]+darwin-arm64' "missing darwin-arm64 matrix target" -check_pattern 'os:[[:space:]]+windows-latest' "missing windows matrix entry" -check_pattern 'phase8_target:[[:space:]]+windows' "missing windows matrix target" + +has_windows_os=0 +has_windows_target=0 +if grep -Eq 'os:[[:space:]]+windows-latest' "${workflow_file}"; then + has_windows_os=1 +fi +if grep -Eq 'phase8_target:[[:space:]]+windows' "${workflow_file}"; then + has_windows_target=1 +fi +if [[ ${has_windows_os} -ne ${has_windows_target} ]]; then + echo "Error: windows matrix entry and windows phase8 target must be added or removed together" >&2 + exit 1 +fi echo "CI matrix shape checks passed" diff --git a/tests/ci_test/phase8_ci_targets.sh b/tests/ci_test/phase8_ci_targets.sh new file mode 100755 index 0000000..0730477 --- /dev/null +++ b/tests/ci_test/phase8_ci_targets.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -euo pipefail + +phase8_target="${1:-}" +if [[ -z ${phase8_target} ]]; then + echo "Error: phase8 target required as first argument" >&2 + exit 1 +fi + +case "${phase8_target}" in +linux-x64 | darwin-arm64) + printf '%s\n' "//tests/..." + ;; +windows) + printf '%s\n' \ + "//tests/binary_test/..." \ + "//tests/bun_test_test/..." \ + "//tests/ci_test/..." \ + "//tests/js_compat_test/..." \ + "//tests/script_test/..." \ + "//tests/toolchain_test/..." + ;; +*) + echo "Error: unsupported phase8 target: ${phase8_target}" >&2 + exit 1 + ;; +esac diff --git a/tests/ci_test/phase8_ci_targets_test.sh b/tests/ci_test/phase8_ci_targets_test.sh new file mode 100755 index 0000000..9be6cfe --- /dev/null +++ b/tests/ci_test/phase8_ci_targets_test.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -euo pipefail + +resolver="${1:-}" +if [[ -z ${resolver} ]]; then + echo "Error: resolver path required as first argument" >&2 + exit 1 +fi + +linux_targets="$("${resolver}" linux-x64)" +if [[ ${linux_targets} != "//tests/..." ]]; then + echo "Error: linux-x64 should resolve to //tests/..." >&2 + exit 1 +fi + +darwin_targets="$("${resolver}" darwin-arm64)" +if [[ ${darwin_targets} != "//tests/..." ]]; then + echo "Error: darwin-arm64 should resolve to //tests/..." >&2 + exit 1 +fi + +windows_targets="$("${resolver}" windows)" +expected_windows_targets="$( + cat <<'EOF' +//tests/binary_test/... +//tests/bun_test_test/... +//tests/ci_test/... +//tests/js_compat_test/... +//tests/script_test/... +//tests/toolchain_test/... +EOF +)" +if [[ ${windows_targets} != "${expected_windows_targets}" ]]; then + echo "Error: unexpected windows targets" >&2 + printf 'Expected:\n%s\nActual:\n%s\n' "${expected_windows_targets}" "${windows_targets}" >&2 + exit 1 +fi + +if "${resolver}" unsupported >/dev/null 2>&1; then + echo "Error: unsupported phase8 target should fail" >&2 + exit 1 +fi + +echo "Phase 8 CI targets resolve correctly" diff --git a/tests/install_test/BUILD.bazel b/tests/install_test/BUILD.bazel index 9876699..fbc82fc 100644 --- a/tests/install_test/BUILD.bazel +++ b/tests/install_test/BUILD.bazel @@ -32,6 +32,14 @@ config_setting( ], ) +config_setting( + name = "windows_x86_64", + constraint_values = [ + "@platforms//os:windows", + "@platforms//cpu:x86_64", + ], +) + sh_test( name = "bun_install_clean_install_test", size = "small", @@ -41,6 +49,7 @@ sh_test( ":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"], ":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"], ":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"], + ":windows_x86_64": ["$(location @bun_windows_x64//:bun)"], "//conditions:default": ["$(location @bun_linux_x64//:bun)"], }), data = select({ @@ -48,6 +57,7 @@ sh_test( ":linux_aarch64": ["@bun_linux_aarch64//:bun"], ":darwin_x86_64": ["@bun_darwin_x64//:bun"], ":darwin_aarch64": ["@bun_darwin_aarch64//:bun"], + ":windows_x86_64": ["@bun_windows_x64//:bun"], "//conditions:default": ["@bun_linux_x64//:bun"], }), ) @@ -61,6 +71,7 @@ sh_test( ":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"], ":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"], ":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"], + ":windows_x86_64": ["$(location @bun_windows_x64//:bun)"], "//conditions:default": ["$(location @bun_linux_x64//:bun)"], }), data = select({ @@ -68,6 +79,7 @@ sh_test( ":linux_aarch64": ["@bun_linux_aarch64//:bun"], ":darwin_x86_64": ["@bun_darwin_x64//:bun"], ":darwin_aarch64": ["@bun_darwin_aarch64//:bun"], + ":windows_x86_64": ["@bun_windows_x64//:bun"], "//conditions:default": ["@bun_linux_x64//:bun"], }), ) @@ -97,6 +109,7 @@ sh_test( ":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"], ":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"], ":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"], + ":windows_x86_64": ["$(location @bun_windows_x64//:bun)"], "//conditions:default": ["$(location @bun_linux_x64//:bun)"], }), data = select({ @@ -104,6 +117,7 @@ sh_test( ":linux_aarch64": ["@bun_linux_aarch64//:bun"], ":darwin_x86_64": ["@bun_darwin_x64//:bun"], ":darwin_aarch64": ["@bun_darwin_aarch64//:bun"], + ":windows_x86_64": ["@bun_windows_x64//:bun"], "//conditions:default": ["@bun_linux_x64//:bun"], }), ) @@ -117,6 +131,7 @@ sh_test( ":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"], ":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"], ":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"], + ":windows_x86_64": ["$(location @bun_windows_x64//:bun)"], "//conditions:default": ["$(location @bun_linux_x64//:bun)"], }), data = select({ @@ -124,6 +139,7 @@ sh_test( ":linux_aarch64": ["@bun_linux_aarch64//:bun"], ":darwin_x86_64": ["@bun_darwin_x64//:bun"], ":darwin_aarch64": ["@bun_darwin_aarch64//:bun"], + ":windows_x86_64": ["@bun_windows_x64//:bun"], "//conditions:default": ["@bun_linux_x64//:bun"], }), ) @@ -136,6 +152,7 @@ sh_test( ":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"], ":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"], ":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"], + ":windows_x86_64": ["$(location @bun_windows_x64//:bun)"], "//conditions:default": ["$(location @bun_linux_x64//:bun)"], }), data = select({ @@ -143,6 +160,7 @@ sh_test( ":linux_aarch64": ["@bun_linux_aarch64//:bun"], ":darwin_x86_64": ["@bun_darwin_x64//:bun"], ":darwin_aarch64": ["@bun_darwin_aarch64//:bun"], + ":windows_x86_64": ["@bun_windows_x64//:bun"], "//conditions:default": ["@bun_linux_x64//:bun"], }) + [ "//:repo_runtime_files", @@ -169,6 +187,7 @@ sh_test( ":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"], ":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"], ":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"], + ":windows_x86_64": ["$(location @bun_windows_x64//:bun)"], "//conditions:default": ["$(location @bun_linux_x64//:bun)"], }), data = select({ @@ -176,6 +195,7 @@ sh_test( ":linux_aarch64": ["@bun_linux_aarch64//:bun"], ":darwin_x86_64": ["@bun_darwin_x64//:bun"], ":darwin_aarch64": ["@bun_darwin_aarch64//:bun"], + ":windows_x86_64": ["@bun_windows_x64//:bun"], "//conditions:default": ["@bun_linux_x64//:bun"], }) + [ "//:repo_runtime_files", @@ -194,6 +214,7 @@ sh_test( ":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"], ":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"], ":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"], + ":windows_x86_64": ["$(location @bun_windows_x64//:bun)"], "//conditions:default": ["$(location @bun_linux_x64//:bun)"], }), data = select({ @@ -201,6 +222,7 @@ sh_test( ":linux_aarch64": ["@bun_linux_aarch64//:bun"], ":darwin_x86_64": ["@bun_darwin_x64//:bun"], ":darwin_aarch64": ["@bun_darwin_aarch64//:bun"], + ":windows_x86_64": ["@bun_windows_x64//:bun"], "//conditions:default": ["@bun_linux_x64//:bun"], }) + [ "//:repo_runtime_files", diff --git a/tests/integration_test/repo_all_targets_test.sh b/tests/integration_test/repo_all_targets_test.sh index e136ed6..50f8f8e 100755 --- a/tests/integration_test/repo_all_targets_test.sh +++ b/tests/integration_test/repo_all_targets_test.sh @@ -3,4 +3,6 @@ set -euo pipefail workflow_file="$1" -grep -Eq 'bazel test //(tests/)?\.\.\.' "${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 'bazel test ${targets}' "${workflow_file}" diff --git a/tests/npm_compat_test/BUILD.bazel b/tests/npm_compat_test/BUILD.bazel index 2e4ea46..1e07a70 100644 --- a/tests/npm_compat_test/BUILD.bazel +++ b/tests/npm_compat_test/BUILD.bazel @@ -32,6 +32,14 @@ config_setting( ], ) +config_setting( + name = "windows_x86_64", + constraint_values = [ + "@platforms//os:windows", + "@platforms//cpu:x86_64", + ], +) + sh_test( name = "npm_translate_lock_workspace_test", size = "small", @@ -41,6 +49,7 @@ sh_test( ":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"], ":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"], ":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"], + ":windows_x86_64": ["$(location @bun_windows_x64//:bun)"], "//conditions:default": ["$(location @bun_linux_x64//:bun)"], }), data = select({ @@ -48,6 +57,7 @@ sh_test( ":linux_aarch64": ["@bun_linux_aarch64//:bun"], ":darwin_x86_64": ["@bun_darwin_x64//:bun"], ":darwin_aarch64": ["@bun_darwin_aarch64//:bun"], + ":windows_x86_64": ["@bun_windows_x64//:bun"], "//conditions:default": ["@bun_linux_x64//:bun"], }) + [ "//:repo_runtime_files", diff --git a/tests/toolchain_test/BUILD.bazel b/tests/toolchain_test/BUILD.bazel index 66ad8dd..9c7a684 100644 --- a/tests/toolchain_test/BUILD.bazel +++ b/tests/toolchain_test/BUILD.bazel @@ -32,6 +32,14 @@ config_setting( ], ) +config_setting( + name = "windows_x86_64", + constraint_values = [ + "@platforms//os:windows", + "@platforms//cpu:x86_64", + ], +) + sh_test( name = "bun_version_test", size = "small", @@ -41,6 +49,7 @@ sh_test( ":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"], ":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"], ":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"], + ":windows_x86_64": ["$(location @bun_windows_x64//:bun)"], "//conditions:default": ["$(location @bun_linux_x64//:bun)"], }), data = select({ @@ -48,6 +57,7 @@ sh_test( ":linux_aarch64": ["@bun_linux_aarch64//:bun"], ":darwin_x86_64": ["@bun_darwin_x64//:bun"], ":darwin_aarch64": ["@bun_darwin_aarch64//:bun"], + ":windows_x86_64": ["@bun_windows_x64//:bun"], "//conditions:default": ["@bun_linux_x64//:bun"], }), )