diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index c8000d0b4..0e14c1753 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -34,6 +34,11 @@ jobs: target: x86_64-pc-windows-msvc artifact_name: windows-x64-cpu use_cuda: false + - os: windows-latest + feature: directml + target: x86_64-pc-windows-msvc + artifact_name: windows-x64-directml + use_cuda: false - os: windows-latest feature: default target: x86_64-pc-windows-msvc diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4abaf7689..81acfe3ed 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,8 +14,8 @@ jobs: with: toolchain: stable - uses: Swatinem/rust-cache@v1 - - run: cargo clippy --all-features --tests -- -D clippy::all -D warnings --no-deps - - run: cargo clippy --all-features -- -D clippy::all -D warnings --no-deps + - run: cargo clippy --all-features --features onnxruntime/disable-sys-build-script --tests -- -D clippy::all -D warnings --no-deps + - run: cargo clippy --all-features --features onnxruntime/disable-sys-build-script -- -D clippy::all -D warnings --no-deps - run: cargo fmt -- --check rust-test: @@ -24,11 +24,21 @@ jobs: matrix: include: - os: windows-2019 + features: default - os: windows-2022 + features: default + - os: windows-2019 + features: directml + - os: windows-2022 + features: directml - os: macos-11 + features: default - os: macos-12 + features: default - os: ubuntu-18.04 + features: default - os: ubuntu-20.04 + features: default runs-on: ${{ matrix.os }} steps: - name: Install LLVM and Clang # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797 @@ -47,7 +57,7 @@ jobs: - uses: Swatinem/rust-cache@v1 with: # cargoのキャッシュが原因でテストが失敗する場合はバージョン部分をカウントアップすること - key: "v1-cargo-test-cache-${{ matrix.os }}" + key: "v1-cargo-test-cache-${{ matrix.features }}-${{ matrix.os }}" # FIXME: windows-2022 では、onnxruntime-sys のビルド時にダウンロードされる onnxruntime.dll に対してパスが通らないために、テストが行えない # 原因が不明であるため、姑息的な回避策として target/debug/deps ディレクトリに onnxruntime.dll をコピーする。根本的な解決策を望む。 # cf. https://github.com/VOICEVOX/voicevox_core/pull/140#issuecomment-1140276585 @@ -58,7 +68,7 @@ jobs: cargo build find target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib -name onnxruntime.dll -ctime 0 find target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib -name onnxruntime.dll -ctime 0 | head -n 1 | xargs -i cp {} target/debug/deps/ - - run: cargo test --all-features + - run: cargo test --features ${{ matrix.features }} build-unix-cpp-example: strategy: diff --git a/Cargo.lock b/Cargo.lock index 579892c4c..a3fab7226 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1306,14 +1306,14 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.10.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" [[package]] name = "onnxruntime" -version = "0.0.27" -source = "git+https://github.com/VOICEVOX/onnxruntime-rs.git#750e61bec0d51a96e19f956102494bda37d1a778" +version = "0.0.28" +source = "git+https://github.com/VOICEVOX/onnxruntime-rs.git#7d112cbb6515a42bd76efe4c40dbb44de460733f" dependencies = [ "lazy_static", "ndarray", @@ -1324,10 +1324,11 @@ dependencies = [ [[package]] name = "onnxruntime-sys" -version = "0.0.22" -source = "git+https://github.com/VOICEVOX/onnxruntime-rs.git#750e61bec0d51a96e19f956102494bda37d1a778" +version = "0.0.23" +source = "git+https://github.com/VOICEVOX/onnxruntime-rs.git#7d112cbb6515a42bd76efe4c40dbb44de460733f" dependencies = [ "flate2", + "once_cell", "tar", "ureq", "zip", diff --git a/crates/voicevox_core/Cargo.toml b/crates/voicevox_core/Cargo.toml index b101199eb..f4a8b3712 100644 --- a/crates/voicevox_core/Cargo.toml +++ b/crates/voicevox_core/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [features] default = [] -directml = [] +directml = ["onnxruntime/directml"] [lib] name = "core" @@ -18,7 +18,7 @@ derive-getters = "0.2.0" derive-new = "0.5.9" libc = "0.2.126" once_cell = "1.10.0" -onnxruntime = { git = "https://github.com/VOICEVOX/onnxruntime-rs.git", version = "0.0.27" } +onnxruntime = { git = "https://github.com/VOICEVOX/onnxruntime-rs.git", version = "0.0.28" } serde = "1.0.137" serde_json = "1.0.81" thiserror = "1.0.31"