diff --git a/.github/workflows/download_test.yml b/.github/workflows/download_test.yml index 86f728d20..b7885ba09 100644 --- a/.github/workflows/download_test.yml +++ b/.github/workflows/download_test.yml @@ -8,9 +8,14 @@ on: - "Cargo.*" - "crates/download/**" - ".github/workflows/download_test.yml" + +env: + VERSION: "prerelease-latest" + defaults: run: shell: bash + jobs: download-releases: strategy: @@ -19,7 +24,7 @@ jobs: include: - name: 通常ダウンロード os: windows-latest - download_command: cargo run -vv -p download + download_command: cargo run -vv -p download -- # バージョン指定のために -- が必要 download_dir: voicevox_core check_items: | voicevox_core.dll @@ -169,29 +174,28 @@ jobs: open_jtalk_dic_utf_8-1.11 runs-on: ${{ matrix.os }} name: ${{ matrix.name }}-${{ matrix.os }} - env: - EXPECTED_VOICEVOX_CORE_VERSION: latest - # See https://github.com/VOICEVOX/voicevox_core/issues/310 - #EXPECTED_VOICEVOX_CORE_VERSION: ${{ matrix.expected_version || 'latest' }} steps: - uses: actions/checkout@v3 - name: Set up Rust - if: ${{ startsWith(matrix.download_command, 'cargo ') }} uses: ./.github/actions/rust-toolchain-from-file + - name: Get prerelease latest version + if: ${{ env.VERSION == 'prerelease-latest' }} + run: | + VERSION=$( + curl -sSf https://api.github.com/repos/VOICEVOX/voicevox_core/releases \ + -H 'authorization: Bearer ${{ github.token }}' \ + -H 'content-type: application/json' | + jq -er '.[0].tag_name' + ) + echo "VERSION=$VERSION" >> "$GITHUB_ENV" - name: Execute download command - run: ${{ matrix.download_command }} + run: ${{ matrix.download_command }} --version ${{ env.VERSION }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Get latest version - if: ${{ env.EXPECTED_VOICEVOX_CORE_VERSION == 'latest' }} - run: | - echo "EXPECTED_VOICEVOX_CORE_VERSION=$(gh release view --repo VOICEVOX/voicevox_core --json 'tagName' --jq '.tagName')" >> "$GITHUB_ENV" - env: - GITHUB_TOKEN: ${{ github.token }} - name: Check downloaded version run: | [ -e "${{ matrix.download_dir }}/VERSION" ] - [ "$(cat "${{ matrix.download_dir }}/VERSION")" = "${{ env.EXPECTED_VOICEVOX_CORE_VERSION }}" ] + [ "$(cat "${{ matrix.download_dir }}/VERSION")" = "${{ env.VERSION }}" ] - name: Check downloaded files run: | mapfile -t items < <(echo -n '${{ matrix.check_items }}') diff --git a/.github/workflows/java_lint.yml b/.github/workflows/java_lint.yml new file mode 100644 index 000000000..b631819b8 --- /dev/null +++ b/.github/workflows/java_lint.yml @@ -0,0 +1,31 @@ +name: "Lint Java code" + +on: + push: + branches: + - main + pull_request: + paths: + - ./crates/voicevox_core_java_api/**/*.java + - ./crates/voicevox_core_java_api/gradle/** + - ./crates/voicevox_core_java_api/gradlew + - ./crates/voicevox_core_java_api/settings.gradle + - ./.github/workflows/java_lint.yml + +defaults: + run: + shell: bash + working-directory: ./crates/voicevox_core_java_api + +jobs: + java-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v2 + with: + java-version: "11" + distribution: "adopt" + - name: Check code style + run: | + ./gradlew spotlessCheck --info diff --git a/.github/workflows/python_lint.yml b/.github/workflows/python_lint.yml new file mode 100644 index 000000000..c12b256cf --- /dev/null +++ b/.github/workflows/python_lint.yml @@ -0,0 +1,40 @@ +name: "Lint Python code" + +on: + push: + branches: + - main + pull_request: + paths: + - ./example/python/**/*.py + - ./crates/voicevox_core_python_api/**/*.py + - ./crates/voicevox_core_python_api/requirements*.txt + - ./crates/voicevox_core_python_api/pyproject.toml + - ./.github/workflows/python_lint.yml + +defaults: + run: + shell: bash + working-directory: ./crates/voicevox_core_python_api + +jobs: + python: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.8" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-dev.txt + - name: Check code style for voicevox_core_python_api + run: | + black --check . + isort --check . + - name: Check code style for example/python + working-directory: ./example/python + run: | + black --check . + isort --check . diff --git a/crates/download/src/main.rs b/crates/download/src/main.rs index fba1bc342..e52ca45f2 100644 --- a/crates/download/src/main.rs +++ b/crates/download/src/main.rs @@ -53,15 +53,15 @@ struct Args { min: bool, /// 出力先の指定 - #[arg(short, long, default_value(DEFAULT_OUTPUT))] + #[arg(short, long, value_name("DIRECTORY"), default_value(DEFAULT_OUTPUT))] output: PathBuf, /// ダウンロードするvoicevox_coreのバージョンの指定 - #[arg(short, long, default_value("latest"))] + #[arg(short, long, value_name("GIT_TAG_OR_LATEST"), default_value("latest"))] version: String, /// 追加でダウンロードするライブラリのバージョン - #[arg(long, default_value("latest"))] + #[arg(long, value_name("GIT_TAG_OR_LATEST"), default_value("latest"))] additional_libraries_version: String, /// ダウンロードするデバイスを指定する(cudaはlinuxのみ) diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java index 90e74f6d9..05c1a11b2 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java @@ -48,25 +48,25 @@ public static class SpeakerMeta { @SerializedName("name") @Expose @Nonnull - final String name; + public final String name; /** 話者に属するスタイル。 */ @SerializedName("styles") @Expose @Nonnull - final StyleMeta[] styles; + public final StyleMeta[] styles; /** 話者のUUID。 */ @SerializedName("speaker_uuid") @Expose @Nonnull - final String speakerUuid; + public final String speakerUuid; /** 話者のバージョン。 */ @SerializedName("version") @Expose @Nonnull - final String version; + public final String version; private SpeakerMeta() { // GSONからコンストラクトするため、このメソッドは呼ばれることは無い。 @@ -84,12 +84,12 @@ public static class StyleMeta { @SerializedName("name") @Expose @Nonnull - final String name; + public final String name; /** スタイルID。 */ @SerializedName("id") @Expose - final int id; + public final int id; private StyleMeta() { this.name = ""; diff --git a/crates/voicevox_core_python_api/python/test/test_user_dict_load.py b/crates/voicevox_core_python_api/python/test/test_user_dict_load.py index 8c506a50f..d9829e6da 100644 --- a/crates/voicevox_core_python_api/python/test/test_user_dict_load.py +++ b/crates/voicevox_core_python_api/python/test/test_user_dict_load.py @@ -2,8 +2,9 @@ # AudioQueryのkanaを比較して変化するかどうかで判断する。 from uuid import UUID -import pytest + import conftest # noqa: F401 +import pytest import voicevox_core # noqa: F401 diff --git a/crates/voicevox_core_python_api/python/test/test_user_dict_manipulate.py b/crates/voicevox_core_python_api/python/test/test_user_dict_manipulate.py index c9bc2c454..f7902ea94 100644 --- a/crates/voicevox_core_python_api/python/test/test_user_dict_manipulate.py +++ b/crates/voicevox_core_python_api/python/test/test_user_dict_manipulate.py @@ -2,8 +2,9 @@ # どのコードがどの操作を行っているかはコメントを参照。 import os -from uuid import UUID import tempfile +from uuid import UUID + import pytest import voicevox_core # noqa: F401 diff --git a/crates/voicevox_core_python_api/python/voicevox_core/__init__.py b/crates/voicevox_core_python_api/python/voicevox_core/__init__.py index f59f705dd..ce6245bfc 100644 --- a/crates/voicevox_core_python_api/python/voicevox_core/__init__.py +++ b/crates/voicevox_core_python_api/python/voicevox_core/__init__.py @@ -11,15 +11,15 @@ UserDictWord, UserDictWordType, ) -from ._rust import ( - __version__, +from ._rust import ( # noqa: F401 OpenJtalk, Synthesizer, + UserDict, VoiceModel, VoicevoxError, - UserDict, + __version__, supported_devices, -) # noqa: F401 +) __all__ = [ "__version__", diff --git a/crates/voicevox_core_python_api/python/voicevox_core/_models.py b/crates/voicevox_core_python_api/python/voicevox_core/_models.py index b559100be..c1cd9ccca 100644 --- a/crates/voicevox_core_python_api/python/voicevox_core/_models.py +++ b/crates/voicevox_core_python_api/python/voicevox_core/_models.py @@ -4,7 +4,7 @@ import pydantic -from ._rust import _validate_pronunciation, _to_zenkaku +from ._rust import _to_zenkaku, _validate_pronunciation @pydantic.dataclasses.dataclass diff --git a/crates/voicevox_core_python_api/python/voicevox_core/_rust.pyi b/crates/voicevox_core_python_api/python/voicevox_core/_rust.pyi index e9c700a91..324ea0117 100644 --- a/crates/voicevox_core_python_api/python/voicevox_core/_rust.pyi +++ b/crates/voicevox_core_python_api/python/voicevox_core/_rust.pyi @@ -1,5 +1,5 @@ from pathlib import Path -from typing import Dict, Final, List, Literal, Union, TYPE_CHECKING +from typing import TYPE_CHECKING, Dict, Final, List, Literal, Union from uuid import UUID import numpy as np