1param(2 [Parameter(Mandatory = $true)][string]$Installer,3 [Parameter(Mandatory = $true)][string]$Version,4 [Parameter(Mandatory = $true)][string]$RepoRoot5)67$ErrorActionPreference = "Stop"8$stage = Join-Path $env:RUNNER_TEMP ("atlas-windows-smoke-" + [Guid]::NewGuid().ToString("N"))9New-Item -ItemType Directory -Path $stage | Out-Null10$app = $null1112try {13 $install = Start-Process -FilePath $Installer -ArgumentList '/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', '/CURRENTUSER' -Wait -PassThru14 if ($install.ExitCode -ne 0) { throw "installer exited $($install.ExitCode)" }1516 $association = (Get-Item "HKCU:\Software\Classes\.atlas").GetValue("")17 if ($association -ne "Atlas.Volume") { throw "unexpected .atlas association: $association" }18 $contentType = (Get-Item "HKCU:\Software\Classes\.atlas").GetValue("Content Type")19 if ($contentType -ne "application/vnd.felinestatemachine.atlas") { throw "unexpected content type: $contentType" }20 $command = (Get-Item "HKCU:\Software\Classes\Atlas.Volume\shell\open\command").GetValue("")21 if ($command -notmatch '^"([^"]+Atlas\.exe)" "%1"$') { throw "unexpected open command: $command" }22 $executable = $Matches[1]23 if (-not (Test-Path $executable -PathType Leaf)) { throw "installed executable missing: $executable" }2425 $cache = Join-Path $stage "cache"26 $source = Join-Path $stage "source"27 & go run "$RepoRoot/cmd/atlas" build -cache $cache -bundles $source "$RepoRoot/examples/sample-region.atlas-project"28 if ($LASTEXITCODE -ne 0) { throw "Sample Region fixture build exited $LASTEXITCODE" }29 $artifact = Get-ChildItem $source -Filter "sample-region-*.atlas" | Select-Object -First 130 if ($null -eq $artifact) { throw "Sample Region fixture was not built" }3132 $library = Join-Path $stage "library"33 $data = Join-Path $stage "data"34 New-Item -ItemType Directory -Path $library, $data | Out-Null35 $env:ATLAS_BUNDLES_DIR = $library36 $env:ATLAS_DATA_DIR = $data37 $app = Start-Process -FilePath $executable -ArgumentList $artifact.FullName -PassThru38 $installed = $null39 foreach ($attempt in 1..60) {40 $installed = Get-ChildItem $library -Filter "sample-region-*.atlas" -ErrorAction SilentlyContinue | Select-Object -First 141 if ($null -ne $installed) { break }42 if ($app.HasExited) { throw "installed Atlas exited before file intake with $($app.ExitCode)" }43 Start-Sleep -Seconds 144 }45 if ($null -eq $installed) { throw "installed Atlas did not intake Sample Region" }46 if ((Get-FileHash $artifact.FullName -Algorithm SHA256).Hash -ne (Get-FileHash $installed.FullName -Algorithm SHA256).Hash) {47 throw "installed Atlas changed the handed-off artifact"48 }49}50finally {51 if ($null -ne $app -and -not $app.HasExited) { Stop-Process -Id $app.Id -Force }52 if (Test-Path $stage) { Remove-Item -Recurse -Force $stage }53}