Skip to content

Commit 44273cb

Browse files
Apply PR #16299: feat(windows): add arm64 release targets for cli and desktop
2 parents 5470606 + f9ac142 commit 44273cb

File tree

8 files changed

+56
-4
lines changed

8 files changed

+56
-4
lines changed

.github/workflows/publish.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ jobs:
115115
target: x86_64-apple-darwin
116116
- host: macos-latest
117117
target: aarch64-apple-darwin
118+
- host: blacksmith-4vcpu-windows-2025
119+
target: aarch64-pc-windows-msvc
118120
- host: blacksmith-4vcpu-windows-2025
119121
target: x86_64-pc-windows-msvc
120122
- host: blacksmith-4vcpu-ubuntu-2404
@@ -212,6 +214,27 @@ jobs:
212214
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
213215
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
214216

217+
- name: Setup Windows ARM64 clang
218+
if: runner.os == 'Windows' && matrix.settings.target == 'aarch64-pc-windows-msvc'
219+
shell: pwsh
220+
run: |
221+
$vswhere = Join-Path ${env:ProgramFiles(x86)} "Microsoft Visual Studio\Installer\vswhere.exe"
222+
if (!(Test-Path $vswhere)) { throw "vswhere.exe not found at $vswhere" }
223+
$root = & $vswhere -latest -products * -property installationPath
224+
if (!$root) { throw "Visual Studio installation not found" }
225+
$llvm = Join-Path $root "VC\Tools\Llvm"
226+
$bin = @(
227+
(Join-Path $llvm "x64\bin"),
228+
(Join-Path $llvm "bin")
229+
) | Where-Object { Test-Path (Join-Path $_ "clang.exe") } | Select-Object -First 1
230+
if (!$bin -and (Test-Path $llvm)) {
231+
$bin = Get-ChildItem -Path $llvm -Filter clang.exe -Recurse -File | Select-Object -First 1 | ForEach-Object { $_.DirectoryName }
232+
}
233+
if (!$bin) { throw "clang.exe not found under $llvm" }
234+
$env:PATH = "$bin;$env:PATH"
235+
Add-Content -Path $env:GITHUB_PATH -Value $bin
236+
clang --version
237+
215238
- name: Build and upload artifacts
216239
uses: tauri-apps/tauri-action@390cbe447412ced1303d35abe75287949e43437a
217240
timeout-minutes: 60
@@ -254,6 +277,9 @@ jobs:
254277
- host: macos-latest
255278
target: aarch64-apple-darwin
256279
platform_flag: --mac --arm64
280+
- host: "blacksmith-4vcpu-windows-2025"
281+
target: aarch64-pc-windows-msvc
282+
platform_flag: --win --arm64
257283
- host: "blacksmith-4vcpu-windows-2025"
258284
target: x86_64-pc-windows-msvc
259285
platform_flag: --win

packages/desktop-electron/scripts/finalize-latest-yml.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,17 @@ async function read(subdir: string, filename: string): Promise<LatestYml | undef
7878

7979
const output: Record<string, string> = {}
8080

81-
// Windows: single arch, pass through
82-
const win = await read("latest-yml-x86_64-pc-windows-msvc", "latest.yml")
83-
if (win) output["latest.yml"] = serialize(win)
81+
// Windows: merge arm64 + x64 into single file
82+
const winX64 = await read("latest-yml-x86_64-pc-windows-msvc", "latest.yml")
83+
const winArm64 = await read("latest-yml-aarch64-pc-windows-msvc", "latest.yml")
84+
if (winX64 || winArm64) {
85+
const base = winArm64 ?? winX64!
86+
output["latest.yml"] = serialize({
87+
version: base.version,
88+
files: [...(winArm64?.files ?? []), ...(winX64?.files ?? [])],
89+
releaseDate: base.releaseDate,
90+
})
91+
}
8492

8593
// Linux x64: pass through
8694
const linuxX64 = await read("latest-yml-x86_64-unknown-linux-gnu", "latest-linux.yml")

