diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-07 16:47:20 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-07 16:47:20 +0300 |
| commit | 7c7d8c8619006b25244bcdac0abc560cd43108ab (patch) | |
| tree | 7566b4698a002aba909fed7eeb5ef78d104f5df0 | |
| parent | 0956ad8c5883014ebf88664099fae41edd3fdc9e (diff) | |
fix: gate windows updater checks
| -rw-r--r-- | .github/workflows/ci.yml | 46 | ||||
| -rw-r--r-- | src/main.rs | 1 | ||||
| -rw-r--r-- | src/update.rs | 10 |
3 files changed, 27 insertions, 30 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15de5e1b..6129ffd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,11 +42,15 @@ jobs: matrix: include: - os: ubuntu-latest + kind: unix nextest_filter: all() - os: macos-latest + kind: unix nextest_filter: not binary(live_handoff) + - os: windows-latest + kind: windows runs-on: ${{ matrix.os }} - timeout-minutes: 10 + timeout-minutes: 15 steps: - name: Checkout uses: actions/checkout@v6 @@ -54,9 +58,17 @@ jobs: persist-credentials: false - name: Install Rust + if: matrix.kind == 'unix' uses: dtolnay/rust-toolchain@stable + - name: Install Rust + if: matrix.kind == 'windows' + uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-pc-windows-msvc + - name: Install Rust tools + if: matrix.kind == 'unix' uses: taiki-e/install-action@b550161ef8a7bc4f2a671c0b03a18ac9ccedea1e # v2 with: tool: just,cargo-nextest @@ -74,37 +86,14 @@ jobs: uses: Swatinem/rust-cache@v2 with: cache-bin: false + key: ${{ matrix.os }} - name: Run checks + if: matrix.kind == 'unix' run: just ci '${{ matrix.nextest_filter }}' - check-windows: - name: check (windows) - runs-on: windows-latest - timeout-minutes: 15 - steps: - - name: Checkout - uses: actions/checkout@v6 - with: - persist-credentials: false - - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - targets: x86_64-pc-windows-msvc - - - name: Install Zig - uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1 - with: - version: 0.15.2 - - - name: Restore cargo cache - uses: Swatinem/rust-cache@v2 - with: - cache-bin: false - key: windows-x86_64-pc-windows-msvc - - name: Run Windows checks + if: matrix.kind == 'windows' shell: pwsh run: | $ErrorActionPreference = "Stop" @@ -122,6 +111,7 @@ jobs: Invoke-Checked cargo @("build", "--locked", "--target", "x86_64-pc-windows-msvc") - name: Smoke ConPTY pane + if: matrix.kind == 'windows' shell: pwsh run: | $ErrorActionPreference = "Stop" @@ -150,7 +140,7 @@ jobs: Start-Sleep -Seconds 2 $read = & $exe agent read smoke --source recent --lines 40 --format text $text = $read -join "`n" - if ($text -notmatch "Directory of") { + if ($text -notmatch "File\(s\)" -or $text -notmatch "Dir\(s\)") { throw "pane read did not include cmd.exe directory output: $text" } } finally { diff --git a/src/main.rs b/src/main.rs index ffd11140..d2beb114 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,6 +46,7 @@ mod agent_resume; mod api; mod app; mod build_info; +#[cfg(not(windows))] mod checksum; mod cli; mod client; diff --git a/src/update.rs b/src/update.rs index 6b428b78..3337d6e9 100644 --- a/src/update.rs +++ b/src/update.rs @@ -8,6 +8,7 @@ use std::collections::BTreeMap; use std::env; +#[cfg(not(windows))] use std::fs; use std::io::{self, BufRead, BufReader, IsTerminal, Write}; use std::path::{Path, PathBuf}; @@ -519,11 +520,13 @@ fn check_homebrew_latest() -> Result<Option<Version>, String> { // Download + install // --------------------------------------------------------------------------- +#[cfg(not(windows))] struct DownloadedUpdate { current_exe: PathBuf, tmp_path: Option<PathBuf>, } +#[cfg(not(windows))] impl Drop for DownloadedUpdate { fn drop(&mut self) { if let Some(tmp_path) = self.tmp_path.take() { @@ -533,6 +536,7 @@ impl Drop for DownloadedUpdate { } /// Download a release to a prepared executable temp file without touching the running server. +#[cfg(not(windows))] fn download_update(release: &ReleaseInfo) -> Result<DownloadedUpdate, String> { let current_exe = env::current_exe().map_err(|e| format!("can't find current binary: {e}"))?; @@ -592,6 +596,7 @@ fn download_update(release: &ReleaseInfo) -> Result<DownloadedUpdate, String> { }) } +#[cfg(not(windows))] fn install_downloaded_update(mut update: DownloadedUpdate) -> Result<(), String> { let tmp_path = update .tmp_path @@ -1955,6 +1960,9 @@ pub fn self_update(options: SelfUpdateOptions) -> Result<Version, String> { "installing {} with the Windows installer...", release.label() ); + if let Some(sha256) = &release.sha256 { + tracing::debug!(sha256 = %sha256, "selected Windows update asset has checksum"); + } install_windows_update_with_installer(channel)?; let updated_exe = windows_installed_herdr_exe_path()?; eprintln!("installed {}", release.label()); @@ -1971,8 +1979,6 @@ pub fn self_update(options: SelfUpdateOptions) -> Result<Version, String> { print_outdated_integration_notice_with_updated_binary(&updated_exe); print_running_session_update_outcomes(&server_update_outcomes, &release); - - return Ok(release.version); } #[cfg(not(windows))] |
