Skip to content

Commit bf1692d

Browse files
committed
ci: experimental native Windows ARM64 build workflow
Builds an arm64 NSIS installer natively on windows-11-arm runners (free on public repositories): swaps bundle.resources to the win-arm64 pdfium/WebView2Loader, builds via the normal tauri:build path (build.rs already suffixes the sidecar with the host triple), verifies the PE machine type and uploads the installer artifact. Standalone and manually triggered so it can be stabilised before joining the release matrix.
1 parent 11f6ea7 commit bf1692d

1 file changed

Lines changed: 96 additions & 0 deletions

File tree

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Windows ARM64 (experimental)
2+
3+
# Native Windows-on-ARM build, produced on GitHub's windows-11-arm runners
4+
# (free for public repositories). Kept as a standalone manually-triggered
5+
# workflow so it can be exercised and stabilised before being folded into
6+
# the release matrix. Remaining integration steps for release.yml are
7+
# listed in the PR description: user-mode variant, Authenticode signing
8+
# steps, and windows-aarch64 entries in the updater's latest.json.
9+
10+
on:
11+
workflow_dispatch:
12+
13+
jobs:
14+
build-windows-arm64:
15+
runs-on: windows-11-arm
16+
defaults:
17+
run:
18+
working-directory: open-pdf-studio
19+
env:
20+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
21+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: 'tauri2026'
22+
23+
steps:
24+
- uses: actions/checkout@v6
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v6
28+
with:
29+
node-version: 20
30+
31+
- name: Install Rust stable (aarch64 host)
32+
uses: dtolnay/rust-toolchain@stable
33+
34+
- name: Install frontend dependencies
35+
run: npm install
36+
37+
- name: Select win-arm64 bundled resources
38+
shell: pwsh
39+
run: |
40+
# tauri.windows.conf.json pins the x64 pdfium.dll and
41+
# WebView2Loader.dll — and, as a platform override, Tauri merges it
42+
# OVER tauri.conf.json, so the swap must happen HERE. Rewriting
43+
# bundle.resources in the base tauri.conf.json is silently undone by
44+
# this override and ships the x64 pdfium.dll in the arm64 bundle;
45+
# init_pdfium can't load a wrong-arch DLL, PDFium stays uninitialised,
46+
# and every page renders blank. Replace the whole resources object so
47+
# the win-x64 key is dropped (no colliding pdfium.dll destination).
48+
# (win-arm64 DLL provenance: src-tauri/binaries/win-arm64/README.md.)
49+
$conf = Get-Content src-tauri/tauri.windows.conf.json -Raw | ConvertFrom-Json
50+
$conf.bundle.resources = [ordered]@{
51+
'binaries/win-arm64/pdfium.dll' = 'pdfium.dll'
52+
'binaries/win-arm64/WebView2Loader.dll' = 'WebView2Loader.dll'
53+
}
54+
$conf | ConvertTo-Json -Depth 10 | Set-Content src-tauri/tauri.windows.conf.json
55+
56+
# npm run tauri:build = prebuild hook (cargo build --release -p
57+
# pdfium-worker) + vite build + tauri build. src-tauri/build.rs derives
58+
# the sidecar's target-triple suffix from $TARGET, which is
59+
# aarch64-pc-windows-msvc on these runners - no manual copy needed.
60+
- name: Build Tauri app (native ARM64)
61+
run: npm run tauri:build
62+
63+
- name: Verify installer architecture
64+
shell: pwsh
65+
working-directory: .
66+
run: |
67+
$setup = Get-ChildItem target/release/bundle/nsis/*-setup.exe | Select-Object -First 1
68+
if (-not $setup) { Write-Error "No NSIS installer produced"; exit 1 }
69+
Write-Output "Installer: $($setup.Name) ($([math]::Round($setup.Length/1MB,1)) MB)"
70+
$bytes = [System.IO.File]::ReadAllBytes("target/release/open-pdf-studio.exe")
71+
$peOffset = [BitConverter]::ToInt32($bytes, 0x3C)
72+
$machine = [BitConverter]::ToUInt16($bytes, $peOffset + 4)
73+
Write-Output ("PE machine type: 0x{0:X4}" -f $machine)
74+
if ($machine -ne 0xAA64) { Write-Error "Main exe is not ARM64"; exit 1 }
75+
76+
# The bundled pdfium.dll must be ARM64 too. An x64 DLL here loads-fails
77+
# at runtime, PDFium stays uninitialised, and pages render blank while
78+
# the app otherwise runs — so the main-exe check above passes with
79+
# rendering silently dead. Fail the build instead.
80+
$dlls = Get-ChildItem -Path target/release -Recurse -Filter pdfium.dll -ErrorAction SilentlyContinue
81+
if (-not $dlls) { Write-Warning "No bundled pdfium.dll found under target/release to verify" }
82+
foreach ($dll in $dlls) {
83+
$db = [System.IO.File]::ReadAllBytes($dll.FullName)
84+
$dpe = [BitConverter]::ToInt32($db, 0x3C)
85+
$dm = [BitConverter]::ToUInt16($db, $dpe + 4)
86+
Write-Output ("pdfium.dll ($($dll.FullName)): 0x{0:X4}" -f $dm)
87+
if ($dm -ne 0xAA64) { Write-Error "Bundled pdfium.dll is not ARM64"; exit 1 }
88+
}
89+
90+
- name: Upload installer artifact
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: open-pdf-studio-windows-arm64-setup
94+
path: target/release/bundle/nsis/*-setup.exe
95+
if-no-files-found: error
96+
retention-days: 30

0 commit comments

Comments
 (0)