fix: cherry pick v2.0.0-rc.5's 2db63f4
#38
Workflow file for this run
This file contains 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: Run cargo tests | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- '.github/workflows/test.yml' | |
- 'src/**/*.rs' | |
- 'examples/**/*' | |
- 'ort-sys/**/*.rs' | |
- 'ort-sys/**/dist.txt' | |
- 'build.rs' | |
- 'Cargo.toml' | |
- '.cargo/**/*' | |
- 'tests/**/*' | |
pull_request: | |
paths: | |
- '.github/workflows/test.yml' | |
- 'src/**/*.rs' | |
- 'examples/**/*' | |
- 'ort-sys/**/*.rs' | |
- 'ort-sys/**/dist.txt' | |
- 'build.rs' | |
- 'Cargo.toml' | |
- '.cargo/**/*' | |
- 'tests/**/*' | |
env: | |
RUST_BACKTRACE: 1 | |
CARGO_INCREMENTAL: 0 | |
CARGO_PROFILE_DEV_DEBUG: 0 | |
jobs: | |
test: | |
name: Run tests | |
runs-on: ${{ matrix.platform.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- os: ubuntu-latest | |
- os: windows-latest | |
- os: macos-12 | |
- os: macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install stable Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- uses: Swatinem/rust-cache@v1 | |
- name: Run tests | |
shell: bash | |
run: | | |
# ONNX Runtimeの静的リンクをやめているため、Windowsではdoctestを無効化する | |
[ "$RUNNER_OS" = Windows ] && targets=--tests || targets= | |
cargo test -p voicevox-ort --verbose --features fetch-models "$targets" -- --test-threads 1 | |
# Test examples that use in-tree graphs (do NOT run any of the examples that download ~700 MB graphs from pyke parcel...) | |
cargo run --example custom-ops | |
test-wasm: | |
name: Test WebAssembly | |
runs-on: ubuntu-latest | |
if: false # WASM版はまだ提供しないため、テストもしない | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install nightly Rust toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
- name: Install wasm-pack | |
run: cargo install wasm-pack | |
- name: Run tests | |
working-directory: examples/webassembly | |
run: | | |
wasm-pack test --node | |
# Disable cross-compile until cross updates aarch64-unknown-linux-gnu to Ubuntu 22.04 | |
# ref https://github.com/cross-rs/cross/pull/973 | |
#cross-compile: | |
# name: Cross-platform compile | |
# runs-on: ${{ matrix.platform.os }} | |
# needs: [test] | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# platform: | |
# - target: aarch64-unknown-linux-gnu | |
# os: ubuntu-latest | |
# command: test | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Fix ring dependency for Windows ARM64 | |
# if: matrix.platform.target == 'aarch64-pc-windows-msvc' | |
# shell: pwsh | |
# run: | | |
# @('', '[patch.crates-io]', | |
# 'ring = { git = "https://github.com/awakecoding/ring", branch = "0.16.20_alpha" }') | % { | |
# Add-Content -Path "Cargo.toml" -Value $_ | |
# } | |
# $VSINSTALLDIR = $(vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Llvm.Clang -property installationPath) | |
# $VCINSTALLDIR = Join-Path $VSINSTALLDIR "VC" | |
# $LLVM_ROOT = Join-Path $VCINSTALLDIR "Tools\Llvm\x64" | |
# echo "PATH=$Env:PATH;${LLVM_ROOT}\bin" >> $Env:GITHUB_ENV | |
# - name: Build/test | |
# run: | | |
# cargo install cross --git https://github.com/cross-rs/cross | |
# cross test -p ort --features fetch-models --target aarch64-unknown-linux-gnu -v |