test: trigger winget arm64 probe on branch push #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Probe WinGet ARM64 Store Download | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - codex/probe-winget-arm64 | |
| permissions: | |
| contents: read | |
| jobs: | |
| probe: | |
| name: Probe WinGet ARM64 download | |
| runs-on: windows-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Download Codex ARM64 via WinGet | |
| id: winget | |
| shell: pwsh | |
| run: | | |
| $ErrorActionPreference = "Continue" | |
| $ProgressPreference = "SilentlyContinue" | |
| New-Item -ItemType Directory -Force -Path winget-output, winget-logs | Out-Null | |
| $outputDir = (Resolve-Path "winget-output").Path | |
| $logDir = (Resolve-Path "winget-logs").Path | |
| $resultPath = Join-Path $logDir "result.txt" | |
| "timestamp=$((Get-Date).ToUniversalTime().ToString("o"))" | Set-Content -Encoding utf8 -Path $resultPath | |
| "runner_os=$env:RUNNER_OS" | Add-Content -Encoding utf8 -Path $resultPath | |
| "processor_architecture=$env:PROCESSOR_ARCHITECTURE" | Add-Content -Encoding utf8 -Path $resultPath | |
| $wingetCommand = Get-Command winget -ErrorAction SilentlyContinue | |
| if (-not $wingetCommand) { | |
| "winget_available=false" | Add-Content -Encoding utf8 -Path $resultPath | |
| "exitCode=127" | Add-Content -Encoding utf8 -Path $resultPath | |
| "arm64PackageCount=0" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| exit 0 | |
| } | |
| "winget_available=true" | Add-Content -Encoding utf8 -Path $resultPath | |
| $wingetCommand | Format-List * | Out-File -Encoding utf8 -FilePath (Join-Path $logDir "winget-command.txt") | |
| & winget --info *>&1 | | |
| Tee-Object -FilePath (Join-Path $logDir "winget-info.log") | |
| & winget source list *>&1 | | |
| Tee-Object -FilePath (Join-Path $logDir "winget-source-list.log") | |
| & winget source update *>&1 | | |
| Tee-Object -FilePath (Join-Path $logDir "winget-source-update.log") | |
| $downloadArgs = @( | |
| "download", | |
| "--id", "9PLM9XGG6VKS", | |
| "--source", "msstore", | |
| "--architecture", "arm64", | |
| "--platform", "Windows.Desktop", | |
| "--skip-license", | |
| "--accept-source-agreements", | |
| "--accept-package-agreements", | |
| "--verbose-logs", | |
| "--download-directory", $outputDir | |
| ) | |
| "winget $($downloadArgs -join ' ')" | | |
| Set-Content -Encoding utf8 -Path (Join-Path $logDir "winget-download-command.txt") | |
| & winget @downloadArgs *>&1 | | |
| Tee-Object -FilePath (Join-Path $logDir "winget-download-arm64.log") | |
| $downloadExitCode = $LASTEXITCODE | |
| "exitCode=$downloadExitCode" | Add-Content -Encoding utf8 -Path $resultPath | |
| $files = @(Get-ChildItem -LiteralPath $outputDir -Recurse -File -ErrorAction SilentlyContinue) | |
| $files | | |
| Select-Object FullName, Name, Length, LastWriteTimeUtc | | |
| ConvertTo-Json -Depth 3 | | |
| Set-Content -Encoding utf8 -Path (Join-Path $logDir "downloaded-files.json") | |
| if ($files.Count -gt 0) { | |
| Get-FileHash -Algorithm SHA256 -LiteralPath $files.FullName | | |
| Select-Object Algorithm, Hash, Path | | |
| ConvertTo-Json -Depth 3 | | |
| Set-Content -Encoding utf8 -Path (Join-Path $logDir "downloaded-file-hashes.json") | |
| } | |
| $arm64Packages = @( | |
| $files | Where-Object { | |
| $_.Name -match '^OpenAI\.Codex_.*_arm64__.*\.(Msix|msix|Appx|appx|MsixBundle|msixbundle|AppxBundle|appxbundle)$' | |
| } | |
| ) | |
| "arm64PackageCount=$($arm64Packages.Count)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| "arm64PackageCount=$($arm64Packages.Count)" | Add-Content -Encoding utf8 -Path $resultPath | |
| if ($arm64Packages.Count -gt 0) { | |
| "arm64Packages=$($arm64Packages.Name -join ',')" | Add-Content -Encoding utf8 -Path $resultPath | |
| } | |
| exit 0 | |
| - name: Upload WinGet probe logs | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: winget-arm64-probe-logs | |
| path: winget-logs | |
| if-no-files-found: warn | |
| - name: Fail when ARM64 package was not downloaded | |
| if: always() | |
| shell: pwsh | |
| run: | | |
| $resultPath = "winget-logs/result.txt" | |
| if (Test-Path -LiteralPath $resultPath) { | |
| Get-Content -LiteralPath $resultPath | |
| } | |
| if ("${{ steps.winget.outputs.arm64PackageCount }}" -ne "0") { | |
| exit 0 | |
| } | |
| Write-Error "WinGet did not download an OpenAI Codex ARM64 Store package." | |
| exit 1 |