test: strengthen fixture-backed stream coverage #32
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: macOS | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| changes: | |
| name: Changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| run_macos: ${{ steps.filter.outputs.run_macos }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Detect relevant changes | |
| id: filter | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| run_macos: | |
| - ".github/workflows/**" | |
| - "Cargo.toml" | |
| - "Cargo.lock" | |
| - "xtask/**" | |
| - "whisper-cpp-plus/**" | |
| - "whisper-cpp-plus-sys/**" | |
| test: | |
| name: Test | |
| needs: changes | |
| if: > | |
| github.event_name == 'push' || | |
| ( | |
| needs.changes.outputs.run_macos == 'true' && | |
| !(github.event_name == 'pull_request' && github.base_ref == 'main' && github.head_ref == 'develop') | |
| ) | |
| runs-on: macos-latest | |
| env: | |
| CARGO_TERM_COLOR: always | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Check Clippy | |
| run: cargo clippy --workspace --all-targets -- -D warnings | |
| - name: Check async Clippy | |
| run: cargo clippy -p whisper-cpp-plus --all-targets --features async -- -D warnings | |
| - name: Check Metal Clippy | |
| run: cargo clippy -p whisper-cpp-plus --all-targets --features metal -- -D warnings | |
| env: | |
| MACOSX_DEPLOYMENT_TARGET: "14.0" | |
| - name: Cache test models | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| whisper-cpp-plus-sys/whisper.cpp/models/ggml-tiny.en.bin | |
| whisper-cpp-plus-sys/whisper.cpp/models/ggml-silero-v6.2.0.bin | |
| key: ${{ runner.os }}-whisper-test-models-tiny-en-silero-v6-2-0 | |
| - name: Install Hugging Face Hub | |
| run: | | |
| python3 -m venv .hf-venv | |
| .hf-venv/bin/python -m pip install -U pip | |
| .hf-venv/bin/python -m pip install -U huggingface_hub | |
| - name: Pre-download test models | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| .hf-venv/bin/python - <<'PY' | |
| import os | |
| from pathlib import Path | |
| from huggingface_hub import hf_hub_download | |
| models_dir = Path("whisper-cpp-plus-sys/whisper.cpp/models") | |
| models_dir.mkdir(parents=True, exist_ok=True) | |
| token = os.environ.get("HF_TOKEN") or None | |
| models = [ | |
| ("ggerganov/whisper.cpp", "ggml-tiny.en.bin"), | |
| ("ggml-org/whisper-vad", "ggml-silero-v6.2.0.bin"), | |
| ] | |
| for repo_id, filename in models: | |
| target = models_dir / filename | |
| if target.exists(): | |
| print(f"[skip] {filename} already exists") | |
| continue | |
| print(f"[download] {repo_id}/{filename}") | |
| hf_hub_download( | |
| repo_id=repo_id, | |
| filename=filename, | |
| local_dir=str(models_dir), | |
| token=token, | |
| ) | |
| PY | |
| - name: Download test models | |
| run: cargo xtask test-setup | |
| - name: Test workspace | |
| run: cargo test --workspace -- --test-threads=1 | |
| - name: Test Metal feature | |
| run: cargo test -p whisper-cpp-plus --features metal -- --test-threads=1 | |
| env: | |
| MACOSX_DEPLOYMENT_TARGET: "14.0" |