From 16142b5f5eda95450d0362c53857004b5c043262 Mon Sep 17 00:00:00 2001 From: Hunter Bown Date: Tue, 5 May 2026 03:04:17 -0500 Subject: [PATCH] fix(release): unbreak Windows build + harden Linux apt step PR #646 imported `MessageBeep` from `windows::Win32::UI::WindowsAndMessaging`, but in `windows` crate 0.60 the function lives at `windows::Win32::System::Diagnostics::Debug::MessageBeep` and now takes a typed `MESSAGEBOX_STYLE` returning `Result<()>`. The wrong import broke every Windows build (Test, npm wrapper smoke, and the windows-msvc release matrix entry). Fix the import path, enable the `Win32_System_Diagnostics_Debug` feature, pass `MESSAGEBOX_STYLE(0)` for MB_OK, and discard the Result. The v0.8.12 release also tripped on a transient `apt-get update` mirror sync error on the ubuntu-24.04-arm runner, cascading via fail-fast. Wrap every apt-get update in CI/release with a 5-attempt retry so flaky ports.ubuntu.com mirrors no longer take down the binary matrix. Verified: cargo check --target x86_64-pc-windows-gnu compiles cleanly. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 40 +++++++++++++++++++++++++---- .github/workflows/release.yml | 16 ++++++++++-- crates/tui/Cargo.toml | 2 +- crates/tui/src/tui/notifications.rs | 10 +++++--- 4 files changed, 57 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6e56eb1..00c8c110 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,13 @@ jobs: - uses: dtolnay/rust-toolchain@stable - name: Install Linux system dependencies if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev pkg-config + run: | + for i in 1 2 3 4 5; do + sudo apt-get update && break + echo "apt-get update failed (attempt $i); retrying in 15s" + sleep 15 + done + sudo apt-get install -y libdbus-1-dev pkg-config - uses: actions/setup-node@v4 with: node-version: 20 @@ -38,7 +44,13 @@ jobs: components: clippy, rustfmt - name: Install Linux system dependencies if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev pkg-config + run: | + for i in 1 2 3 4 5; do + sudo apt-get update && break + echo "apt-get update failed (attempt $i); retrying in 15s" + sleep 15 + done + sudo apt-get install -y libdbus-1-dev pkg-config - uses: Swatinem/rust-cache@v2 - name: Check formatting run: cargo fmt --all -- --check @@ -60,7 +72,13 @@ jobs: - uses: dtolnay/rust-toolchain@stable - name: Install Linux system dependencies if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev pkg-config + run: | + for i in 1 2 3 4 5; do + sudo apt-get update && break + echo "apt-get update failed (attempt $i); retrying in 15s" + sleep 15 + done + sudo apt-get install -y libdbus-1-dev pkg-config - uses: Swatinem/rust-cache@v2 - name: Run tests run: cargo test --workspace --all-features --locked @@ -81,7 +99,13 @@ jobs: - uses: dtolnay/rust-toolchain@stable - name: Install Linux system dependencies if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev pkg-config + run: | + for i in 1 2 3 4 5; do + sudo apt-get update && break + echo "apt-get update failed (attempt $i); retrying in 15s" + sleep 15 + done + sudo apt-get install -y libdbus-1-dev pkg-config - uses: actions/setup-node@v4 with: node-version: 20 @@ -101,7 +125,13 @@ jobs: - uses: dtolnay/rust-toolchain@stable - name: Install Linux system dependencies if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev pkg-config + run: | + for i in 1 2 3 4 5; do + sudo apt-get update && break + echo "apt-get update failed (attempt $i); retrying in 15s" + sleep 15 + done + sudo apt-get install -y libdbus-1-dev pkg-config - uses: Swatinem/rust-cache@v2 - name: Build docs run: cargo doc --workspace --no-deps diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 92767366..5612afd3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,13 @@ jobs: components: clippy, rustfmt - name: Install Linux system dependencies if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev pkg-config + run: | + for i in 1 2 3 4 5; do + sudo apt-get update && break + echo "apt-get update failed (attempt $i); retrying in 15s" + sleep 15 + done + sudo apt-get install -y libdbus-1-dev pkg-config - uses: Swatinem/rust-cache@v2 - name: Format check run: cargo fmt --all -- --check @@ -110,7 +116,13 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Install Linux system dependencies if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev pkg-config + run: | + for i in 1 2 3 4 5; do + sudo apt-get update && break + echo "apt-get update failed (attempt $i); retrying in 15s" + sleep 15 + done + sudo apt-get install -y libdbus-1-dev pkg-config - name: Install zig if: runner.os == 'Linux' uses: goto-bus-stop/setup-zig@v2 diff --git a/crates/tui/Cargo.toml b/crates/tui/Cargo.toml index 6e93ed88..99f93e6f 100644 --- a/crates/tui/Cargo.toml +++ b/crates/tui/Cargo.toml @@ -80,4 +80,4 @@ libc = "0.2" libc = "0.2" [target.'cfg(target_os = "windows")'.dependencies] -windows = { version = "0.60", features = ["Win32_Foundation", "Win32_UI_WindowsAndMessaging"] } +windows = { version = "0.60", features = ["Win32_Foundation", "Win32_UI_WindowsAndMessaging", "Win32_System_Diagnostics_Debug"] } diff --git a/crates/tui/src/tui/notifications.rs b/crates/tui/src/tui/notifications.rs index e6583a16..2d777cb2 100644 --- a/crates/tui/src/tui/notifications.rs +++ b/crates/tui/src/tui/notifications.rs @@ -6,7 +6,9 @@ //! running inside a tmux session. #[cfg(target_os = "windows")] -use windows::Win32::UI::WindowsAndMessaging::MessageBeep; +use windows::Win32::System::Diagnostics::Debug::MessageBeep; +#[cfg(target_os = "windows")] +use windows::Win32::UI::WindowsAndMessaging::MESSAGEBOX_STYLE; use std::io::{self, Write}; use std::time::Duration; @@ -52,9 +54,11 @@ impl Method { /// API directly to produce the standard notification sound. #[cfg(target_os = "windows")] fn windows_bell() { - // MB_OK = 0x00000000 — plays the default system sound. + // MB_OK = 0x00000000 — plays the default system sound. Best-effort: a + // failed beep is not worth surfacing to the caller, so the Result is + // discarded. unsafe { - MessageBeep(0x00000000); + let _ = MessageBeep(MESSAGEBOX_STYLE(0)); } }