diff --git a/.github/scripts/run-bazel-query-ci.sh b/.github/scripts/run-bazel-query-ci.sh index 1ed664e44b..dd03b67169 100755 --- a/.github/scripts/run-bazel-query-ci.sh +++ b/.github/scripts/run-bazel-query-ci.sh @@ -6,8 +6,13 @@ set -euo pipefail # invocation so target-discovery queries can reuse the same Bazel server. query_args=() +windows_cross_compile=0 while [[ $# -gt 0 ]]; do case "$1" in + --windows-cross-compile) + windows_cross_compile=1 + shift + ;; --) shift break @@ -20,7 +25,7 @@ while [[ $# -gt 0 ]]; do done if [[ $# -ne 1 ]]; then - echo "Usage: $0 [...] -- " >&2 + echo "Usage: $0 [--windows-cross-compile] [...] -- " >&2 exit 1 fi @@ -32,7 +37,11 @@ case "${RUNNER_OS:-}" in ci_config=ci-macos ;; Windows) - ci_config=ci-windows + if [[ $windows_cross_compile -eq 1 ]]; then + ci_config=ci-windows-cross + else + ci_config=ci-windows + fi ;; esac diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index ef7520523a..d98bd4f874 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -251,17 +251,24 @@ jobs: --build_metadata=TAG_job=clippy ) bazel_wrapper_args=() + bazel_target_list_args=() if [[ "${RUNNER_OS}" == "Windows" ]]; then - # Keep this aligned with the Windows Bazel test job. With the - # default `//:local_windows` host platform, Windows `rust_test` - # targets such as `//codex-rs/core:core-all-test` can be skipped - # by `--skip_incompatible_explicit_targets`, which hides clippy - # diagnostics from integration-test modules. - bazel_wrapper_args+=(--windows-msvc-host-platform) - bazel_clippy_args+=(--skip_incompatible_explicit_targets) + # Keep this aligned with the fast Windows Bazel test job: use + # Linux RBE for clippy build actions while targeting Windows + # gnullvm. Fork/community PRs without the BuildBuddy secret fall + # back inside `run-bazel-ci.sh` to the previous local Windows MSVC + # host-platform shape. + bazel_wrapper_args+=(--windows-cross-compile) + bazel_target_list_args+=(--windows-cross-compile) + if [[ -z "${BUILDBUDDY_API_KEY:-}" ]]; then + # The fork fallback can see incompatible explicit Windows-cross + # internal test binaries in the generated target list. Preserve + # the old local-fallback behavior there. + bazel_clippy_args+=(--skip_incompatible_explicit_targets) + fi fi - bazel_target_lines="$(./scripts/list-bazel-clippy-targets.sh)" + bazel_target_lines="$(./scripts/list-bazel-clippy-targets.sh "${bazel_target_list_args[@]}")" bazel_targets=() while IFS= read -r target; do bazel_targets+=("${target}") @@ -333,7 +340,12 @@ jobs: # Rust debug assertions explicitly. bazel_wrapper_args=() if [[ "${RUNNER_OS}" == "Windows" ]]; then - bazel_wrapper_args+=(--windows-msvc-host-platform) + # This is build-only signal, so use the same Linux-RBE + # cross-compile path as the fast Windows test and clippy jobs. + # Fork/community PRs without the BuildBuddy secret fall back + # inside `run-bazel-ci.sh` to the previous local Windows MSVC + # host-platform shape. + bazel_wrapper_args+=(--windows-cross-compile) fi bazel_build_args=( diff --git a/scripts/list-bazel-clippy-targets.sh b/scripts/list-bazel-clippy-targets.sh index 141d0cf48d..8cfa60ba19 100755 --- a/scripts/list-bazel-clippy-targets.sh +++ b/scripts/list-bazel-clippy-targets.sh @@ -5,15 +5,38 @@ set -euo pipefail repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "${repo_root}" +windows_cross_compile=0 +while [[ $# -gt 0 ]]; do + case "$1" in + --windows-cross-compile) + windows_cross_compile=1 + shift + ;; + *) + echo "Usage: $0 [--windows-cross-compile]" >&2 + exit 1 + ;; + esac +done + # Resolve the dynamic targets before printing anything so callers do not # continue with a partial list if `bazel query` fails. Reuse the same CI Bazel # server settings as the subsequent build so Windows jobs do not cold-start a # second Bazel server just for target discovery. -manual_rust_test_targets="$( - ./.github/scripts/run-bazel-query-ci.sh \ - --output=label \ - -- 'kind("rust_test rule", attr(tags, "manual", //codex-rs/... except //codex-rs/v8-poc/...))' -)" +if [[ $windows_cross_compile -eq 1 ]]; then + manual_rust_test_targets="$( + ./.github/scripts/run-bazel-query-ci.sh \ + --windows-cross-compile \ + --output=label \ + -- 'kind("rust_test rule", attr(tags, "manual", //codex-rs/... except //codex-rs/v8-poc/...))' + )" +else + manual_rust_test_targets="$( + ./.github/scripts/run-bazel-query-ci.sh \ + --output=label \ + -- 'kind("rust_test rule", attr(tags, "manual", //codex-rs/... except //codex-rs/v8-poc/...))' + )" +fi if [[ "${RUNNER_OS:-}" != "Windows" ]]; then manual_rust_test_targets="$(printf '%s\n' "${manual_rust_test_targets}" | grep -v -- '-windows-cross-bin$' || true)" fi