mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-02 20:18:38 -05:00
Packaging: the Windows signing test does not turn its expected warning into an annotation
The stable optional-signing case in nightly-signing-tests.ps1 calls sign.ps1 with no signing variables set. On a runner, GITHUB_ACTIONS is set, so sign.ps1 printed "Windows signing secrets not set" as a ::warning:: workflow command, and every nightly-check run showed it as a warning annotation. The test now clears GITHUB_ACTIONS for that call and restores it after. It reads the line from the warning stream and fails when the warning is missing or when the call prints a workflow command.
This commit is contained in:
1 parent
cdc14eb007
commit
3bf15fe5e6
1 file changed
+8
-1
@@ -84,7 +84,14 @@ try {
|
||||
$file = Join-Path $root 'owned-sentinel.exe'
|
||||
[IO.File]::WriteAllText($file, 'generated sentinel, not a real executable')
|
||||
$before = (Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash
|
||||
& $sign -Files $file
|
||||
# With GITHUB_ACTIONS set, sign.ps1 prints its unsigned-files warning as a workflow annotation.
|
||||
# The test clears it for this call, reads the warning from the warning stream and restores it.
|
||||
$actions = $env:GITHUB_ACTIONS
|
||||
$env:GITHUB_ACTIONS = $null
|
||||
try { $signOutput = @(& $sign -Files $file 3>&1) } finally { $env:GITHUB_ACTIONS = $actions }
|
||||
$warnings = @($signOutput | Where-Object { $_ -is [Management.Automation.WarningRecord] })
|
||||
Assert-Policy ($warnings.Count -eq 1 -and $warnings[0].Message.Contains('Windows signing secrets not set')) 'optional stable policy did not warn about unsigned files'
|
||||
Assert-Policy (-not ($signOutput | Where-Object { "$_".StartsWith('::') })) 'optional stable policy printed a workflow command'
|
||||
Assert-Policy ((Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash -ceq $before) 'optional stable policy changed unsigned bytes'
|
||||
Write-Output 'PASS: stable-optional-policy-preserves-owned-bytes'
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user