ci: inherit Windows Bazel environment

This commit is contained in:
Adam Perry
2026-06-09 20:30:05 +00:00
parent 68dee6f0f2
commit 07dc3523b0
3 changed files with 22 additions and 8 deletions

View File

@@ -65,7 +65,7 @@ class Options:
@dataclass(frozen=True)
class Invocation:
command: list[str]
child_env: dict[str, str]
child_env: dict[str, str] | None
ci_config: str
post_config_args: list[str]
remote_enabled: bool
@@ -205,9 +205,7 @@ def build_invocation(
"--",
*targets,
)
child_env = dict(env)
if env.get("RUNNER_OS") == "Windows":
child_env["MSYS2_ARG_CONV_EXCL"] = "*"
child_env = None if env is os.environ else dict(env)
return Invocation(command, child_env, config, post_args, remote_enabled)

View File

@@ -40,9 +40,7 @@ def main(argv: Sequence[str] | None = None, env: Mapping[str, str] | None = None
print(exc, file=sys.stderr)
return 1
child_env = dict(env)
if env.get("RUNNER_OS") == "Windows":
child_env["MSYS2_ARG_CONV_EXCL"] = "*"
child_env = None if env is os.environ else dict(env)
return subprocess.run(command, env=child_env, check=False).returncode

View File

@@ -87,7 +87,25 @@ class RunBazelCiTest(unittest.TestCase):
self.assertIn("--host_platform=//:local_windows_msvc", invocation.command)
self.assertIn("--jobs=8", invocation.command)
self.assertIn(r"--test_env=PATH=C:\Windows", invocation.command)
self.assertEqual(invocation.child_env["MSYS2_ARG_CONV_EXCL"], "*")
self.assertEqual(
invocation.child_env,
{
"CODEX_BAZEL_BIN": "fake-bazel",
"CODEX_BAZEL_WINDOWS_PATH": r"C:\Windows",
"RUNNER_OS": "Windows",
},
)
def test_runtime_invocation_inherits_the_process_environment(self) -> None:
invocation = run_bazel_ci.build_invocation(
run_bazel_ci.Options(),
["build"],
["//codex-rs/cli:codex"],
os.environ,
pid=123,
)
self.assertIsNone(invocation.child_env)
def test_remote_windows_cross_compile_uses_linux_build_environment(self) -> None:
invocation = run_bazel_ci.build_invocation(