Skip to content

Test

Test #1

Workflow file for this run

name: Test
on:
workflow_dispatch:
inputs:
build_debug:
required: false
default: "0"
cmake_verbose:
required: false
default: ""
cargo_args:
required: false
default: ""
permissions:
contents: read
jobs:
build:
runs-on: ${{ matrix.platform }}
env:
BUILD_DEBUG: ${{ github.event.inputs.build_debug }}
CMAKE_VERBOSE: ${{ github.event.inputs.cmake_verbose }}
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest" # ARM
options: ""
- platform: "macos-latest" # Intel
options: "--target x86_64-apple-darwin"
- platform: "ubuntu-22.04" # Linux
options: ""
- platform: "windows-latest" # Windows
options: ""
- platform: "windows-latest" # Windows Cuda
options: '--features "cuda"'
cuda-version: "12.5.0"
- platform: "windows-latest" # Windows DirectML
options: '--features "directml"'
- platform: "ubuntu-22.04" # Linux Cuda
options: '--features "cuda"'
cuda-version: "12.4.1"
steps:
- uses: actions/checkout@v3
with:
submodules: "true"
- name: Setup cuda for Windows
run: scripts/setup_cuda.ps1
env:
INPUT_CUDA_VERSION: ${{ matrix.cuda-version }}
if: matrix.platform == 'windows-latest' && contains(matrix.options, 'cuda')
- name: Setup cuda for Ubuntu
uses: Jimver/cuda-toolkit@master
with:
cuda: "${{ matrix.cuda-version }}"
method: "network"
if: contains(matrix.platform, 'ubuntu') && contains(matrix.options, 'cuda')
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Add MSYS2 to PATH
if: contains(matrix.platform, 'windows')
run: echo "C:\msys64\usr\bin" >> $env:GITHUB_PATH
shell: powershell
- name: Build
run: |
cargo build ${{ matrix.options }} ${{ github.event.inputs.cargo_args }}
- name: Test Whisper
run: |
wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-whisper-tiny.tar.bz2
wget https://github.com/thewh1teagle/sherpa-rs/releases/download/v0.1.0/motivation.wav -O motivation.wav
tar xvf sherpa-onnx-whisper-tiny.tar.bz2
cargo test whisper ${{ matrix.options }} ${{ github.event.inputs.cargo_args }} -- --nocapture