Skip to content

Commit

Permalink
Merge: main -> fix/android-build
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Sep 15, 2023
2 parents 5baf16e + 239a1d7 commit 81283e7
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 31 deletions.
32 changes: 18 additions & 14 deletions .github/workflows/download_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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 }}')
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 @@ -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からコンストラクトするため、このメソッドは呼ばれることは無い。
Expand All @@ -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 = "";
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

0 comments on commit 81283e7

Please sign in to comment.