- ci/sign-windows.sh signs alkane-toolkit.exe from Linux with jsign through the blueflaresigning account (RFC 3161 timestamped), using the least-privilege CI service principal alkane-toolkit-ci-signer. It is a no-op until the repository variable AZURE_SIGNING_PROFILE names a certificate profile; after that any signing failure fails the build. - release.yml and next.yml sign before packaging; windows-native.yml checks the signature with Get-AuthenticodeSignature on real Windows and requires Valid once signing is on. - CI image adds a Java runtime and a checksum-pinned jsign 7.6 (re-pinned); windows-ci.sh fetches the same jar on older images. - scripts/enable-windows-signing.sh turns signing on after Microsoft approves the publisher identity validation: creates the PublicTrust certificate profile, narrows the signer role to it, sets the variable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
102 lines
4.8 KiB
YAML
102 lines
4.8 KiB
YAML
name: windows-native
|
|
|
|
# Smoke test on real Windows. The self-hosted runner in the Windows 11 test VM
|
|
# (label alkane-windows, host mode; see docs/windows.md) takes the Windows
|
|
# build that main's build-test-release run cross-compiled -- the release .exe
|
|
# and every unit-test executable, which already passed under Wine there -- and
|
|
# runs them natively: real Win32, real comctl32/visual styles, real DPI and
|
|
# real Windows networking.
|
|
#
|
|
# Advisory by design: a separate workflow, so it never gates or delays a
|
|
# release, and while the VM is off the job simply waits for the runner.
|
|
on:
|
|
workflow_run:
|
|
workflows: [build-test-release]
|
|
types: [completed]
|
|
workflow_dispatch:
|
|
inputs:
|
|
run_id:
|
|
description: build-test-release run whose Windows build to test
|
|
required: true
|
|
|
|
permissions:
|
|
actions: read
|
|
contents: read
|
|
|
|
jobs:
|
|
native:
|
|
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
|
|
runs-on: alkane-windows
|
|
timeout-minutes: 30
|
|
env:
|
|
RUN_ID: ${{ github.event.workflow_run.id || inputs.run_id }}
|
|
# Windows' default execution policy (Restricted) refuses the script files
|
|
# the runner writes for each step; bypass it for these steps only, so the
|
|
# runner works without changing the machine's policy.
|
|
defaults:
|
|
run:
|
|
shell: powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File {0}
|
|
steps:
|
|
- name: Fetch the cross-built Windows build
|
|
env:
|
|
TOKEN: ${{ github.token }}
|
|
API: ${{ github.api_url }}/repos/${{ github.repository }}
|
|
run: |
|
|
$ErrorActionPreference = 'Stop'
|
|
$ProgressPreference = 'SilentlyContinue'
|
|
$work = Join-Path ([IO.Path]::GetTempPath()) "alkane-native-$env:RUN_ID"
|
|
Remove-Item -Recurse -Force $work -ErrorAction SilentlyContinue
|
|
New-Item -ItemType Directory $work | Out-Null
|
|
$auth = @{ Authorization = "token $env:TOKEN" }
|
|
$list = Invoke-RestMethod -Headers $auth "$env:API/actions/runs/$env:RUN_ID/artifacts"
|
|
$art = $list.artifacts | Where-Object { $_.name -eq 'alkane-toolkit-windows-tests' } |
|
|
Select-Object -First 1
|
|
if (-not $art) { throw "run $env:RUN_ID has no alkane-toolkit-windows-tests artifact" }
|
|
Invoke-WebRequest -Headers $auth -Uri $art.archive_download_url -OutFile "$work\artifact.zip"
|
|
Expand-Archive "$work\artifact.zip" "$work\artifact"
|
|
$bundle = Get-ChildItem -Recurse "$work\artifact" -Filter alkane-toolkit-windows-tests.zip |
|
|
Select-Object -First 1
|
|
Expand-Archive $bundle.FullName "$work\tests"
|
|
$exe = Get-ChildItem -Recurse "$work\artifact" -Filter alkane-toolkit.exe | Select-Object -First 1
|
|
Copy-Item $exe.FullName "$work\alkane-toolkit.exe"
|
|
"ALKANE_NATIVE=$work" | Out-File -Append -Encoding utf8 $env:GITHUB_ENV
|
|
$os = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
|
|
"Testing run $env:RUN_ID on Windows $($os.DisplayVersion) build $($os.CurrentBuild)"
|
|
|
|
- name: Authenticode signature (native Windows)
|
|
env:
|
|
SIGNING_ENABLED: ${{ vars.AZURE_SIGNING_PROFILE }}
|
|
run: |
|
|
# Windows itself judges the signature: chain to a trusted root,
|
|
# intact file hash, valid timestamp. Required once signing is on.
|
|
$sig = Get-AuthenticodeSignature "$env:ALKANE_NATIVE\alkane-toolkit.exe"
|
|
Write-Host "Signature: $($sig.Status) $($sig.StatusMessage)"
|
|
if ($sig.SignerCertificate) { Write-Host "Signer: $($sig.SignerCertificate.Subject)" }
|
|
if ($sig.TimeStamperCertificate) { Write-Host "Timestamp: $($sig.TimeStamperCertificate.Subject)" }
|
|
if ($env:SIGNING_ENABLED -and $sig.Status -ne 'Valid') { exit 1 }
|
|
|
|
- name: Unit tests (native Windows)
|
|
run: |
|
|
$failed = @()
|
|
foreach ($test in Get-Content "$env:ALKANE_NATIVE\tests\tests.txt") {
|
|
Write-Host "== $test"
|
|
& "$env:ALKANE_NATIVE\tests\$test"
|
|
if ($LASTEXITCODE -ne 0) { $failed += $test }
|
|
}
|
|
if ($failed) { Write-Host "FAILED: $($failed -join ', ')"; exit 1 }
|
|
|
|
- name: Headless UI self-test (native Windows)
|
|
run: |
|
|
# A GUI-subsystem executable: wait for it and read its redirected output.
|
|
$env:ALKANE_SELFTEST = '1'
|
|
$out = "$env:ALKANE_NATIVE\selftest.txt"
|
|
$p = Start-Process -FilePath "$env:ALKANE_NATIVE\alkane-toolkit.exe" -Wait -PassThru `
|
|
-NoNewWindow -RedirectStandardOutput $out -RedirectStandardError "$out.err"
|
|
Get-Content $out, "$out.err"
|
|
if ($p.ExitCode -ne 0) { exit $p.ExitCode }
|
|
|
|
- name: Remove the downloaded build
|
|
if: always()
|
|
run: |
|
|
if ($env:ALKANE_NATIVE) { Remove-Item -Recurse -Force $env:ALKANE_NATIVE -ErrorAction SilentlyContinue }
|