Skip to content

Commit 69fe860

Browse files
committed
Split CI into parallel jobs; fix formatting
1 parent 6f4c57b commit 69fe860

File tree

10 files changed

+64
-22
lines changed

10 files changed

+64
-22
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,58 @@ env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13-
check:
14-
name: Check & Test
13+
fmt:
14+
name: Formatting
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18+
- uses: dtolnay/rust-toolchain@stable
19+
- run: cargo fmt -- --check
1820

21+
build:
22+
name: Build
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
1926
- uses: dtolnay/rust-toolchain@stable
27+
- uses: Swatinem/rust-cache@v2
2028

29+
- name: Patch candle deps for CI
30+
run: |
31+
sed -i 's|candle-core = { path = "[^"]*" }|candle-core = "0.9"|' Cargo.toml
32+
sed -i 's|candle-nn = { path = "[^"]*" }|candle-nn = "0.9"|' Cargo.toml
33+
sed -i 's|candle-transformers = { path = "[^"]*" }|candle-transformers = "0.9"|' Cargo.toml
34+
35+
- run: cargo build --no-default-features
36+
37+
test:
38+
name: Tests
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
- uses: dtolnay/rust-toolchain@stable
2143
- uses: Swatinem/rust-cache@v2
2244

23-
# Candle deps use local path refs that don't exist in CI.
24-
# Swap them for the matching crates.io release.
2545
- name: Patch candle deps for CI
2646
run: |
2747
sed -i 's|candle-core = { path = "[^"]*" }|candle-core = "0.9"|' Cargo.toml
2848
sed -i 's|candle-nn = { path = "[^"]*" }|candle-nn = "0.9"|' Cargo.toml
2949
sed -i 's|candle-transformers = { path = "[^"]*" }|candle-transformers = "0.9"|' Cargo.toml
3050
31-
- name: Check formatting
32-
run: cargo fmt -- --check
51+
- run: cargo test --no-default-features
3352

34-
- name: Build (CPU only)
35-
run: cargo build --no-default-features
53+
clippy:
54+
name: Clippy
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: dtolnay/rust-toolchain@stable
59+
- uses: Swatinem/rust-cache@v2
3660

37-
- name: Run tests
38-
run: cargo test --no-default-features
61+
- name: Patch candle deps for CI
62+
run: |
63+
sed -i 's|candle-core = { path = "[^"]*" }|candle-core = "0.9"|' Cargo.toml
64+
sed -i 's|candle-nn = { path = "[^"]*" }|candle-nn = "0.9"|' Cargo.toml
65+
sed -i 's|candle-transformers = { path = "[^"]*" }|candle-transformers = "0.9"|' Cargo.toml
3966
40-
- name: Clippy
41-
run: cargo clippy --no-default-features -- -D warnings
67+
- run: cargo clippy --no-default-features -- -D warnings

examples/bench_text_encoder.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ fn bench(label: &str, encoder: &mut Qwen3TextEncoder, device: &Device) -> anyhow
5555
let min = times.iter().cloned().fold(f64::INFINITY, f64::min);
5656
let max = times.iter().cloned().fold(f64::NEG_INFINITY, f64::max);
5757

58-
println!("{label:6} mean={mean:7.1}ms min={min:7.1}ms max={max:7.1}ms (seq_len={SEQ_LEN}, {ITERS} iters)");
58+
println!(
59+
"{label:6} mean={mean:7.1}ms min={min:7.1}ms max={max:7.1}ms (seq_len={SEQ_LEN}, {ITERS} iters)"
60+
);
5961
Ok(())
6062
}
6163

examples/radio_daemon.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
use std::io::{self, BufRead, BufReader, Write};
3939
use std::os::unix::net::{UnixListener, UnixStream};
4040
use std::sync::atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering};
41-
use std::sync::{mpsc, Arc, Mutex};
41+
use std::sync::{Arc, Mutex, mpsc};
4242
use std::thread;
4343

4444
use ace_step_rs::manager::{GenerationManager, ManagerConfig};

src/audio/ogg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use crate::Result;
44
use std::io::Write;
5-
use std::num::{NonZeroU32, NonZeroU8};
5+
use std::num::{NonZeroU8, NonZeroU32};
66

77
pub fn write_ogg_to<W: Write>(
88
writer: W,

src/audio/wav.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ mod tests {
175175
let prev = vec![1.0f32; 16]; // 8 stereo frames
176176
let next = vec![0.0f32; 16];
177177
let result = crossfade(&prev, &next, 4, 2); // 4-frame crossfade
178-
// (16-8) + 8 + (16-8) = 24
178+
// (16-8) + 8 + (16-8) = 24
179179
assert_eq!(result.len(), 24);
180180
}
181181

src/bin/generation-daemon.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,23 @@ async fn process_request(line: &str, manager: &GenerationManager) -> Response {
304304
Err(e) => return Response::err(format!("generation failed: {e}")),
305305
};
306306

307-
if let Err(e) = write_audio(&output_path, &audio.samples, audio.sample_rate, audio.channels) {
307+
if let Err(e) = write_audio(
308+
&output_path,
309+
&audio.samples,
310+
audio.sample_rate,
311+
audio.channels,
312+
) {
308313
return Response::err(format!("failed to write audio file: {e}"));
309314
}
310315

311316
tracing::info!(output = %output_path, "done");
312317

313-
Response::ok(output_path, req.duration_s, audio.sample_rate, audio.channels)
318+
Response::ok(
319+
output_path,
320+
req.duration_s,
321+
audio.sample_rate,
322+
audio.channels,
323+
)
314324
}
315325

316326
async fn send_response(

src/manager.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ fn offload_to_cpu(
211211
Err(gpu_error) => {
212212
// Total failure — panic so the thread dies and the channel closes,
213213
// which will surface as errors to all future callers.
214-
panic!("both CPU offload and GPU reload failed: offload={reload_error}, gpu={gpu_error}");
214+
panic!(
215+
"both CPU offload and GPU reload failed: offload={reload_error}, gpu={gpu_error}"
216+
);
215217
}
216218
}
217219
}

src/model/encoder/text.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ pub fn format_metas(
152152
Some(d) if d > 0.0 => format!("{} seconds", d as u32),
153153
_ => "N/A".to_string(),
154154
};
155-
format!("- bpm: {bpm_str}\n- timesignature: {ts_str}\n- keyscale: {ks_str}\n- duration: {dur_str}\n")
155+
format!(
156+
"- bpm: {bpm_str}\n- timesignature: {ts_str}\n- keyscale: {ks_str}\n- duration: {dur_str}\n"
157+
)
156158
}
157159

158160
/// Format lyrics into the ACE-Step v1.5 lyric template.

src/radio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
use std::collections::VecDeque;
1111

12-
use crate::pipeline::{format_metas, AceStepPipeline, GeneratedAudio, GenerationParams};
12+
use crate::pipeline::{AceStepPipeline, GeneratedAudio, GenerationParams, format_metas};
1313

1414
/// A request for a single song.
1515
#[derive(Debug, Clone)]

src/vae.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//!
77
//! Uses weight-norm loading via `candle_transformers::models::encodec`.
88
9-
use candle_core::{IndexOp, Module, Result, Tensor, D};
9+
use candle_core::{D, IndexOp, Module, Result, Tensor};
1010
use candle_nn::{Conv1d, Conv1dConfig, ConvTranspose1d, ConvTranspose1dConfig, VarBuilder};
1111
use candle_transformers::models::encodec;
1212

0 commit comments

Comments
 (0)