packages/desktop-electron/scripts/utils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ export const SIDECAR_BINARIES: Array<{ rustTarget: string; ocBinary: string; ass
1919
ocBinary: "opencode-darwin-x64-baseline",
2020
assetExt: "zip",
2121
},
22+
{
23+
rustTarget: "aarch64-pc-windows-msvc",
24+
ocBinary: "opencode-windows-arm64",
25+
assetExt: "zip",
26+
},
2227
{
2328
rustTarget: "x86_64-pc-windows-msvc",
2429
ocBinary: "opencode-windows-x64-baseline",
@@ -41,7 +46,7 @@ export const RUST_TARGET = Bun.env.RUST_TARGET
4146
function nativeTarget() {
4247
const { platform, arch } = process
4348
if (platform === "darwin") return arch === "arm64" ? "aarch64-apple-darwin" : "x86_64-apple-darwin"
44-
if (platform === "win32") return "x86_64-pc-windows-msvc"
49+
if (platform === "win32") return arch === "arm64" ? "aarch64-pc-windows-msvc" : "x86_64-pc-windows-msvc"
4550
if (platform === "linux") return arch === "arm64" ? "aarch64-unknown-linux-gnu" : "x86_64-unknown-linux-gnu"
4651
throw new Error(`Unsupported platform: ${platform}/${arch}`)
4752
}

packages/desktop/scripts/finalize-latest-json.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ const targets = [
101101
{ key: "linux-x86_64-rpm", asset: "opencode-desktop-linux-x86_64.rpm" },
102102
{ key: "linux-aarch64-deb", asset: "opencode-desktop-linux-arm64.deb" },
103103
{ key: "linux-aarch64-rpm", asset: "opencode-desktop-linux-aarch64.rpm" },
104+
{ key: "windows-aarch64-nsis", asset: "opencode-desktop-windows-arm64.exe" },
104105
{ key: "windows-x86_64-nsis", asset: "opencode-desktop-windows-x64.exe" },
105106
{ key: "darwin-x86_64-app", asset: "opencode-desktop-darwin-x64.app.tar.gz" },
106107
{
@@ -129,6 +130,7 @@ const alias = (key: string, source: string) => {
129130

130131
alias("linux-x86_64", "linux-x86_64-deb")
131132
alias("linux-aarch64", "linux-aarch64-deb")
133+
alias("windows-aarch64", "windows-aarch64-nsis")
132134
alias("windows-x86_64", "windows-x86_64-nsis")
133135
alias("darwin-x86_64", "darwin-x86_64-app")
134136
alias("darwin-aarch64", "darwin-aarch64-app")

packages/desktop/scripts/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ export const SIDECAR_BINARIES: Array<{ rustTarget: string; ocBinary: string; ass
1111
ocBinary: "opencode-darwin-x64-baseline",
1212
assetExt: "zip",
1313
},
14+
{
15+
rustTarget: "aarch64-pc-windows-msvc",
16+
ocBinary: "opencode-windows-arm64",
17+
assetExt: "zip",
18+
},
1419
{
1520
rustTarget: "x86_64-pc-windows-msvc",
1621
ocBinary: "opencode-windows-x64-baseline",

packages/opencode/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"@parcel/watcher-linux-arm64-musl": "2.5.1",
3737
"@parcel/watcher-linux-x64-glibc": "2.5.1",
3838
"@parcel/watcher-linux-x64-musl": "2.5.1",
39+
"@parcel/watcher-win32-arm64": "2.5.1",
3940
"@parcel/watcher-win32-x64": "2.5.1",
4041
"@standard-schema/spec": "1.0.0",
4142
"@tsconfig/bun": "catalog:",

packages/opencode/script/build.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ const allTargets: {
108108
arch: "x64",
109109
avx2: false,
110110
},
111+
{
112+
os: "win32",
113+
arch: "arm64",
114+
},
111115
{
112116
os: "win32",
113117
arch: "x64",

packages/opencode/src/file/ripgrep.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export namespace Ripgrep {
100100
},
101101
"x64-darwin": { platform: "x86_64-apple-darwin", extension: "tar.gz" },
102102
"x64-linux": { platform: "x86_64-unknown-linux-musl", extension: "tar.gz" },
103+
"arm64-win32": { platform: "aarch64-pc-windows-msvc", extension: "zip" },
103104
"x64-win32": { platform: "x86_64-pc-windows-msvc", extension: "zip" },
104105
} as const
105106

0 commit comments

Comments
 (0)