diff options
| author | JJ Liebig <jonathan.liebig@gmail.com> | 2026-07-27 13:15:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-27 14:15:23 +0300 |
| commit | 6d1bedee3ee164ed0151f8adab1313be5915d652 (patch) | |
| tree | f7c524094e2d39327ff9615993e4ae6b563ed80f /scripts | |
| parent | dc2506ea8cb58fc8cde7ceb357cad03b1aba0da1 (diff) | |
fix: make native windows checks reliable (#1925)
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/windows_check.ps1 | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/scripts/windows_check.ps1 b/scripts/windows_check.ps1 new file mode 100644 index 00000000..7c225301 --- /dev/null +++ b/scripts/windows_check.ps1 @@ -0,0 +1,68 @@ +param( + [ValidateSet("lint", "check")] + [string]$Mode = "check" +) + +$ErrorActionPreference = "Stop" + +function Invoke-Checked { + param([string]$Command, [string[]]$Arguments) + + & $Command @Arguments + if ($LASTEXITCODE -ne 0) { + throw "command failed with exit code $LASTEXITCODE`: $Command $($Arguments -join ' ')" + } +} + +function Invoke-CargoWithZigCacheRecovery { + param([string[]]$Arguments) + + & cargo @Arguments + if ($LASTEXITCODE -eq 0) { + return + } + + Write-Warning "cargo compile failed; clearing Zig build caches and retrying once" + Remove-Item -Recurse -Force .zig-cache -ErrorAction SilentlyContinue + Remove-Item -Recurse -Force vendor/libghostty-vt/.zig-cache -ErrorAction SilentlyContinue + Remove-Item -Recurse -Force vendor/libghostty-vt/zig-out -ErrorAction SilentlyContinue + Invoke-Checked cargo $Arguments +} + +Invoke-Checked rustup @("target", "add", "x86_64-pc-windows-msvc") +Invoke-Checked cargo @("fmt", "--check") +Invoke-CargoWithZigCacheRecovery @( + "clippy", + "--bin", + "herdr", + "--locked", + "--target", + "x86_64-pc-windows-msvc", + "--", + "-D", + "warnings" +) + +if ($Mode -eq "lint") { + return +} + +Invoke-Checked cargo @( + "test", + "--locked", + "--target", + "x86_64-pc-windows-msvc", + "--bin", + "herdr", + "windows_" +) +Invoke-Checked cargo @( + "test", + "--locked", + "--target", + "x86_64-pc-windows-msvc", + "--bin", + "herdr", + "server::client_transport::tests" +) +Invoke-Checked cargo @("build", "--locked", "--target", "x86_64-pc-windows-msvc") |
