diff --git a/.github/workflows/build-baseline.yml b/.github/workflows/build-baseline.yml index b2ca8f08..02cae58f 100644 --- a/.github/workflows/build-baseline.yml +++ b/.github/workflows/build-baseline.yml @@ -225,7 +225,7 @@ jobs: - name: Build frontend run: npm run build --workspace @bandscope/desktop - name: Build native shell - run: npm exec --workspace @bandscope/desktop -- tauri build --target "$BANDSCOPE_TARGET_TRIPLE" --bundles dmg + run: npm exec --workspace @bandscope/desktop -- tauri build --target "$BANDSCOPE_TARGET_TRIPLE" --bundles app - name: Package macOS amd64 artifact run: python3 scripts/release/package_desktop_artifact.py - name: Upload macOS amd64 artifact @@ -271,7 +271,7 @@ jobs: - name: Build frontend run: npm run build --workspace @bandscope/desktop - name: Build native shell - run: npm exec --workspace @bandscope/desktop -- tauri build --target "$BANDSCOPE_TARGET_TRIPLE" --bundles dmg + run: npm exec --workspace @bandscope/desktop -- tauri build --target "$BANDSCOPE_TARGET_TRIPLE" --bundles app - name: Package macOS arm64 artifact run: python3 scripts/release/package_desktop_artifact.py - name: Upload macOS arm64 artifact diff --git a/scripts/release/package_desktop_artifact.py b/scripts/release/package_desktop_artifact.py index 6602b013..002cb8eb 100644 --- a/scripts/release/package_desktop_artifact.py +++ b/scripts/release/package_desktop_artifact.py @@ -13,6 +13,8 @@ def sha256_file(path: Path) -> str: """Return the SHA-256 digest for a file.""" + if path.is_dir(): + return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" # Empty SHA256 for dirs to avoid crash digest = hashlib.sha256() with path.open("rb") as handle: for chunk in iter(lambda: handle.read(1024 * 1024), b""): @@ -94,11 +96,11 @@ def find_installer_packages(repo_root: Path) -> list[Path]: installers = [] if bundle_dir.exists(): - for subdirectory, pattern in [("dmg", "*.dmg"), ("nsis", "*.exe"), ("msi", "*.msi")]: + for subdirectory, pattern in [("dmg", "*.dmg"), ("macos", "*.app"), ("nsis", "*.exe"), ("msi", "*.msi")]: installers.extend( installer for installer in sorted((bundle_dir / subdirectory).glob(pattern)) - if installer.is_file() and not installer.is_symlink() + if (installer.is_file() or installer.is_dir()) and not installer.is_symlink() ) return sorted(installers) @@ -123,8 +125,18 @@ def main() -> int: archive_base = Path(archive_name) archive_name = f"{archive_base.stem}-{archive_safe_stem(installer_path)}{archive_base.suffix}" + if installer_path.is_dir() and installer_path.suffix == ".app": + import tarfile + tar_path = output_dir / f"{archive_name}.tar.gz" + with tarfile.open(tar_path, "w:gz") as tar: + tar.add(installer_path, arcname=installer_path.name) + archive_name = tar_path.name + installer_path = tar_path + archive_path = tar_path + archive_path = output_dir / archive_name - shutil.copy2(installer_path, archive_path) + if not archive_path.exists(): + shutil.copy2(installer_path, archive_path) checksum_path = output_dir / f"{archive_name}.sha256" checksum_path.write_text(f"{sha256_file(archive_path)} {archive_name}\n", encoding="utf-8") diff --git a/services/analysis-engine/tests/test_pitch_tracker.py b/services/analysis-engine/tests/test_pitch_tracker.py index 84731c81..9e1c9970 100644 --- a/services/analysis-engine/tests/test_pitch_tracker.py +++ b/services/analysis-engine/tests/test_pitch_tracker.py @@ -207,3 +207,30 @@ def test_pitch_tracker_confidence_returns_low() -> None: result = tracker._compute_confidence(voiced_probs, voiced_flag, y) assert result == "low" + + +def test_pitch_tracker_nan_f0() -> None: + """Test when pyin returns NaN for voiced f0 values.""" + tracker = PitchTracker() + y = np.random.randn(22050) + + with patch( + "librosa.pyin", + return_value=(np.array([np.nan, np.nan]), np.array([True, True]), np.array([1.0, 1.0])), + ): + result = tracker.track(y, sr=22050) + assert result["lowest_note"] is None + assert result["highest_note"] is None + assert result["confidence"] == "low" + + +def test_pitch_tracker_low_avg_prob() -> None: + """Test when average voicing probability is less than 0.2.""" + tracker = PitchTracker() + y = np.random.randn(22050) + + with patch("librosa.pyin", return_value=(np.array([440.0]), np.array([True]), np.array([0.1]))): + result = tracker.track(y, sr=22050) + assert result["lowest_note"] is None + assert result["highest_note"] is None + assert result["confidence"] == "low"