Skip to content

Commit cfd2a08

Browse files
committed
MSIX build: report failures as CI annotations
1 parent 0edc2f1 commit cfd2a08

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

‎packaging/windows/build_msix.ps1‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@
33
# FLOW: icons → PyInstaller one-folder → --selftest (real compile with bundled GCC)
44
# → layout + AppxManifest (version from medha/__init__.py) → makeappx pack → zip
55
$ErrorActionPreference = "Stop"
6+
# CI visibility: any failure becomes a GitHub annotation (readable on the run page
7+
# without signing in), including the last lines of output collected in $global:Tail.
8+
$global:Tail = New-Object System.Collections.Generic.List[string]
9+
function Run($step, [scriptblock]$cmd) {
10+
Write-Host "::group::$step"
11+
& $cmd 2>&1 | ForEach-Object { $l = "$_"; Write-Host $l; $global:Tail.Add($l); if ($global:Tail.Count -gt 25) { $global:Tail.RemoveAt(0) } }
12+
$code = $LASTEXITCODE
13+
Write-Host "::endgroup::"
14+
if ($code -ne 0) { throw "STEP FAILED: $step (exit $code)" }
15+
}
16+
trap {
17+
$msg = ($_ | Out-String) + "`n--- last output ---`n" + ($global:Tail -join "`n")
18+
Write-Host ("::error title=MSIX build failed::" + ($msg -replace "`r?`n", "%0A"))
19+
exit 1
20+
}
621
# Identity values are in AppxManifest.xml (copied from Partner Center → Product identity).
722
$root = Resolve-Path "$PSScriptRoot\..\.."
823
Set-Location $root
@@ -11,10 +26,9 @@ $msixVer = "$ver.0" # MSIX needs 4 parts: 2
1126
$layout = Join-Path $root "dist\msix-layout"
1227
Remove-Item -Recurse -Force $layout -ErrorAction SilentlyContinue
1328
New-Item -ItemType Directory -Force "$layout\Assets" | Out-Null
14-
python packaging\windows\make_icons.py docs\assets\logo-mark.svg "$layout\Assets"
15-
python -m PyInstaller --noconfirm --distpath dist packaging\windows\medha_windows.spec
16-
& dist\MEDHA\MEDHA.exe --selftest | Tee-Object -Variable st
17-
if ($LASTEXITCODE -ne 0) { throw "MEDHA.exe --selftest failed" }
29+
Run "icons" { python packaging\windows\make_icons.py docs\assets\logo-mark.svg "$layout\Assets" }
30+
Run "PyInstaller build" { python -m PyInstaller --noconfirm --distpath dist packaging\windows\medha_windows.spec }
31+
Run "MEDHA.exe --selftest" { & dist\MEDHA\MEDHA.exe --selftest }
1832
Copy-Item -Recurse dist\MEDHA "$layout\MEDHA"
1933
(Get-Content packaging\windows\AppxManifest.xml -Raw).Replace("__VERSION__", $msixVer) | Set-Content "$layout\AppxManifest.xml" -Encoding utf8
2034
$makeappx = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin\*\x64\makeappx.exe" | Sort-Object FullName -Descending | Select-Object -First 1

0 commit comments

Comments
 (0)