Skip to content

Commit

Permalink
Merge pull request #36 from SHAREVOX/sv-release-0.2
Browse files Browse the repository at this point in the history
SHAREVOX 0.2.0の変更をマージ
  • Loading branch information
y-chan authored Apr 26, 2023
2 parents 924523e + 62d0ed4 commit fc7b071
Show file tree
Hide file tree
Showing 11 changed files with 217 additions and 110 deletions.
42 changes: 28 additions & 14 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ on:
description: "コード署名する"
type: boolean
required: false
release:
types:
- published
# release:
# types:
# - published
pull_request:
push:
branches:
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
artifact_name: osx-x64-cpu
whl_local_version: cpu
use_cuda: false
runs-on: ${{ matrix.os }}
runs-on: ${{ github.event.inputs.code_signing == 'true' && startsWith(matrix.os, 'windows') && 'self-hosted' || matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
Expand Down Expand Up @@ -120,9 +120,23 @@ jobs:
shell: bash
run: cbindgen --crate sharevox_core_c_api -o ./sharevox_core.h
- name: build sharevox_core_c_api
shell: bash
run: cargo build -p sharevox_core_c_api -vv --features ${{ matrix.features }}, --target ${{ matrix.target }} --release
env:
ORT_USE_CUDA: ${{ matrix.use_cuda }}
- name: download product model
if: ${{ env.VERSION != 'DEBUG' }}
shell: bash
env:
SHAREVOX_MODEL_ASSET_NAME: sharevox_model-${{ env.VERSION }}
run: |
mkdir download
curl -L "https://github.com/SHAREVOX/sharevox_core/releases/download/${{ env.VERSION }}/${{ env.SHAREVOX_MODEL_ASSET_NAME }}.zip" > download/${{ env.SHAREVOX_MODEL_ASSET_NAME }}.zip
7z x -o"download" download/${{ env.SHAREVOX_MODEL_ASSET_NAME }}.zip
rm download/${{ env.SHAREVOX_MODEL_ASSET_NAME }}.zip
mv model/gaussian_model.onnx download/model/
rm -r model
mv download/model model
- name: build sharevox_core_python_api
id: build-sharevox-core-python-api
shell: bash
Expand All @@ -146,16 +160,16 @@ jobs:
# libonnxruntimeについてはバージョン付のshared libraryを使用するためバージョンがついてないものを削除する
rm -f artifact/${{ env.ASSET_NAME }}/libonnxruntime.{so,dylib}
cp -v README.md "artifact/${{ env.ASSET_NAME }}/README.txt"
cp -vr model "artifact/${{ env.ASSET_NAME }}/"
# cp -vr model "artifact/${{ env.ASSET_NAME }}/"
echo "${{ env.VERSION }}" > "artifact/${{ env.ASSET_NAME }}/VERSION"
- name: Code signing (Windows)
if: startsWith(matrix.os, 'windows') && github.event.inputs.code_signing == 'true'
shell: bash
run: |
bash build_util/codesign.bash "artifact/${{ env.ASSET_NAME }}/sharevox_core.dll"
env:
CERT_BASE64: ${{ secrets.CERT_BASE64 }}
CERT_PASSWORD: ${{ secrets.CERT_PASSWORD }}
bash build_util/codesign_sv.bash "artifact/${{ env.ASSET_NAME }}/sharevox_core.dll"
# env:
# CERT_BASE64: ${{ secrets.CERT_BASE64 }}
# CERT_PASSWORD: ${{ secrets.CERT_PASSWORD }}
- name: Archive artifact
shell: bash
run: |
Expand Down Expand Up @@ -212,7 +226,7 @@ jobs:
- name: download-osx-aarch64
target: aarch64-apple-darwin
os: macos-11
runs-on: ${{ matrix.os }}
runs-on: ${{ github.event.inputs.code_signing == 'true' && startsWith(matrix.os, 'windows') && 'self-hosted' || matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install cross compiler for aarch64-unknown-linux-gnu
Expand All @@ -239,10 +253,10 @@ jobs:
if: startsWith(matrix.os, 'windows') && github.event.inputs.code_signing == 'true'
shell: bash
run: |
bash build_util/codesign.bash ./${{ matrix.name }}
env:
CERT_BASE64: ${{ secrets.CERT_BASE64 }}
CERT_PASSWORD: ${{ secrets.CERT_PASSWORD }}
bash build_util/codesign_sv.bash ./${{ matrix.name }}
# env:
# CERT_BASE64: ${{ secrets.CERT_BASE64 }}
# CERT_PASSWORD: ${{ secrets.CERT_PASSWORD }}
- name: Upload to Release
if: env.VERSION != 'DEBUG' && env.SKIP_UPLOADING_RELEASE_ASSET == '0'
uses: softprops/action-gh-release@v1
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/download_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
download_command: cargo run -vv -p download
download_dir: sharevox_core
check_items: |
voicevox_core.dll
sharevox_core.dll
model/metas.json
open_jtalk_dic_utf_8-1.11
README.txt
Expand All @@ -38,7 +38,7 @@ jobs:
download_command: cargo run -vv -p download -- --cpu-arch x86
download_dir: sharevox_core
check_items: |
voicevox_core.dll
sharevox_core.dll
model/metas.json
open_jtalk_dic_utf_8-1.11
README.txt
Expand All @@ -55,7 +55,7 @@ jobs:
download_command: cargo run -vv -p download -- -o other_output
download_dir: other_output
check_items: |
voicevox_core.dll
sharevox_core.dll
model/metas.json
open_jtalk_dic_utf_8-1.11
README.txt
Expand All @@ -72,7 +72,7 @@ jobs:
download_command: cargo run -vv -p download -- --min
download_dir: sharevox_core
check_items: |
voicevox_core.dll
sharevox_core.dll
model/metas.json
README.txt
check_not_exists_items: |
Expand All @@ -89,7 +89,7 @@ jobs:
download_command: cargo run -vv -p download -- --device directml
download_dir: sharevox_core
check_items: |
voicevox_core.dll
sharevox_core.dll
model/metas.json
open_jtalk_dic_utf_8-1.11
README.txt
Expand All @@ -108,7 +108,7 @@ jobs:
download_command: cargo run -vv -p download -- --device directml --min
download_dir: sharevox_core
check_items: |
voicevox_core.dll
sharevox_core.dll
model/metas.json
README.txt
check_not_exists_items: |
Expand All @@ -126,7 +126,7 @@ jobs:
download_command: cargo run -vv -p download -- --device cuda
download_dir: sharevox_core
check_items: |
voicevox_core.dll
sharevox_core.dll
model/metas.json
open_jtalk_dic_utf_8-1.11
README.txt
Expand All @@ -148,7 +148,7 @@ jobs:
download_command: cargo run -vv -p download -- --device cuda --min
download_dir: sharevox_core
check_items: |
voicevox_core.dll
sharevox_core.dll
model/metas.json
README.txt
check_not_exists_items: |
Expand All @@ -170,7 +170,7 @@ jobs:
download_command: ./scripts/downloads/download.sh
download_dir: sharevox_core
check_items: |
libvoicevox_core.so
libsharevox_core.so
model/metas.json
open_jtalk_dic_utf_8-1.11
README.txt
Expand All @@ -188,7 +188,7 @@ jobs:
download_command: ./scripts/downloads/download.sh --cpu-arch x64
download_dir: sharevox_core
check_items: |
libvoicevox_core.so
libsharevox_core.so
model/metas.json
open_jtalk_dic_utf_8-1.11
README.txt
Expand All @@ -206,7 +206,7 @@ jobs:
download_command: ./scripts/downloads/download.sh --output other_output
download_dir: other_output
check_items: |
libvoicevox_core.so
libsharevox_core.so
model/metas.json
open_jtalk_dic_utf_8-1.11
README.txt
Expand All @@ -224,7 +224,7 @@ jobs:
download_command: ./scripts/downloads/download.sh --min
download_dir: sharevox_core
check_items: |
libvoicevox_core.so
libsharevox_core.so
model/metas.json
README.txt
check_not_exists_items: |
Expand All @@ -242,7 +242,7 @@ jobs:
download_command: ./scripts/downloads/download.sh --device cuda
download_dir: sharevox_core
check_items: |
libvoicevox_core.so
libsharevox_core.so
model/metas.json
open_jtalk_dic_utf_8-1.11
README.txt
Expand All @@ -263,7 +263,7 @@ jobs:
download_command: ./scripts/downloads/download.sh --device cuda --min
download_dir: sharevox_core
check_items: |
libvoicevox_core.so
libsharevox_core.so
model/metas.json
README.txt
check_not_exists_items: |
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

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

36 changes: 36 additions & 0 deletions build_util/codesign_sv.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# !!! コードサイニング証明書を取り扱うので取り扱い注意 !!!

set -eu

if [ $# -ne 1 ]; then
echo "引数の数が一致しません"
exit 1
fi
target_file_glob="$1"

# 指定ファイルに署名する
function codesign() {
TARGET="$1"
SIGNTOOL=$(find "C:/Program Files (x86)/Windows Kits/10/App Certification Kit" -name "signtool.exe" | sort -V | tail -n 1)
powershell "& '$SIGNTOOL' sign /n 'Open Source Developer, Yuto Ashida' /fd sha1 /t http://time.certum.pl/ '$TARGET'"
powershell "& '$SIGNTOOL' sign /n 'Open Source Developer, Yuto Ashida' /fd sha256 /td sha256 /tr http://time.certum.pl/ /as '$TARGET'"
}

# 指定ファイルが署名されているか
function is_signed() {
TARGET="$1"
SIGNTOOL=$(find "C:/Program Files (x86)/Windows Kits/10/App Certification Kit" -name "signtool.exe" | sort -V | tail -n 1)
powershell "& '$SIGNTOOL' verify /pa '$TARGET'" || return 1
}

# 署名されていなければ署名
# shellcheck disable=SC2012,SC2086
ls $target_file_glob | while read -r target_file; do
if is_signed "$target_file"; then
echo "署名済み: $target_file"
else
echo "署名: $target_file"
codesign "$target_file"
fi
done
2 changes: 1 addition & 1 deletion crates/voicevox_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ derive-new = "0.5.9"
easy-ext.workspace = true
fs-err.workspace = true
once_cell.workspace = true
onnxruntime = { git = "https://github.com/VOICEVOX/onnxruntime-rs.git", rev="405f62fb53df1b59b0e69adafbd1c28e4d5c2787" }
onnxruntime = { git = "https://github.com/SHAREVOX/onnxruntime-rs.git", rev="a74d8b4ed5a6675b01a9e6f2945fdf92c40d78af" }
process_path = "0.1.4"
serde.workspace = true
serde_json.workspace = true
Expand Down
14 changes: 0 additions & 14 deletions crates/voicevox_core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ pub enum Error {
base_error_message(SHAREVOX_RESULT_INVALID_LIBRARY_UUID_ERROR)
)]
InvalidLibraryUuid { library_uuid: String },

#[error(
"{}: {length_regulator_type:?}",
base_error_message(SHAREVOX_RESULT_INVALID_LENGTH_REGULATOR_ERROR)
)]
InvalidLengthRegulator { length_regulator_type: String },
}

impl PartialEq for Error {
Expand Down Expand Up @@ -152,14 +146,6 @@ impl PartialEq for Error {
cause: cause2,
},
) => (path1, cause1.to_string()) == (path2, cause2.to_string()),
(
Self::InvalidLengthRegulator {
length_regulator_type: length_regulator_type1,
},
Self::InvalidLengthRegulator {
length_regulator_type: length_regulator_type2,
},
) => length_regulator_type1 == length_regulator_type2,
_ => false,
}
}
Expand Down
Loading

0 comments on commit fc7b071

Please sign in to comment.