diff options
| -rw-r--r-- | .github/workflows/ci.yml | 28 | ||||
| -rw-r--r-- | justfile | 14 | ||||
| -rw-r--r-- | scripts/windows_check.ps1 | 68 | ||||
| -rw-r--r-- | src/platform/windows.rs | 1 |
4 files changed, 84 insertions, 27 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa655578..16fc5c2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -141,33 +141,7 @@ jobs: - name: Run Windows checks if: matrix.kind == 'windows' shell: pwsh - run: | - $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 cargo @("fmt", "--check") - Invoke-CargoWithZigCacheRecovery @("clippy", "--bin", "herdr", "--locked", "--target", "x86_64-pc-windows-msvc", "--", "-D", "warnings") - 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") + run: .\scripts\windows_check.ps1 -Mode check - name: Smoke ConPTY pane if: matrix.kind == 'windows' @@ -12,26 +12,40 @@ test-one filter: cargo nextest run --locked "{{filter}}" --status-level fail --final-status-level fail --failure-output final --success-output never # Run fast local lint checks +[unix] lint: cargo fmt --check cargo clippy --all-targets --locked -- -D warnings +[script("powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File")] +[windows] +lint: + & .\scripts\windows_check.ps1 -Mode lint + # Run PR CI checks +[unix] ci filter='all()': lint cargo nextest run --locked -E "{{filter}}" --status-level fail --final-status-level slow --failure-output final --success-output never just integration-assets-test just plugin-marketplace-test # Run Windows target lint from Unix/macOS to catch cfg(windows) compile and clippy failures before CI +[unix] windows-lint: rustup target add x86_64-pc-windows-msvc LIBGHOSTTY_VT_SIMD=false cargo clippy --bin herdr --locked --target x86_64-pc-windows-msvc -- -D warnings # Check formatting + run unit tests + Windows target lint + maintenance script tests +[unix] check: ci windows-lint python3 -m unittest scripts.test_agent_detection_manifest_check scripts.test_changelog scripts.test_config_reference_check scripts.test_docs_translation_parity scripts.test_hermes_integration_asset scripts.test_package_windows_conpty scripts.test_preview scripts.test_vendor_libghostty_vt scripts.test_vendor_portable_pty @echo "docs reminder: if this changes user-facing behavior, make sure the relevant release docs are updated or called out before release." +[script("powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File")] +[windows] +check: + & .\scripts\windows_check.ps1 -Mode check + # Install repo-local git hooks install-hooks: git config core.hooksPath .githooks 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") diff --git a/src/platform/windows.rs b/src/platform/windows.rs index 8a171716..2caf116d 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -1156,6 +1156,7 @@ mod tests { #[test] fn windows_shells_round_trip_agent_arguments_through_a_real_command() { + let _lock = crate::integration::integration_env_lock(); let base = std::env::temp_dir().join(format!( "herdr-agent-argv-{}-{}", std::process::id(), |
