Skip to content

Commit

Permalink
Merge branch 'master' into add/xx_label_val
Browse files Browse the repository at this point in the history
  • Loading branch information
tarepan committed Feb 20, 2024
2 parents fc8ea3f + ef12241 commit b8e5e9b
Show file tree
Hide file tree
Showing 30 changed files with 4,682 additions and 160 deletions.
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
test/**/__snapshots__/**/*.json linguist-generated=true

* text=auto
*.png -text
*.wav -text
*.wav -text
2 changes: 1 addition & 1 deletion .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
id: vars
run: |
: # releaseタグ名か、workflow_dispatchでのバージョン名か、latestが入る
echo "version_or_latest=${{ github.event.release.tag_name || github.event.inputs.version || 'latest' }}" >> $GITHUB_OUTPUT
echo "version_or_latest=${{ github.event.release.tag_name || github.event.inputs.version || 'latest' }}" >> "$GITHUB_OUTPUT"
build-docker:
needs: [config]
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ jobs:
id: vars
run: |
: # release タグ名, または workflow_dispatch でのバージョン名. リリースでない (push event) 場合は空文字列
echo "version=${{ github.event.release.tag_name || github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "version=${{ github.event.release.tag_name || github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
: # release タグ名, または workflow_dispatch でのバージョン名, または 'latest'
echo "version_or_latest=${{ github.event.release.tag_name || github.event.inputs.version || 'latest' }}" >> $GITHUB_OUTPUT
echo "version_or_latest=${{ github.event.release.tag_name || github.event.inputs.version || 'latest' }}" >> "$GITHUB_OUTPUT"
build-and-upload:
needs: [config]
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
- name: declare variables
id: vars
run: |
echo "package_name=voicevox_engine-${{ matrix.target }}-${{ needs.config.outputs.version }}" >> $GITHUB_OUTPUT
echo "package_name=voicevox_engine-${{ matrix.target }}-${{ needs.config.outputs.version }}" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release-test-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ jobs:
id: docker_vars
run: |
if [ "${{ matrix.tag }}" != "" ]; then
echo "image_tag=${{ env.IMAGE_NAME }}:${{ matrix.tag }}-${{ env.VERSION }}" >> $GITHUB_OUTPUT
echo "image_tag=${{ env.IMAGE_NAME }}:${{ matrix.tag }}-${{ env.VERSION }}" >> "$GITHUB_OUTPUT"
else
echo "image_tag=${{ env.IMAGE_NAME }}:${{ env.VERSION }}" >> $GITHUB_OUTPUT
echo "image_tag=${{ env.IMAGE_NAME }}:${{ env.VERSION }}" >> "$GITHUB_OUTPUT"
fi
- name: Docker pull
Expand All @@ -81,14 +81,14 @@ jobs:
max_attempts=10
sleep_interval=5
for i in $(seq 1 $max_attempts); do
status=$(curl -o /dev/null -s -w '%{http_code}\n' $url)
if [ $status -eq 200 ]; then
echo "Container is ready! Response status code: $status"
for i in $(seq 1 "$max_attempts"); do
status=$(curl -o /dev/null -s -w '%{http_code}\n' "$url")
if [ "$status" -eq 200 ]; then
echo "Container is ready! Response status code: ${status}"
exit 0
else
echo "Attempt $i/$max_attempts: Response status code $status"
sleep $sleep_interval
echo "Attempt ${i}/${max_attempts}: Response status code $status"
sleep "${sleep_interval}"
fi
done
exit 1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ jobs:
- name: declare variables
id: vars
run: |
echo "release_url=${{ env.REPO_URL }}/releases/download/${{ env.VERSION }}" >> $GITHUB_OUTPUT
echo "package_name=voicevox_engine-${{ matrix.target }}-${{ env.VERSION }}" >> $GITHUB_OUTPUT
echo "release_url=${{ env.REPO_URL }}/releases/download/${{ env.VERSION }}" >> "$GITHUB_OUTPUT"
echo "package_name=voicevox_engine-${{ matrix.target }}-${{ env.VERSION }}" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4

Expand All @@ -72,7 +72,7 @@ jobs:
curl -L -o "download/list.txt" "${{ steps.vars.outputs.release_url }}/${{ steps.vars.outputs.package_name }}.7z.txt"
cat "download/list.txt" | xargs -I '%' curl -L -o "download/%" "${{ steps.vars.outputs.release_url }}/%"
7z x "download/$(head -n1 download/list.txt)"
mv ${{ matrix.target }} dist/
mv "${{ matrix.target }}" dist/
- name: chmod +x
if: startsWith(matrix.target, 'linux') || startsWith(matrix.target, 'macos')
Expand Down
2 changes: 1 addition & 1 deletion build_util/create_venv_and_generate_licenses.bash
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ else
fi

pip install -r requirements-license.txt
python build_util/generate_licenses.py >$OUTPUT_LICENSE_JSON_PATH
python build_util/generate_licenses.py > "${OUTPUT_LICENSE_JSON_PATH}"

deactivate

Expand Down
10 changes: 5 additions & 5 deletions build_util/process_voicevox_resource.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ if [ ! -v DOWNLOAD_RESOURCE_PATH ]; then
fi

rm -r speaker_info
cp -r $DOWNLOAD_RESOURCE_PATH/character_info speaker_info
cp -r "${DOWNLOAD_RESOURCE_PATH}/character_info" speaker_info

# キャラクター情報の前処理をする
python $DOWNLOAD_RESOURCE_PATH/scripts/clean_character_info.py \
python "${DOWNLOAD_RESOURCE_PATH}/scripts/clean_character_info.py" \
--character_info_dir speaker_info/

# マニフェスト
jq -s '.[0] * .[1]' engine_manifest.json $DOWNLOAD_RESOURCE_PATH/engine/engine_manifest.json \
jq -s '.[0] * .[1]' engine_manifest.json "${DOWNLOAD_RESOURCE_PATH}/engine/engine_manifest.json" \
> engine_manifest.json.tmp
mv engine_manifest.json.tmp engine_manifest.json

python build_util/merge_update_infos.py \
engine_manifest_assets/update_infos.json \
$DOWNLOAD_RESOURCE_PATH/engine/engine_manifest_assets/update_infos.json \
"${DOWNLOAD_RESOURCE_PATH}/engine/engine_manifest_assets/update_infos.json" \
engine_manifest_assets/update_infos.json

for f in $(ls $DOWNLOAD_RESOURCE_PATH/engine/engine_manifest_assets/* | grep -v update_infos.json); do
cp $f ./engine_manifest_assets/
cp "${f}" ./engine_manifest_assets/
done
4 changes: 2 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def morphable_targets(
指定されたベーススタイルに対してエンジン内の各話者がモーフィング機能を利用可能か返します。
モーフィングの許可/禁止は`/speakers`の`speaker.supported_features.synthesis_morphing`に記載されています。
プロパティが存在しない場合は、モーフィングが許可されているとみなします。
返り値の話者はstring型なので注意
返り値のスタイルIDはstring型なので注意
"""
core = get_core(core_version)

Expand Down Expand Up @@ -605,7 +605,7 @@ def _synthesis_morphing(
if not is_permitted:
raise HTTPException(
status_code=400,
detail="指定された話者ペアでのモーフィングはできません",
detail="指定されたスタイルペアでのモーフィングはできません",
)
except StyleIdNotFoundError as e:
raise HTTPException(
Expand Down
2 changes: 1 addition & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def snapshot_json(snapshot: SnapshotAssertion) -> SnapshotAssertion:
Examples
--------
>>> def test_foo(snapshot_json: JSONSnapshotExtension):
>>> def test_foo(snapshot_json: SnapshotAssertion):
>>> assert snapshot_json == {"key": "value"}
"""
return snapshot.use_extension(JSONSnapshotExtension)

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions test/e2e/test_audio_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from test.utility import round_floats

from fastapi.testclient import TestClient
from syrupy.extensions.json import JSONSnapshotExtension
from syrupy.assertion import SnapshotAssertion


def test_speakerを指定して音声合成クエリが取得できる(
client: TestClient, snapshot_json: JSONSnapshotExtension
client: TestClient, snapshot_json: SnapshotAssertion
) -> None:
response = client.post("/audio_query", params={"text": "テストです", "speaker": 0})
assert response.status_code == 200
Expand Down
6 changes: 2 additions & 4 deletions test/e2e/test_openapi.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from typing import Any

from fastapi import FastAPI
from syrupy.extensions.json import JSONSnapshotExtension
from syrupy.assertion import SnapshotAssertion


def test_OpenAPIの形が変わっていないことを確認(
app: FastAPI, snapshot_json: JSONSnapshotExtension
) -> None:
def test_OpenAPIの形が変わっていないことを確認(app: FastAPI, snapshot_json: SnapshotAssertion) -> None:
# 変更があった場合はREADMEの「スナップショットの更新」の手順で更新可能
openapi: Any = app.openapi() # snapshot_jsonがmypyに対応していないのでワークアラウンド
assert snapshot_json == openapi
12 changes: 12 additions & 0 deletions test/e2e/test_preset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""
プリセットAPIのテスト
"""

from fastapi.testclient import TestClient
from syrupy.assertion import SnapshotAssertion


def test_プリセット一覧を取得できる(client: TestClient, snapshot_json: SnapshotAssertion) -> None:
response = client.get("/presets")
assert response.status_code == 200
assert snapshot_json == response.json()
Loading

0 comments on commit b8e5e9b

Please sign in to comment.