project-vvm-async-api #1725
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: test workflow | |
on: | |
push: | |
branches: | |
- "*" | |
- "**/*" | |
pull_request: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
shellcheck: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- 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@v3 | |
# 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@v4 | |
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@v3 | |
- 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@v3 | |
- 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@v4 | |
with: | |
python-version: "3.8" | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo clippy -vv --all-features --features onnxruntime/disable-sys-build-script --tests -- -D clippy::all -D warnings --no-deps | |
- run: cargo clippy -vv --all-features --features onnxruntime/disable-sys-build-script -- -D clippy::all -D warnings --no-deps | |
- run: cargo fmt -- --check | |
rust-test: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-2019 | |
features: "" | |
- os: windows-2022 | |
features: "" | |
- os: windows-2019 | |
features: directml | |
- os: windows-2022 | |
features: directml | |
- os: macos-11 | |
features: "" | |
- os: macos-12 | |
features: "" | |
- os: ubuntu-20.04 | |
features: "" | |
- os: ubuntu-22.04 | |
features: "" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- name: Set up Rust | |
uses: ./.github/actions/rust-toolchain-from-file | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
# cargoのキャッシュが原因でテストが失敗する場合はバージョン部分をカウントアップすること | |
key: "v2-cargo-test-cache-${{ matrix.features }}-${{ matrix.os }}" | |
- name: Run cargo test | |
run: cargo test -vv --features ,${{ matrix.features }} -- --include-ignored | |
c-header: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- 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[] | select(startswith("xtask "))) 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@v3 | |
- 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 -vv | |
- name: 必要なfileをunix用exampleのディレクトリに移動させる | |
run: | | |
mkdir -p example/cpp/unix/voicevox_core/ | |
cp -v crates/voicevox_core_c_api/include/voicevox_core.h example/cpp/unix/voicevox_core/ | |
cp -v target/debug/libvoicevox_core.{so,dylib} example/cpp/unix/voicevox_core/ || true | |
cp -v target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.so.* example/cpp/unix/voicevox_core/ || true | |
cp -v target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.*.dylib example/cpp/unix/voicevox_core/ || true | |
- if: startsWith(matrix.os, 'mac') | |
uses: jwlawson/[email protected] | |
- 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@v3 | |
- 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 -vv | |
- name: 必要なfileをexampleのディレクトリに移動させる | |
run: | | |
mkdir -p example/cpp/windows/simple_tts/lib/x64 | |
cp -v crates/voicevox_core_c_api/include/voicevox_core.h example/cpp/windows/simple_tts/ | |
cp target/debug/voicevox_core.dll.lib example/cpp/windows/simple_tts/lib/x64/voicevox_core.lib | |
- name: Add MSBuild to PATH | |
uses: microsoft/[email protected] | |
- 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-python-api: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
- os: macos-latest | |
- os: ubuntu-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- name: Set up Rust | |
uses: ./.github/actions/rust-toolchain-from-file | |
- name: venv作成 | |
uses: ./.github/actions/create-venv | |
- run: pip install -r ./crates/voicevox_core_python_api/requirements.txt | |
- run: cargo build -p voicevox_core_c_api -vv | |
- run: maturin build --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --locked | |
- run: maturin develop --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --locked | |
- name: 必要なDLLをコピーしてpytestを実行 | |
working-directory: crates/voicevox_core_python_api | |
run: | | |
cp -v ../../target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/onnxruntime.dll . || true | |
cp -v ../../target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.so.* . || true | |
cp -v ../../target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.*.dylib . || true | |
pip install -r requirements-test.txt | |
pytest | |
env: | |
CARGO_TERM_COLOR: always |