From 8aceab785711a46a1ea600553bb7799a47604456 Mon Sep 17 00:00:00 2001 From: Breadway Date: Fri, 19 Jun 2026 08:38:40 +0800 Subject: [PATCH] CI: use /tmp for ecosystem clone; fix rustfmt violations --- .github/workflows/release.yml | 10 +++------- src/flow.rs | 4 +++- src/nm.rs | 10 +++++++++- src/watch.rs | 9 +++++---- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 828096e..78c9730 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ permissions: env: DL_DIR: /srv/breadway-dl - ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem + ECOSYSTEM_DIR: /tmp/bread-ecosystem-ci jobs: build: @@ -41,12 +41,8 @@ jobs: - name: ensure bread-ecosystem run: | - if [[ -d "${ECOSYSTEM_DIR}/.git" ]]; then - git -C "${ECOSYSTEM_DIR}" pull --ff-only - else - mkdir -p "$(dirname "${ECOSYSTEM_DIR}")" - git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}" - fi + rm -rf "${ECOSYSTEM_DIR}" + git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}" - name: regenerate index.json run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh" diff --git a/src/flow.rs b/src/flow.rs index 71f33f6..53a85dd 100644 --- a/src/flow.rs +++ b/src/flow.rs @@ -119,7 +119,9 @@ pub fn run(cfg: &Config, profile_name: &str) -> Outcome { on_bootstrap = true; log(&format!("bootstrap connected: {}", bdef.ssid)); } - Err(e) => log(&format!("bootstrap connect failed: {} — {e}", bdef.ssid)), + Err(e) => { + log(&format!("bootstrap connect failed: {} — {e}", bdef.ssid)) + } } } else { log(&format!("bootstrap not in range: {}", bdef.ssid)); diff --git a/src/nm.rs b/src/nm.rs index d51a32b..66ee649 100644 --- a/src/nm.rs +++ b/src/nm.rs @@ -319,7 +319,15 @@ pub fn connect_verbose(iface: &str, net: &NetworkDef, wait: u32, dns: &str) -> R } let o = run( "nmcli", - &["--wait", &wait_s, "connection", "up", &profile, "ifname", iface], + &[ + "--wait", + &wait_s, + "connection", + "up", + &profile, + "ifname", + iface, + ], Duration::from_secs(wait as u64 + 15), ); if !o.success { diff --git a/src/watch.rs b/src/watch.rs index b2d40f1..5290239 100644 --- a/src/watch.rs +++ b/src/watch.rs @@ -65,9 +65,8 @@ fn spawn_nm_monitor(tx: mpsc::Sender<()>) { let mut last = Instant::now() - Duration::from_secs(10); for line in reader.lines().map_while(Result::ok) { let l = line.to_lowercase(); - let interesting = l.contains("disconnect") - || l.contains("unavailable") - || l.contains("failed"); + let interesting = + l.contains("disconnect") || l.contains("unavailable") || l.contains("failed"); if interesting && last.elapsed() > Duration::from_millis(1500) { last = Instant::now(); let _ = tx.send(()); @@ -199,7 +198,9 @@ pub fn run(mut cfg: Config, run_initial: bool) -> i32 { Urgency::Normal, ); } - let elapsed = last_flow_at.map(|t| t.elapsed().as_secs()).unwrap_or(u64::MAX); + let elapsed = last_flow_at + .map(|t| t.elapsed().as_secs()) + .unwrap_or(u64::MAX); if elapsed >= FLOW_COOLDOWN { log(&format!( "watch: down ({:?}) profile={profile} ssid={:?} — running flow",