Compare commits

...

3 Commits

Author SHA1 Message Date
starr-openai
b5e523ca1f Experiment with Windows cross-remote Bazel tests
Add an opt-in ci-windows-cross config that sends build actions to Linux RBE while keeping test execution local on the Windows runner.

Co-authored-by: Codex <noreply@openai.com>
2026-04-16 14:16:11 -07:00
starr-openai
ad6c19b41d Explain Bazel log tail config
Document why failed-test log tailing runs bazel info with matching CI config and only selected post-config args.

Co-authored-by: Codex <noreply@openai.com>
2026-04-16 13:59:52 -07:00
starr-openai
fd671dff42 Throttle Windows Bazel test jobs
Limit the Windows Bazel test lane to 8 jobs to reduce local runner pressure, and make failed-test log tailing resolve paths using the same CI config and Windows host-platform context as the failed invocation.

Co-authored-by: Codex <noreply@openai.com>
2026-04-16 12:59:44 -07:00
3 changed files with 56 additions and 8 deletions

View File

@@ -126,6 +126,17 @@ common:ci-windows --config=ci-bazel
common:ci-windows --build_metadata=TAG_os=windows
common:ci-windows --repo_contents_cache=D:/a/.cache/bazel-repo-contents-cache
# Experimental Windows cross-remote config: analyze on the Windows runner,
# execute build actions on Linux RBE, then run test actions locally on Windows.
common:ci-windows-cross --config=ci-bazel
common:ci-windows-cross --build_metadata=TAG_os=windows-cross
common:ci-windows-cross --config=remote
common:ci-windows-cross --strategy=remote
common:ci-windows-cross --strategy=TestRunner=local
common:ci-windows-cross --platforms=//:local_windows
common:ci-windows-cross --host_platform=//:rbe
common:ci-windows-cross --repo_contents_cache=D:/a/.cache/bazel-repo-contents-cache
# We prefer to run the build actions entirely remotely so we can dial up the concurrency.
# We have platform-specific tests, so we want to execute the tests on all platforms using the strongest sandboxing available on each platform.

View File

@@ -6,6 +6,7 @@ print_failed_bazel_test_logs=0
use_node_test_env=0
remote_download_toplevel=0
windows_msvc_host_platform=0
ci_config_override=
while [[ $# -gt 0 ]]; do
case "$1" in
@@ -25,6 +26,10 @@ while [[ $# -gt 0 ]]; do
windows_msvc_host_platform=1
shift
;;
--ci-config=*)
ci_config_override="${1#--ci-config=}"
shift
;;
--)
shift
break
@@ -37,7 +42,7 @@ while [[ $# -gt 0 ]]; do
done
if [[ $# -eq 0 ]]; then
echo "Usage: $0 [--print-failed-test-logs] [--use-node-test-env] [--remote-download-toplevel] [--windows-msvc-host-platform] -- <bazel args> -- <targets>" >&2
echo "Usage: $0 [--print-failed-test-logs] [--use-node-test-env] [--remote-download-toplevel] [--windows-msvc-host-platform] [--ci-config=<config>] -- <bazel args> -- <targets>" >&2
exit 1
fi
@@ -64,17 +69,45 @@ case "${RUNNER_OS:-}" in
ci_config=ci-windows
;;
esac
if [[ -n "$ci_config_override" ]]; then
ci_config="$ci_config_override"
fi
print_bazel_test_log_tails() {
local console_log="$1"
local testlogs_dir
local -a bazel_info_cmd=(bazel)
local -a bazel_info_args=(info)
if (( ${#bazel_startup_args[@]} > 0 )); then
bazel_info_cmd+=("${bazel_startup_args[@]}")
fi
testlogs_dir="$(run_bazel "${bazel_info_cmd[@]:1}" info bazel-testlogs 2>/dev/null || echo bazel-testlogs)"
# `bazel info` needs the same CI config as the failed test invocation so
# platform-specific output roots match. On Windows, omitting `ci-windows`
# would point at `local_windows-fastbuild` even when the test ran with the
# MSVC host platform under `local_windows_msvc-fastbuild`.
if [[ -n "${BUILDBUDDY_API_KEY:-}" ]]; then
bazel_info_args+=(
"--config=${ci_config}"
"--remote_header=x-buildbuddy-api-key=${BUILDBUDDY_API_KEY}"
)
fi
# Only pass flags that affect Bazel's output-root selection or repository
# lookup. Test/build-only flags such as execution logs or remote download
# mode can make `bazel info` fail, which would hide the real test log path.
for arg in "${post_config_bazel_args[@]}"; do
case "$arg" in
--host_platform=* | --repo_contents_cache=* | --repository_cache=*)
bazel_info_args+=("$arg")
;;
esac
done
testlogs_dir="$(run_bazel "${bazel_info_cmd[@]:1}" \
--noexperimental_remote_repo_contents_cache \
"${bazel_info_args[@]}" \
bazel-testlogs 2>/dev/null || echo bazel-testlogs)"
local failed_targets=()
while IFS= read -r target; do
@@ -95,8 +128,9 @@ print_bazel_test_log_tails() {
rel_path="${rel_path/://}"
local test_log="${testlogs_dir}/${rel_path}/test.log"
local reported_test_log
reported_test_log="$(grep -F "FAIL: ${target} " "$console_log" | sed -nE 's#.* \(see ([^)]+/test\.log)\).*#\1#p' | head -n 1 || true)"
reported_test_log="$(grep -F "FAIL: ${target} " "$console_log" | sed -nE 's#.* \(see (.*[\\/]test\.log)\).*#\1#p' | head -n 1 || true)"
if [[ -n "$reported_test_log" ]]; then
reported_test_log="${reported_test_log//\\//}"
test_log="$reported_test_log"
fi

View File

@@ -86,17 +86,20 @@ jobs:
--print-failed-test-logs
--use-node-test-env
)
bazel_test_args=(
test
--test_tag_filters=-argument-comment-lint
--test_verbose_timeout_warnings
--build_metadata=COMMIT_SHA=${GITHUB_SHA}
)
if [[ "${RUNNER_OS}" == "Windows" ]]; then
bazel_wrapper_args+=(--windows-msvc-host-platform)
bazel_wrapper_args+=(--ci-config=ci-windows-cross)
fi
./.github/scripts/run-bazel-ci.sh \
"${bazel_wrapper_args[@]}" \
-- \
test \
--test_tag_filters=-argument-comment-lint \
--test_verbose_timeout_warnings \
--build_metadata=COMMIT_SHA=${GITHUB_SHA} \
"${bazel_test_args[@]}" \
-- \
"${bazel_targets[@]}"