|
9 | 9 | ZIG_VERSION: 0.15.2 |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - # NOTE: Native Windows builds are temporarily disabled due to a ghostty dependency issue: |
13 | | - # https://github.com/ghostty-org/ghostty/issues/10147 |
14 | | - # The ghostty code generators crash on Windows because they call stdout.end() |
15 | | - # which tries to truncate stdout (not supported on Windows console handles). |
16 | | - # |
17 | | - # For now, we cross-compile from macOS and test on Windows. |
18 | | - # The cross-compiled binaries work correctly (2879/2888 tests pass). |
| 12 | + build-native-windows: |
| 13 | + name: Windows - Native Build and Test |
| 14 | + runs-on: windows-latest |
| 15 | + steps: |
| 16 | + - name: Checkout code |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Setup Bun |
| 20 | + uses: oven-sh/setup-bun@v2 |
| 21 | + with: |
| 22 | + bun-version: latest |
| 23 | + |
| 24 | + - name: Setup Zig |
| 25 | + uses: goto-bus-stop/setup-zig@v2 |
| 26 | + with: |
| 27 | + version: ${{ env.ZIG_VERSION }} |
| 28 | + |
| 29 | + - name: Install dependencies |
| 30 | + run: bun install |
| 31 | + |
| 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) |
| 36 | + 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 |
| 42 | + |
| 43 | + - name: Verify Windows binary exists |
| 44 | + shell: pwsh |
| 45 | + run: | |
| 46 | + if (!(Test-Path "packages/core/node_modules/@opentui/core-win32-x64/opentui.dll")) { |
| 47 | + Write-Error "Windows x64 binary missing!" |
| 48 | + exit 1 |
| 49 | + } |
| 50 | + Write-Host "Windows x64 binary exists" |
| 51 | + Get-ChildItem "packages/core/node_modules/@opentui/core-win32-x64/" |
| 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 |
| 60 | + |
| 61 | + - name: Run JS tests |
| 62 | + working-directory: packages/core |
| 63 | + run: bun run test:js |
19 | 64 |
|
20 | 65 | build-on-macos: |
21 | 66 | name: macOS - Cross-compile for Windows |
|
0 commit comments