ci: auto-update Homebrew tap on release #37

Merged
razvandimescu merged 2 commits from fix/windows-clippy-and-ci into main 2026-04-07 03:46:55 +08:00
2 changed files with 32 additions and 0 deletions

View File

@@ -27,6 +27,17 @@ jobs:
- name: audit - name: audit
run: cargo install cargo-audit && cargo audit run: cargo install cargo-audit && cargo audit
check-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: clippy
run: cargo clippy -- -D warnings
- name: test
run: cargo test
check-windows: check-windows:
runs-on: windows-latest runs-on: windows-latest
steps: steps:

View File

@@ -903,6 +903,7 @@ pub fn uninstall_service() -> Result<(), String> {
/// Restart the service (kill process, launchd/systemd auto-restarts with new binary). /// Restart the service (kill process, launchd/systemd auto-restarts with new binary).
pub fn restart_service() -> Result<(), String> { pub fn restart_service() -> Result<(), String> {
#[cfg(any(target_os = "macos", target_os = "linux"))]
let exe_path = let exe_path =
std::env::current_exe().map_err(|e| format!("failed to get current exe: {}", e))?; std::env::current_exe().map_err(|e| format!("failed to get current exe: {}", e))?;
@@ -969,6 +970,7 @@ pub fn service_status() -> Result<(), String> {
} }
} }
#[cfg(any(target_os = "macos", target_os = "linux"))]
fn replace_exe_path(service: &str) -> Result<String, String> { fn replace_exe_path(service: &str) -> Result<String, String> {
let exe_path = let exe_path =
std::env::current_exe().map_err(|e| format!("failed to get current exe: {}", e))?; std::env::current_exe().map_err(|e| format!("failed to get current exe: {}", e))?;
@@ -1411,6 +1413,25 @@ Wireless LAN adapter Wi-Fi:
); );
} }
#[test]
#[cfg(any(target_os = "macos", target_os = "linux"))]
fn replace_exe_path_substitutes_template() {
let plist = include_str!("../com.numa.dns.plist");
let unit = include_str!("../numa.service");
assert!(plist.contains("{{exe_path}}"), "plist missing placeholder");
assert!(
unit.contains("{{exe_path}}"),
"unit file missing placeholder"
);
let result = replace_exe_path(plist).expect("replace_exe_path failed for plist");
assert!(!result.contains("{{exe_path}}"));
let result = replace_exe_path(unit).expect("replace_exe_path failed for unit");
assert!(!result.contains("{{exe_path}}"));
}
#[test] #[test]
fn parse_ipconfig_skips_disconnected() { fn parse_ipconfig_skips_disconnected() {
let sample = "\ let sample = "\