Skip to content

Commit e7a277e

Browse files
committed
fix(windows): normalize Windows platform names in all toolchain files
Windows builds have been failing on Windows Server 2025 with error: "Unsupported platform windows server 2025_amd64" The issue was that platform detection did not normalize Windows OS names. GitHub Actions now uses "Windows Server 2025" which becomes "windows server 2025_amd64" after lowercasing, but the checksum registry expects "windows_amd64". Changes: - Fixed platform detection in 7 toolchain files to normalize Windows names: * wasm_toolchain.bzl * wasmtime_toolchain.bzl * jco_toolchain.bzl * wasi_sdk_toolchain.bzl * cpp_component_toolchain.bzl * symmetric_wit_bindgen_toolchain.bzl * monitoring.bzl - Note: tinygo_toolchain.bzl, wizer_toolchain.bzl, and wkg_toolchain.bzl already had correct implementations - Enabled Windows tests in PR CI (was only running on main branch) * Reduced test matrix to latest Bazel versions only on PRs * This ensures Windows issues are caught early The fix uses pattern matching ("windows" in os_name) instead of exact string comparison, so it will work with any Windows variant: - Windows 10, Windows 11 - Windows Server 2019, 2022, 2025 - Future Windows versions
1 parent c1443fc commit e7a277e

File tree

8 files changed

+59
-9
lines changed

8 files changed

+59
-9
lines changed

.github/workflows/bcr-compatibility.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ jobs:
186186
name: BCR Multi-Platform Test
187187
runs-on: ${{ matrix.os }}
188188
timeout-minutes: 25
189-
# Only run on main branch to avoid overloading PR checks
190-
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
189+
# Run on all PRs and main branch to catch Windows issues early
190+
# Windows builds have been failing silently - now we'll catch them!
191191

192192
strategy:
193193
fail-fast: false
@@ -198,6 +198,13 @@ jobs:
198198
# Skip some combinations to reduce CI load
199199
- os: windows-latest
200200
bazel_version: "6.x"
201+
# On PRs, only test latest Bazel versions to reduce load
202+
- os: windows-latest
203+
bazel_version: "7.x"
204+
- os: ubuntu-latest
205+
bazel_version: "6.x"
206+
- os: macos-latest
207+
bazel_version: "6.x"
201208

202209
steps:
203210
- name: Checkout Repository

toolchains/cpp_component_toolchain.bzl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,15 @@ def _detect_host_platform(repository_ctx):
7777
os_name = repository_ctx.os.name.lower()
7878
arch = repository_ctx.os.arch.lower()
7979

80-
if os_name == "mac os x":
80+
# Normalize platform names for cross-platform compatibility
81+
if "mac" in os_name or "darwin" in os_name:
8182
os_name = "darwin"
83+
elif "windows" in os_name:
84+
os_name = "windows"
85+
elif "linux" in os_name:
86+
os_name = "linux"
8287

88+
# Normalize architecture names
8389
if arch == "x86_64":
8490
arch = "amd64"
8591
elif arch == "aarch64":

toolchains/jco_toolchain.bzl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,15 @@ def _detect_host_platform(repository_ctx):
6666
os_name = repository_ctx.os.name.lower()
6767
arch = repository_ctx.os.arch.lower()
6868

69-
if os_name == "mac os x":
69+
# Normalize platform names for cross-platform compatibility
70+
if "mac" in os_name or "darwin" in os_name:
7071
os_name = "darwin"
72+
elif "windows" in os_name:
73+
os_name = "windows"
74+
elif "linux" in os_name:
75+
os_name = "linux"
7176

77+
# Normalize architecture names
7278
if arch == "x86_64":
7379
arch = "amd64"
7480
elif arch == "aarch64":

toolchains/monitoring.bzl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ def _detect_platform_simple(ctx):
2424
os_name = ctx.os.name.lower()
2525
arch = ctx.os.arch.lower()
2626

27-
if os_name == "mac os x":
27+
# Normalize platform names for cross-platform compatibility
28+
if "mac" in os_name or "darwin" in os_name:
2829
os_name = "darwin"
30+
elif "windows" in os_name:
31+
os_name = "windows"
32+
elif "linux" in os_name:
33+
os_name = "linux"
34+
35+
# Normalize architecture names
2936
if arch == "x86_64":
3037
arch = "amd64"
3138
elif arch == "aarch64":

toolchains/symmetric_wit_bindgen_toolchain.bzl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ def _detect_host_platform(repository_ctx):
88
os_name = repository_ctx.os.name.lower()
99
arch = repository_ctx.os.arch.lower()
1010

11-
if os_name == "mac os x":
11+
# Normalize platform names for cross-platform compatibility
12+
if "mac" in os_name or "darwin" in os_name:
1213
os_name = "darwin"
14+
elif "windows" in os_name:
15+
os_name = "windows"
16+
elif "linux" in os_name:
17+
os_name = "linux"
1318

19+
# Normalize architecture names
1420
if arch == "x86_64":
1521
arch = "amd64"
1622
elif arch == "aarch64":

toolchains/wasi_sdk_toolchain.bzl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,15 @@ def _detect_host_platform(repository_ctx):
8989
os_name = repository_ctx.os.name.lower()
9090
arch = repository_ctx.os.arch.lower()
9191

92-
if os_name == "mac os x":
92+
# Normalize platform names for cross-platform compatibility
93+
if "mac" in os_name or "darwin" in os_name:
9394
os_name = "darwin"
95+
elif "windows" in os_name:
96+
os_name = "windows"
97+
elif "linux" in os_name:
98+
os_name = "linux"
9499

100+
# Normalize architecture names
95101
if arch == "x86_64":
96102
arch = "amd64"
97103
elif arch == "aarch64":

toolchains/wasm_toolchain.bzl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,15 @@ def _detect_host_platform(repository_ctx):
103103
os_name = repository_ctx.os.name.lower()
104104
arch = repository_ctx.os.arch.lower()
105105

106-
if os_name == "mac os x":
106+
# Normalize platform names for cross-platform compatibility
107+
if "mac" in os_name or "darwin" in os_name:
107108
os_name = "darwin"
109+
elif "windows" in os_name:
110+
os_name = "windows"
111+
elif "linux" in os_name:
112+
os_name = "linux"
108113

114+
# Normalize architecture names
109115
if arch == "x86_64":
110116
arch = "amd64"
111117
elif arch == "aarch64":

toolchains/wasmtime_toolchain.bzl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@ def _detect_host_platform(repository_ctx):
3030
os_name = repository_ctx.os.name.lower()
3131
arch = repository_ctx.os.arch.lower()
3232

33-
if os_name == "mac os x":
33+
# Normalize platform names for cross-platform compatibility
34+
if "mac" in os_name or "darwin" in os_name:
3435
os_name = "darwin"
36+
elif "windows" in os_name:
37+
os_name = "windows"
38+
elif "linux" in os_name:
39+
os_name = "linux"
3540

41+
# Normalize architecture names
3642
if arch == "x86_64":
3743
arch = "amd64"
3844
elif arch == "aarch64":

0 commit comments

Comments
 (0)