Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ codecov:
require_ci_to_pass: false

ignore:
- **benches/*
- **examples/*
- **tests/*
- "**benches/*"
- "**examples/*"
- "**tests/*"

coverage:
status:
Expand Down
197 changes: 173 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ jobs:
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Apply clippy lints
# Exclude `tch` (needs libtorch — env-dependent setup) and
# `silero-vad` (path dep on `../silero/` not present in clean
# checkouts) from the cargo-hack feature sweep. Their CI
# coverage lives in dedicated jobs that provision the deps.
run: cargo hack clippy --each-feature --exclude-no-default-features --exclude-features tch,silero-vad
# Exclude `tch` (libtorch env-dep) from the each-feature sweep —
# it has its own dedicated CI job. `silero-vad` IS swept now
# that `silero` is a registry dep. The per-EP features
# (`coreml`/`cuda`/`tensorrt`/...) and the `gpu` meta-feature
# are also excluded: `each-feature` would build them
# individually but `ort-sys 2.0.0-rc.12`'s prebuilt
# `download-binaries` archives are CPU-only, so a vendor EP
# link step (e.g. webgpu) would fail to satisfy the link
# against a vendor lib that the runner does not provide.
# Per-EP coverage lives in the docs.rs metadata + a focused
# `ep-link-check` job below; the each-feature sweep stays
# bounded to the link-safe core features.
run: cargo hack clippy --each-feature --exclude-no-default-features --exclude-features tch,coreml,cuda,tensorrt,directml,rocm,migraphx,openvino,webgpu,xnnpack,onednn,cann,acl,qnn,nnapi,tvm,azure,gpu

# Run tests on some extra platforms
# Portability check: scalar-only build across the broad cross matrix.
Expand All @@ -72,19 +80,26 @@ jobs:
name: cross (scalar, --no-default-features)
strategy:
matrix:
# `wasm32-unknown-unknown` is intentionally excluded here:
# the transitive `getrandom 0.2` dep emits a `compile_error!`
# on that target unless the `js` feature is enabled, and
# browser-wasm is not a dia target. `wasm32-unknown-emscripten`
# is also excluded — emscripten is superseded by WASI for
# server-side wasm, and diarization-in-browser via emscripten
# is impractical (model size + ORT-WebAssembly is its own path).
# `i686-linux-android` is excluded because Google Play has
# required 64-bit since 2019; the `aarch64-linux-android` /
# `x86_64-linux-android` entries cover the live Android matrix.
target:
- aarch64-unknown-linux-gnu
- aarch64-linux-android
- aarch64-unknown-linux-musl
- i686-linux-android
- x86_64-linux-android
- i686-pc-windows-gnu
- x86_64-pc-windows-gnu
- i686-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
- wasm32-unknown-unknown
- wasm32-unknown-emscripten
- wasm32-wasip1
- wasm32-wasip1-threads
- wasm32-wasip2
Expand All @@ -103,6 +118,16 @@ jobs:
${{ runner.os }}-cross-
- name: Install Rust
run: rustup update stable && rustup default stable
- name: Install mingw-w64 (windows-gnu targets)
# Transitive `windows-sys` builds via mingw's `dlltool` when
# cross-compiling to `*-pc-windows-gnu`. The Ubuntu runner does
# not ship it by default, so install on demand for those
# targets only. `gcc-mingw-w64` provides both i686 and x86_64
# toolchains in one package.
if: contains(matrix.target, 'pc-windows-gnu')
run: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64
- name: cargo build --target ${{ matrix.target }} --no-default-features
run: |
rustup target add ${{ matrix.target }}
Expand All @@ -116,10 +141,16 @@ jobs:
name: cross (ort + bundled-segmentation)
strategy:
matrix:
# Targets where `ort-sys 2.0.0-rc.12` ships a prebuilt
# archive via `download-binaries`. Windows MSVC is covered
# by `cross-ort-windows-msvc` below — `x86_64-pc-windows-gnu`
# is intentionally excluded here because the upstream
# distribution table has only the MSVC archive, and a Linux
# runner cross-building to `windows-gnu` would surface a
# build-script error rather than validating ort.
target:
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-gnu
- x86_64-pc-windows-gnu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
Expand All @@ -140,6 +171,121 @@ jobs:
rustup target add ${{ matrix.target }}
cargo build --target ${{ matrix.target }}

# Windows-MSVC ort coverage — runs on `windows-latest` because
# `ort-sys 2.0.0-rc.12` ships a Windows MSVC archive (the GNU
# variant is not provided by the upstream distribution table).
cross-ort-windows-msvc:
name: cross (ort + bundled-segmentation) [windows-msvc]
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Cache cargo build and registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cross-ort-msvc-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cross-ort-msvc-
- name: Install Rust
run: rustup update stable --no-self-update && rustup default stable
- name: cargo build --target x86_64-pc-windows-msvc
run: |
rustup target add x86_64-pc-windows-msvc
cargo build --target x86_64-pc-windows-msvc

# Per-EP **bindings** check (NOT link coverage). The cargo-hack
# feature sweeps above exclude every per-EP feature (and the
# `gpu` meta-feature) because `ort-sys 2.0.0-rc.12`'s
# `download-binaries` archive is CPU-only and cannot satisfy a
# vendor link step on the runner. `cargo check` does NOT link —
# it stops after type/borrow checking — so this job catches
# bindings-level regressions (renamed type, broken
# `#[doc(cfg(...))]`, missing re-export) without needing vendor
# libs. Real link validation requires a vendor-provisioned host
# (CUDA toolkit, ROCm runtime, DirectML.dll, etc.) and is out of
# scope for the open CI matrix; downstream callers building a
# multi-EP binary on such a host get the link contract there.
ep-bindings-check:
name: per-EP bindings check (no link)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ep:
- coreml
- cuda
- tensorrt
- directml
- rocm
- migraphx
- openvino
- webgpu
- xnnpack
- onednn
- cann
- acl
- qnn
- nnapi
- tvm
- azure
- gpu
steps:
- uses: actions/checkout@v6
- name: Cache cargo build and registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-ep-${{ matrix.ep }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-ep-${{ matrix.ep }}-
- name: Install Rust
run: rustup update stable --no-self-update && rustup default stable
- name: cargo check --features ${{ matrix.ep }}
run: cargo check --no-default-features --features ort,${{ matrix.ep }}

# docs.rs equivalence gate. `package.metadata.docs.rs.features`
# enables ALL 16 per-EP features simultaneously plus the
# streaming-example surface; the cargo-hack sweeps above exclude
# every per-EP feature, and the per-EP `cargo check` matrix only
# tests one EP at a time. Without this job, a feature interaction
# (conflicting re-exports, `#[doc(cfg(...))]` mismatch, item-name
# collision) could pass every other CI gate yet break the docs.rs
# build. `cargo doc` exercises the same feature combination
# docs.rs uses, with `-D rustdoc::broken_intra_doc_links` to
# catch link rot.
docs-rs-check:
name: docs.rs feature-set doc build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Cache cargo build and registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-docsrs-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-docsrs-
- name: Install Rust (nightly for docsrs cfg)
# docs.rs builds with nightly + `--cfg docsrs`; mirror that
# so a `#[cfg_attr(docsrs, doc(cfg(...)))]` regression caught
# only on docs.rs surfaces here too.
run: rustup toolchain install nightly --no-self-update && rustup default nightly
- name: cargo +nightly doc (docs.rs feature set)
env:
RUSTDOCFLAGS: "-D rustdoc::broken_intra_doc_links --cfg docsrs"
run: |
cargo doc --no-deps --features \
ort,bundled-segmentation,serde,silero-vad,coreml,cuda,tensorrt,directml,rocm,migraphx,openvino,webgpu,xnnpack,onednn,cann,acl,qnn,nnapi,tvm,azure

# Compile check for the `tch` (TorchScript) backend. `tch` is not in
# the cargo-hack feature sweeps below because it requires libtorch
# set up on the runner. Without this dedicated job, a regression that
Expand Down Expand Up @@ -202,9 +348,14 @@ jobs:
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Run build
# Exclude `tch` (libtorch env-dep) and `silero-vad` (path dep
# not in clean checkouts). Codex adversarial review HIGH.
run: cargo hack build --feature-powerset --exclude-no-default-features --exclude-features tch,silero-vad
# Powerset sweep: exclude `tch` (libtorch env-dep, dedicated
# job) and every per-EP / `gpu` feature. The CPU-only
# `ort-sys` `download-binaries` archive cannot satisfy a
# vendor-EP link step on the runner, and `--feature-powerset`
# over the 16 EPs would also explode combinatorially. Per-EP
# link coverage lives in the dedicated `ep-link-check` job
# below.
run: cargo hack build --feature-powerset --exclude-no-default-features --exclude-features tch,coreml,cuda,tensorrt,directml,rocm,migraphx,openvino,webgpu,xnnpack,onednn,cann,acl,qnn,nnapi,tvm,azure,gpu

test:
name: test
Expand Down Expand Up @@ -233,9 +384,11 @@ jobs:
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Run test
# Exclude `tch` (libtorch env-dep) and `silero-vad` (path dep
# not in clean checkouts). Codex adversarial review HIGH.
run: cargo hack test --feature-powerset --exclude-no-default-features --exclude-features tch,silero-vad
# Same exclusion list as the build sweep: `tch` (libtorch
# env-dep, dedicated job) and all per-EP / `gpu` features
# (CPU-only `ort-sys` archive cannot satisfy vendor link
# steps; per-EP coverage is in `ep-link-check`).
run: cargo hack test --feature-powerset --exclude-no-default-features --exclude-features tch,coreml,cuda,tensorrt,directml,rocm,migraphx,openvino,webgpu,xnnpack,onednn,cann,acl,qnn,nnapi,tvm,azure,gpu

# AVX2 + FMA correctness via Intel SDE. GH free runners may have AVX2
# natively, but our dispatcher prefers AVX-512F on hosts that have it
Expand Down Expand Up @@ -451,16 +604,12 @@ jobs:
- name: Run tarpaulin
env:
RUSTFLAGS: "--cfg tarpaulin"
# Explicit feature list instead of `--all-features`. The `tch`
# Explicit feature list instead of `--all-features`: the `tch`
# backend needs libtorch on the runner (handled only by the
# dedicated `tch-compile-check` job) and `silero-vad` is a
# workspace path dep on `../silero/` not present in clean
# checkouts. Coverage matches the same exclusion pattern the
# build/test/clippy jobs use via `cargo hack
# --exclude-features tch,silero-vad`. Without this, the
# coverage job would fail to compile after the rest of CI
# passes — forcing maintainers to bypass the gate to merge.
run: cargo tarpaulin --features ort,bundled-segmentation,serde,_bench --run-types tests --run-types doctests --workspace --out xml
# dedicated `tch-compile-check` job). `silero-vad` is enabled
# below because the streaming example is documented as a
# supported quickstart and we want coverage to exercise it.
run: cargo tarpaulin --features ort,bundled-segmentation,serde,silero-vad,_bench --run-types tests --run-types doctests --workspace --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v6
with:
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ Cargo.lock
!/models/segmentation-3.0.onnx
# WeSpeaker ResNet34-LM is too large for crates.io (27 MB), but is
# committed to git so it can be served as a GitHub release asset.
# It is excluded from the crate tarball via `[package] exclude` in
# Cargo.toml so `cargo publish` doesn't accidentally ship it.
# The `.onnx.data` sidecar is no longer used — we ship the
# single-file packed form (works on ORT's CoreML EP loader, which
# fails to relocate external initializers).
!/models/wespeaker_resnet34_lm.onnx
!/models/wespeaker_resnet34_lm.onnx.data
**.claude/
docs/

Expand Down
Loading
Loading