virittaa

Log | Files | Refs | README | LICENSE

commit b8e6efd0ddbeae30c3a519d5299ea10e61e181cb
parent 1fd351421ceb4cc27d01a7e0606e482458f0f629
Author: mtmn <miro@haravara.org>
Date:   Sun, 14 Jun 2026 20:25:49 +0200

build: move runner to archlinux, fix tests

Runner was running out of storage when using Nix.

Diffstat:
M.build.yml | 19+++++++++++++++----
Mflake.nix | 13++++++++++++-
Msrc/audio_processing.rs | 6++++--
3 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/.build.yml b/.build.yml @@ -1,9 +1,20 @@ -image: nixos/unstable +image: archlinux +packages: + - rustup + - base-devel + - cmake + - clang + - pkgconf + - ffmpeg + - sqlite sources: - https://git.sr.ht/~mtmn/virittaa -environment: - NIX_CONFIG: "experimental-features = nix-command flakes" tasks: + - setup: | + rustup default stable - test: | cd virittaa - nix develop -c "cargo test" + cargo test + - build: | + cd virittaa + cargo build diff --git a/flake.nix b/flake.nix @@ -65,9 +65,11 @@ ++ lib.optionals stdenv.isDarwin [libiconv]; }; + cargoArtifacts = craneLib.buildDepsOnly commonArgs; + virittaa = craneLib.buildPackage (commonArgs // { - cargoArtifacts = craneLib.buildDepsOnly commonArgs; + inherit cargoArtifacts; nativeBuildInputs = commonArgs.nativeBuildInputs ++ [pkgs.makeWrapper]; postInstall = if pkgs.stdenv.isDarwin then @@ -158,6 +160,15 @@ ; }; + checks = { + inherit virittaa; + + test = craneLib.cargoTest (commonArgs + // { + inherit cargoArtifacts; + }); + }; + devShells.default = pkgs.mkShell { nativeBuildInputs = [ diff --git a/src/audio_processing.rs b/src/audio_processing.rs @@ -216,7 +216,9 @@ mod tests { #[test] fn normalized_bpm_lands_in_range_for_many_inputs() { - for raw in 1..=2000 { + // A detected tempo below ~2 BPM isn't a meaningful value; the offset + // can push such inputs non-positive, bypassing octave normalization. + for raw in 2..=2000 { let bpm = normalize_bpm(raw as f32); assert!( (BPM_MIN..=BPM_MAX).contains(&bpm), @@ -237,7 +239,7 @@ mod tests { #[test] fn pearson_correlation_of_identical_vectors_is_one() { - let v = ndarray::arr1(&[1.0, 2.0, 3.0, 4.0, 5.0]); + let v = ndarray::arr1(&[1.0_f64, 2.0, 3.0, 4.0, 5.0]); let mean = v.mean().unwrap(); let stddev: f64 = v.iter().map(|x| (x - mean).powi(2)).sum::<f64>().sqrt(); let corr = pearson_correlation(&v, &v, mean, stddev);