feat(windows): add native desktop preview and packaging #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Windows desktop | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - feat/windows-desktop | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: windows-desktop-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Windows x64 NSIS installer | |
| runs-on: windows-2022 | |
| timeout-minutes: 60 | |
| defaults: | |
| run: | |
| shell: pwsh | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Node.js | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 22 | |
| architecture: x64 | |
| cache: npm | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@49a0bdc70d2e1b713ca9e2869b211fcce03d3c1c # v2 | |
| with: | |
| workspaces: | | |
| native/gajae-core -> target | |
| src-tauri -> target | |
| cache-on-failure: true | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Fetch pinned Bun runtime | |
| run: node scripts/fetch-bun.mjs | |
| - name: Audit dependencies | |
| run: npm run audit | |
| - name: Check source | |
| run: | | |
| npm run typecheck | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| npm run lint | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| npm run check:identity | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| npm run check:licenses | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| - name: Verify Rust core | |
| run: npm run check:core | |
| - name: Build payload and installer | |
| run: npm run desktop:build:windows | |
| - name: Test Windows runtime | |
| run: npm run test:windows | |
| - name: Test desktop lifecycle | |
| run: | | |
| cargo fmt --manifest-path src-tauri/Cargo.toml -- --check | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| cargo test --locked --manifest-path src-tauri/Cargo.toml --target x86_64-pc-windows-msvc | |
| - name: Stage installer and checksum | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| $installers = @(Get-ChildItem 'src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/*-setup.exe') | |
| if ($installers.Count -ne 1) { throw "Expected exactly one NSIS installer, found $($installers.Count)." } | |
| $version = (Get-Content package.json -Raw | ConvertFrom-Json).version | |
| $assetName = "gajae-app-desktop-$version-windows-x64-setup.exe" | |
| New-Item -ItemType Directory -Path release/desktop -Force | Out-Null | |
| Copy-Item $installers[0].FullName "release/desktop/$assetName" | |
| $digest = (Get-FileHash "release/desktop/$assetName" -Algorithm SHA256).Hash.ToLowerInvariant() | |
| [System.IO.File]::WriteAllText("$PWD/release/desktop/$assetName.sha256", "$digest $assetName`n", [System.Text.UTF8Encoding]::new($false)) | |
| "WINDOWS_INSTALLER=$($installers[0].FullName)" >> $env:GITHUB_ENV | |
| - name: Verify installed payload | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| $installDir = Join-Path $env:RUNNER_TEMP 'Gajae Windows QA 가재' | |
| $installer = Start-Process -FilePath $env:WINDOWS_INSTALLER -ArgumentList @('/S', "/D=$installDir") -Wait -PassThru | |
| if ($installer.ExitCode -ne 0) { throw "NSIS install failed: $($installer.ExitCode)" } | |
| $sidecar = Join-Path $installDir 'gajae-app-server.exe' | |
| $payload = Join-Path $installDir 'resources/server-payload' | |
| if (!(Test-Path $sidecar)) { throw 'Installed Node sidecar is missing.' } | |
| if (!(Test-Path $payload)) { $payload = Join-Path $installDir 'server-payload' } | |
| node scripts/release/smoke-windows-server.mjs --payload $payload --node $sidecar | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| - name: Upload Windows preview installer | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: gajae-app-desktop-windows-x64 | |
| path: | | |
| release/desktop/*-windows-x64-setup.exe | |
| release/desktop/*-windows-x64-setup.exe.sha256 | |
| if-no-files-found: error | |
| retention-days: 14 |