Skip to content

Commit

Permalink
Merge branch 'main' into build_and_deployの最後にdownload_testを実行
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed Sep 14, 2023
2 parents 11fbe67 + f342712 commit 8284f8c
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 35 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/download_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,28 +185,24 @@ jobs:
- uses: actions/checkout@v3
- name: Set up Rust
uses: ./.github/actions/rust-toolchain-from-file

- name: Get prerelease latest version
if: ${{ env.VERSION == 'prerelease-latest' }}
run: |
VERSION=$(
curl -s https://api.github.com/repos/VOICEVOX/voicevox_core/releases \
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 }} --version ${{ env.VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check downloaded version
run: |
[ -e "${{ matrix.download_dir }}/VERSION" ]
[ "$(cat "${{ matrix.download_dir }}/VERSION")" = "${{ env.VERSION }}" ]
- name: Check downloaded files
run: |
mapfile -t items < <(echo -n '${{ matrix.check_items }}')
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/java_lint.yml
Original file line number Diff line number Diff line change
@@ -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
40 changes: 40 additions & 0 deletions .github/workflows/python_lint.yml
Original file line number Diff line number Diff line change
@@ -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 .
6 changes: 3 additions & 3 deletions crates/download/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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のみ)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public boolean isLoadedVoiceModel(String voiceModelId) {
* @param text テキスト。
* @param styleId スタイルID。
* @return {@link CreateAudioQueryConfigurator}。
*
* @see CreateAudioQueryConfigurator#execute
*/
@Nonnull
Expand All @@ -69,7 +68,6 @@ public CreateAudioQueryConfigurator createAudioQuery(String text, int styleId) {
* @param text テキスト。
* @param styleId スタイルID。
* @return {@link CreateAccentPhrasesConfigurator}。
*
* @see CreateAccentPhrasesConfigurator#execute
*/
@Nonnull
Expand Down Expand Up @@ -137,7 +135,6 @@ public List<AccentPhrase> replaceMoraPitch(List<AccentPhrase> accentPhrases, int
* @param audioQuery {@link AudioQuery}。
* @param styleId スタイルID。
* @return {@link SynthesisConfigurator}。
*
* @see SynthesisConfigurator#execute
*/
@Nonnull
Expand All @@ -151,7 +148,6 @@ public SynthesisConfigurator synthesis(AudioQuery audioQuery, int styleId) {
* @param text テキスト。
* @param styleId スタイルID。
* @return {@link TtsConfigurator}。
*
* @see TtsConfigurator#execute
*/
@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.google.gson.internal.LinkedTreeMap;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;

import java.lang.ref.Cleaner;
import java.util.HashMap;
import javax.annotation.Nonnull;
Expand Down Expand Up @@ -177,7 +176,7 @@ public static class Word {
/**
* UserDict.Wordを作成する。
*
* @param surface 言葉の表層形。
* @param surface 言葉の表層形。
* @param pronunciation 言葉の発音。
* @throws IllegalArgumentException pronunciationが不正な場合。
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,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からコンストラクトするため、このメソッドは呼ばれることは無い。
Expand All @@ -83,12 +83,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 = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# AudioQueryのkanaを比較して変化するかどうかで判断する。

from uuid import UUID
import pytest

import conftest # noqa: F401
import pytest
import voicevox_core # noqa: F401


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# どのコードがどの操作を行っているかはコメントを参照。

import os
from uuid import UUID
import tempfile
from uuid import UUID

import pytest
import voicevox_core # noqa: F401

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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__",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pydantic

from ._rust import _validate_pronunciation, _to_zenkaku
from ._rust import _to_zenkaku, _validate_pronunciation


@pydantic.dataclasses.dataclass
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 2 additions & 7 deletions example/python/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@
from typing import Tuple

import voicevox_core
from voicevox_core import (
AccelerationMode,
AudioQuery,
OpenJtalk,
Synthesizer,
VoiceModel,
)
from voicevox_core import (AccelerationMode, AudioQuery, OpenJtalk,
Synthesizer, VoiceModel)


async def main() -> None:
Expand Down

0 comments on commit 8284f8c

Please sign in to comment.