Skip to content

fix(deps): update major dependencies #3160

fix(deps): update major dependencies

fix(deps): update major dependencies #3160

Workflow file for this run

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@v4
- 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@v4
# 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.8
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install Pyflakes
run: pip install 'pyflakes>3,<4'
- name: actionlint
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color
validate-cargo-lock:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- 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@v4
- name: Set up Rust
uses: ./.github/actions/rust-toolchain-from-file
with:
components: clippy,rustfmt
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: "3.8"
- uses: Swatinem/rust-cache@v2
- run: cargo clippy -v --tests -- -D clippy::all -D warnings --no-deps
- run: cargo clippy -v -- -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
- run: cargo fmt -- --check
rust-unit-test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: ./.github/actions/rust-toolchain-from-file
- 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: |
includes='[
{ "os": "windows-2019", "can_skip_in_simple_test": true },
{ "os": "windows-2022", "can_skip_in_simple_test": true },
{ "os": "macos-12", "can_skip_in_simple_test": false },
{ "os": "macos-13", "can_skip_in_simple_test": true },
{ "os": "ubuntu-20.04", "can_skip_in_simple_test": false },
{ "os": "ubuntu-22.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@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: "3.8"
- 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@v4
- 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
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@v4
- 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/
sed 's:^//\(#define VOICEVOX_LOAD_ONNXRUNTIME\)$:\1:' \
crates/voicevox_core_c_api/include/voicevox_core.h \
> example/cpp/unix/voicevox_core/voicevox_core.h
cp -v target/debug/libvoicevox_core.{so,dylib} example/cpp/unix/voicevox_core/ || true
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
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@v4
- 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@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: "3.8"
- 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: 必要なDLLをコピーしてpytestを実行
run: |
cp -v ../../target/debug/onnxruntime.dll . || true
cp -v ../../target/debug/libonnxruntime.so.* . || true
cp -v ../../target/debug/libonnxruntime.*.dylib . || true
poetry run pytest
- 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
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@v4
- name: Set up Rust
uses: ./.github/actions/rust-toolchain-from-file
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: "11"
distribution: "adopt"
- name: Build
run: |
cargo build -p voicevox_core_java_api -v
cargo build -p test_util -v # build scriptにより/crates/test_util/data/の生成
- 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"
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 test --info