Skip to content

Commit 99fb7c9

Browse files
committed
chore: disable native Windows build due to Zig 0.15.2 bugs, focus on cross-compiled testing
1 parent 1da68ab commit 99fb7c9

File tree

1 file changed

+28
-77
lines changed

1 file changed

+28
-77
lines changed

.github/workflows/build-windows.yml

Lines changed: 28 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ env:
99
ZIG_VERSION: 0.15.2
1010

1111
jobs:
12-
build-native-windows:
13-
name: Windows - Native Build and Test
14-
runs-on: windows-latest
12+
# NOTE: Native Windows builds are disabled due to Zig 0.15.2 bugs on Windows:
13+
# - https://github.com/ziglang/zig/issues/25805 (path handling on different drives)
14+
# - ftruncate issues with ghostty code generators
15+
# These should be fixed in Zig 0.16.0
16+
# For now, we cross-compile from macOS and test on Windows
17+
18+
build-on-macos:
19+
name: macOS - Cross-compile for Windows
20+
runs-on: macos-latest
1521
steps:
1622
- name: Checkout code
1723
uses: actions/checkout@v4
@@ -29,38 +35,23 @@ jobs:
2935
- name: Install dependencies
3036
run: bun install
3137

32-
# Workaround for Zig 0.15.2 bug on Windows (https://github.com/ziglang/zig/issues/25805)
33-
# When cwd and cache path are on different drives, build fails
34-
# Setting cache dir explicitly to be on the same drive as the source
35-
- name: Build native with Zig (Windows only)
38+
- name: Build for Windows (cross-compile)
3639
working-directory: packages/core/src/zig
37-
run: zig build -Doptimize=ReleaseFast --cache-dir .zig-cache --global-cache-dir .zig-cache
38-
39-
- name: Copy native binaries to node_modules
40-
working-directory: packages/core
41-
run: bun scripts/build.ts --native --skip-zig-build
40+
run: zig build -Dtarget=x86_64-windows-gnu -Doptimize=ReleaseFast
4241

43-
- name: Verify Windows binary exists
42+
- name: Package Windows binaries
4443
run: |
45-
if (!(Test-Path "packages/core/node_modules/@opentui/core-win32-x64/opentui.dll")) {
46-
Write-Error "Windows x64 binary missing!"
47-
exit 1
48-
}
49-
Write-Host "Windows x64 binary exists"
50-
Get-ChildItem "packages/core/node_modules/@opentui/core-win32-x64/"
51-
shell: pwsh
52-
53-
- name: Run native tests
54-
working-directory: packages/core/src/zig
55-
run: zig build test --summary all --cache-dir .zig-cache --global-cache-dir .zig-cache
56-
57-
- name: Build lib
58-
working-directory: packages/core
59-
run: bun run build:lib
44+
mkdir -p artifacts
45+
cp packages/core/src/zig/lib/x86_64-windows/opentui.dll artifacts/
46+
ls -la artifacts/
6047
61-
- name: Run JS tests
62-
working-directory: packages/core
63-
run: bun run test:js
48+
- name: Upload cross-compiled Windows binaries
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: windows-binaries-cross-compiled
52+
path: artifacts/opentui.dll
53+
if-no-files-found: error
54+
retention-days: 1
6455

6556
test-cross-compiled-on-windows:
6657
name: Windows - Test macOS Cross-Compiled Binaries
@@ -84,7 +75,8 @@ jobs:
8475
- name: Install dependencies
8576
run: bun install
8677

87-
- name: Extract and place cross-compiled binaries
78+
- name: Setup cross-compiled binaries
79+
shell: pwsh
8880
run: |
8981
# Create the target directory
9082
$targetDir = "packages/core/node_modules/@opentui/core-win32-x64"
@@ -94,27 +86,24 @@ jobs:
9486
Copy-Item "artifacts/opentui.dll" -Destination $targetDir
9587
9688
# Create index.ts that exports the path to the DLL
97-
$indexContent = @"
89+
@"
9890
const module = await import("./opentui.dll", { with: { type: "file" } })
9991
const path = module.default
10092
export default path;
101-
"@
102-
Set-Content -Path "$targetDir/index.ts" -Value $indexContent
93+
"@ | Set-Content -Path "$targetDir/index.ts"
10394

10495
# Create package.json
105-
$packageJson = @"
96+
@"
10697
{
10798
"name": "@opentui/core-win32-x64",
10899
"version": "0.0.0",
109100
"main": "index.ts",
110101
"types": "index.ts"
111102
}
112-
"@
113-
Set-Content -Path "$targetDir/package.json" -Value $packageJson
103+
"@ | Set-Content -Path "$targetDir/package.json"
114104

115105
Write-Host "Cross-compiled binary placed at:"
116106
Get-ChildItem $targetDir
117-
shell: pwsh
118107

119108
- name: Build lib (uses cross-compiled binary)
120109
working-directory: packages/core
@@ -123,41 +112,3 @@ export default path;
123112
- name: Run JS tests with cross-compiled binary
124113
working-directory: packages/core
125114
run: bun run test:js
126-
127-
build-on-macos:
128-
name: macOS - Cross-compile for Windows
129-
runs-on: macos-latest
130-
steps:
131-
- name: Checkout code
132-
uses: actions/checkout@v4
133-
134-
- name: Setup Bun
135-
uses: oven-sh/setup-bun@v2
136-
with:
137-
bun-version: latest
138-
139-
- name: Setup Zig
140-
uses: goto-bus-stop/setup-zig@v2
141-
with:
142-
version: ${{ env.ZIG_VERSION }}
143-
144-
- name: Install dependencies
145-
run: bun install
146-
147-
- name: Build for Windows (cross-compile)
148-
working-directory: packages/core/src/zig
149-
run: zig build -Dtarget=x86_64-windows-gnu -Doptimize=ReleaseFast
150-
151-
- name: Package Windows binaries
152-
run: |
153-
mkdir -p artifacts
154-
cp packages/core/src/zig/lib/x86_64-windows/opentui.dll artifacts/
155-
ls -la artifacts/
156-
157-
- name: Upload cross-compiled Windows binaries
158-
uses: actions/upload-artifact@v4
159-
with:
160-
name: windows-binaries-cross-compiled
161-
path: artifacts/opentui.dll
162-
if-no-files-found: error
163-
retention-days: 1

0 commit comments

Comments
 (0)