docs: add mojo-audio v0.2.0 Linux build handoff guide #101
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: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CMAKE_CXX_STANDARD: 17 # whisper.cpp git version requires C++14+ | |
| jobs: | |
| check-linux: | |
| name: Check (Linux) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libclang-dev libasound2-dev pkg-config libxkbcommon-dev | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-feat-default-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Run cargo check | |
| run: cargo check | |
| check-macos: | |
| name: Check (${{ matrix.os }}) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - macos-15 | |
| - macos-14 | |
| - macos-15-large # Intel | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-feat-default-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Run cargo check | |
| run: cargo check | |
| test-linux: | |
| name: Test (Linux) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libclang-dev libasound2-dev pkg-config libxkbcommon-dev | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-feat-default-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Run tests | |
| run: cargo test --lib | |
| test-macos: | |
| name: Test (${{ matrix.os }}) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - macos-15 | |
| - macos-14 | |
| - macos-15-large # Intel | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-feat-default-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Run tests | |
| run: cargo test --lib | |
| build-cuda: | |
| name: Build CUDA (Linux) | |
| runs-on: ubuntu-latest | |
| continue-on-error: true # CUDA build is optional - shouldn't block CI | |
| container: nvidia/cuda:12.6.2-devel-ubuntu24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install build essentials | |
| run: | | |
| apt-get update | |
| apt-get install -y curl build-essential cmake libclang-dev libasound2-dev pkg-config libxkbcommon-dev file libssl-dev | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-cargo-build-target-feat-cuda-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build with CUDA | |
| env: | |
| CUDA_COMPUTE_CAP: "75" # Target RTX 20xx/30xx/40xx (sm_75 is compatible) | |
| run: cargo build --release --features cuda | |
| - name: List release outputs | |
| run: ls -la target/release | |
| - name: Verify CUDA artifact | |
| run: | | |
| test -f target/release/mojovoice || (echo "ERROR: target/release/mojovoice not found" && exit 1) | |
| file target/release/mojovoice | |
| # Note: Candle uses dynamic loading (dlopen) for CUDA, so libcudart won't appear in ldd | |
| # We verify the build succeeded and the binary is valid | |
| ./target/release/mojovoice --version || echo "Binary built (--version not implemented)" | |
| echo "✓ CUDA build completed successfully" | |
| - name: Hash CUDA artifact | |
| run: sha256sum target/release/mojovoice | |
| - name: Upload CUDA artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mojovoice-linux-x64-cuda | |
| path: target/release/mojovoice | |
| retention-days: 90 | |
| build-metal: | |
| name: Build Metal (${{ matrix.os }}) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos-15, macos-14] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-feat-metal-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build with Metal | |
| run: cargo build --release --features metal | |
| - name: Upload Metal artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mojovoice-${{ matrix.os }}-arm64-metal | |
| path: target/release/mojovoice | |
| retention-days: 90 | |
| build-artifacts-linux: | |
| name: Build Release (Linux x64) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libclang-dev libasound2-dev pkg-config libxkbcommon-dev | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-feat-release-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build release binary | |
| run: cargo build --release | |
| - name: Verify artifact | |
| run: | | |
| file target/release/mojovoice | |
| # CPU artifact should NOT depend on CUDA libraries | |
| echo "Checking ldd for CUDA libs (should be none):" | |
| if ldd target/release/mojovoice | grep -E 'libcudart|libcublas|libcudnn'; then | |
| echo "❌ ERROR: CPU artifact has CUDA dependencies!" | |
| exit 1 | |
| fi | |
| echo "Checking readelf for CUDA NEEDED entries (should be none):" | |
| if readelf -d target/release/mojovoice | grep NEEDED | grep -E 'cudart|cublas|cudnn'; then | |
| echo "❌ ERROR: CPU artifact has CUDA in NEEDED section!" | |
| exit 1 | |
| fi | |
| echo "✓ CPU artifact verified (no CUDA dependencies)" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mojovoice-linux-x64 | |
| path: target/release/mojovoice | |
| retention-days: 90 | |
| build-artifacts-macos: | |
| name: Build Release (${{ matrix.name }}) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-15 | |
| name: macOS ARM64 | |
| artifact: mojovoice-macos-arm64 | |
| - os: macos-15-large | |
| name: macOS Intel | |
| artifact: mojovoice-macos-intel | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-feat-release-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build release binary | |
| run: cargo build --release | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: target/release/mojovoice | |
| retention-days: 90 | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - name: Install Linux dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libclang-dev libasound2-dev pkg-config libxkbcommon-dev | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-cargo-build-target-feat-default-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Run clippy | |
| run: cargo clippy -- -D warnings | |
| fmt: | |
| name: Rustfmt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - name: Run rustfmt | |
| run: cargo fmt --all -- --check | |
| coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libclang-dev libasound2-dev pkg-config libxkbcommon-dev | |
| - name: Install tarpaulin | |
| run: cargo install cargo-tarpaulin | |
| - name: Generate coverage | |
| run: cargo tarpaulin --out Lcov --output-dir coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage/lcov.info | |
| fail_ci_if_error: false |