Verify the Windows driver round trip and package the operator probe

This commit is contained in:
FredApps committed 2026-12-03 00:53:56 +01:00
1 parent f785466336
commit 21e9000e9a
1 file changed
+59
@@ -0,0 +1,59 @@
name: Probe Windows driver-private print settings
on:
push:
branches: [verify/pdfcraft-private-settings-probe-4859]
permissions:
contents: read
jobs:
driver:
runs-on: windows-2025
timeout-minutes: 60
env:
CARGO_PROFILE_DEV_DEBUG: '0'
CARGO_PROFILE_TEST_DEBUG: '0'
CARGO_INCREMENTAL: '0'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
repository: storytold/craft-libs
ref: 69c17f55cf638de8539a2785a59154c815af0854
persist-credentials: false
- uses: storytold/craft-common-actions/actions/checkout-craft-fonts@58848078cd09e3ca182891a8b76ee979f1eb6e1c
with:
ref: b076417b5880bd4154bd22f00695b1d28c6bea83
- name: Choose build volume and build the operator kit
shell: pwsh
run: |
$volume = Get-PSDrive -PSProvider FileSystem | Where-Object { $_.Free -gt 0 -and $_.Root -match '^[A-Za-z]:\\$' } | Sort-Object -Descending Free | Select-Object -First 1
$env:CARGO_TARGET_DIR = Join-Path $volume.Root "settings-probe-$env:GITHUB_RUN_ID"
"CARGO_TARGET_DIR=$env:CARGO_TARGET_DIR" >> $env:GITHUB_ENV
cargo test --locked -p craft-print --example print_acceptance
if ($LASTEXITCODE) { exit $LASTEXITCODE }
cargo build --locked -p craft-print --example print_acceptance
if ($LASTEXITCODE) { exit $LASTEXITCODE }
- name: Compare defaults on the installed Windows PDF driver and reject an unknown queue
shell: pwsh
run: |
$bin = Join-Path $env:CARGO_TARGET_DIR 'debug/examples/print_acceptance.exe'
$queue = 'Microsoft Print to PDF'
Get-Printer -Name $queue -ErrorAction Stop | Select-Object Name,DriverName
$before = @(Get-PrintJob -PrinterName $queue -ErrorAction Stop | ForEach-Object ID)
$result = & $bin probe-settings $queue --queue-default
if ($LASTEXITCODE -ne 0 -or @($result).Count -ne 1 -or $result -cnotmatch '^comparison=(unchanged|changed|removed|no-input-private-settings)$') { throw 'Expected one redacted driver comparison.' }
Write-Host $result
$unknown = & $bin probe-settings 'Craft missing queue 4859' --queue-default 2>&1
if ($LASTEXITCODE -eq 0 -or ($unknown -join '') -notmatch 'choose an installed queue') { throw 'Expected unknown queue refusal.' }
$after = @(Get-PrintJob -PrinterName $queue -ErrorAction Stop | ForEach-Object ID)
if (($before -join ',') -cne ($after -join ',')) { throw 'The Windows queue changed during the probe.' }
New-Item -ItemType Directory -Path kit | Out-Null
Copy-Item $bin kit/print_acceptance.exe
Copy-Item crates/print/docs/acceptance.md kit/
& $bin fixture baseline kit/numbered.pdf
if ($LASTEXITCODE) { exit $LASTEXITCODE }
Get-ChildItem kit -File | Sort-Object Name | ForEach-Object { '{0} {1}' -f (Get-FileHash $_.FullName).Hash.ToLowerInvariant(),$_.Name } | Set-Content -Encoding ascii checksums.txt
Move-Item checksums.txt kit/
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
with:
name: windows-private-settings-operator-kit
path: kit
if-no-files-found: error