Skip to content

Commit e7049fb

Browse files
committed
Add Windows SDK tool detection and enhance testing for MSIX bundles
1 parent f86b827 commit e7049fb

1 file changed

Lines changed: 80 additions & 5 deletions

File tree

.github/workflows/tests.yml

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,74 @@ jobs:
4747
Copy-Item -Recurse test-content-x64 test-content-arm64
4848
(Get-Content test-content-arm64/AppxManifest.xml) -replace 'x64', 'arm64' | Set-Content test-content-arm64/AppxManifest.xml
4949
50-
- name: Test CLI pack x64
50+
- name: Locate Windows SDK tools
51+
id: sdk
52+
shell: pwsh
53+
run: |
54+
$bin = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin' -Directory `
55+
| Where-Object { Test-Path "$($_.FullName)\x64\MakeAppx.exe" } `
56+
| Sort-Object Name -Descending `
57+
| Select-Object -First 1
58+
if (-not $bin) { Write-Error "Windows SDK not found"; exit 1 }
59+
$base = "$($bin.FullName)\x64"
60+
echo "MAKEAPPX=$base\MakeAppx.exe" >> $env:GITHUB_OUTPUT
61+
echo "SIGNTOOL=$base\signtool.exe" >> $env:GITHUB_OUTPUT
62+
Write-Host "Using SDK at $base"
63+
64+
# --- Test 1: pack one arch + bundle (native) -> MakeAppx unbundle/unpack roundtrip ---
65+
- name: Native pack x64 + bundle
5166
shell: pwsh
5267
run: |
5368
msixbundle-cli --out-dir ./output --dir-x64 ./test-content-x64
5469
if (!(Test-Path ./output/*.msixbundle)) { exit 1 }
5570
56-
- name: Test CLI multi-arch bundle with --validate
71+
- name: Roundtrip - MakeAppx unbundle the native bundle
72+
shell: pwsh
73+
run: |
74+
$bundle = (Get-ChildItem ./output/*.msixbundle)[0].FullName
75+
& '${{ steps.sdk.outputs.MAKEAPPX }}' unbundle /p $bundle /d ./roundtrip-1 /o
76+
if ($LASTEXITCODE -ne 0) { exit 1 }
77+
if (!(Test-Path ./roundtrip-1/*.msix)) { exit 1 }
78+
79+
- name: Roundtrip - MakeAppx unpack the contained .msix
80+
shell: pwsh
81+
run: |
82+
$msix = (Get-ChildItem ./roundtrip-1/*.msix)[0].FullName
83+
& '${{ steps.sdk.outputs.MAKEAPPX }}' unpack /p $msix /d ./roundtrip-1-unpack /o
84+
if ($LASTEXITCODE -ne 0) { exit 1 }
85+
if (!(Test-Path ./roundtrip-1-unpack/AppxManifest.xml)) { exit 1 }
86+
87+
# --- Test 2: multi-arch bundle (native) + appcert WACK validate ---
88+
- name: Native multi-arch bundle with WACK --validate
5789
shell: pwsh
5890
run: |
5991
msixbundle-cli --out-dir ./output-multi --dir-x64 ./test-content-x64 --dir-arm64 ./test-content-arm64 --validate
6092
if (!(Test-Path ./output-multi/*.msixbundle)) { exit 1 }
6193
94+
- name: Roundtrip - MakeAppx unbundle the multi-arch bundle
95+
shell: pwsh
96+
run: |
97+
$bundle = (Get-ChildItem ./output-multi/*.msixbundle)[0].FullName
98+
& '${{ steps.sdk.outputs.MAKEAPPX }}' unbundle /p $bundle /d ./roundtrip-multi /o
99+
if ($LASTEXITCODE -ne 0) { exit 1 }
100+
# Should contain both x64 and arm64 .msix files.
101+
$msixes = Get-ChildItem ./roundtrip-multi/*.msix
102+
if ($msixes.Count -lt 2) {
103+
Write-Error "Expected at least 2 .msix in unbundled output, got $($msixes.Count)"
104+
exit 1
105+
}
106+
107+
- name: Roundtrip - MakeAppx unpack each contained .msix
108+
shell: pwsh
109+
run: |
110+
foreach ($msix in Get-ChildItem ./roundtrip-multi/*.msix) {
111+
$out = "./roundtrip-multi-unpack/$($msix.BaseName)"
112+
& '${{ steps.sdk.outputs.MAKEAPPX }}' unpack /p $msix.FullName /d $out /o
113+
if ($LASTEXITCODE -ne 0) { exit 1 }
114+
if (!(Test-Path "$out/AppxManifest.xml")) { exit 1 }
115+
}
116+
117+
# --- Test 3: native signing (PFX via msix::RsaSigner) verified by SignTool ---
62118
- name: Create test certificate
63119
id: cert
64120
shell: pwsh
@@ -74,13 +130,32 @@ jobs:
74130
run: |
75131
certutil -addstore root test.cer
76132
77-
- name: Test CLI with PFX signing and verification
133+
- name: Native PFX signing (--pfx routes through msix::sign_package)
78134
shell: pwsh
79135
run: |
80-
msixbundle-cli --out-dir ./output-signed --dir-x64 ./test-content-x64 --pfx ./test.pfx --pfx-password TestPass123 --timestamp-url "" --verify
136+
msixbundle-cli --out-dir ./output-signed --dir-x64 ./test-content-x64 --pfx ./test.pfx --pfx-password TestPass123 --timestamp-url ""
81137
if (!(Test-Path ./output-signed/*.msixbundle)) { exit 1 }
82138
83-
- name: Test CLI with thumbprint signing and verification
139+
- name: Verify native-signed bundle with SignTool
140+
shell: pwsh
141+
run: |
142+
$bundle = (Get-ChildItem ./output-signed/*.msixbundle)[0].FullName
143+
& '${{ steps.sdk.outputs.SIGNTOOL }}' verify /pa $bundle
144+
if ($LASTEXITCODE -ne 0) { exit 1 }
145+
146+
- name: Roundtrip - MakeAppx unbundle the native-signed bundle
147+
shell: pwsh
148+
run: |
149+
$bundle = (Get-ChildItem ./output-signed/*.msixbundle)[0].FullName
150+
& '${{ steps.sdk.outputs.MAKEAPPX }}' unbundle /p $bundle /d ./roundtrip-signed /o
151+
if ($LASTEXITCODE -ne 0) { exit 1 }
152+
if (!(Test-Path ./roundtrip-signed/AppxSignature.p7x)) {
153+
Write-Error "Signed bundle is missing AppxSignature.p7x after unbundle"
154+
exit 1
155+
}
156+
157+
# --- Test 4: thumbprint signing routes through SignTool (Windows-only) ---
158+
- name: SDK SignTool signing (--thumbprint)
84159
shell: pwsh
85160
run: |
86161
msixbundle-cli --out-dir ./output-signed-thumb --dir-x64 ./test-content-x64 --thumbprint ${{ steps.cert.outputs.THUMBPRINT }} --timestamp-url "" --verify

0 commit comments

Comments
 (0)