Skip to content

Commit

Permalink
Merge branch 'main' into revive-from-kana
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip committed Sep 22, 2023
2 parents dbd5f62 + bbb35b4 commit 7f98938
Show file tree
Hide file tree
Showing 97 changed files with 4,753 additions and 1,508 deletions.
48 changes: 25 additions & 23 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ env:
VOICEVOX_FAT_RESOURCE_VERSION: "0.15.0-preview.1"
# releaseタグ名か、workflow_dispatchでのバージョン名か、'0.0.0'が入る
VERSION: ${{ github.event.release.tag_name || github.event.inputs.version || '0.0.0' }}
PRODUCTION_REPOSITORY_TAG: "0.15.0-preview.1" # 製品版のタグ名
PRODUCTION_REPOSITORY_TAG: "0.15.0-preview.2" # 製品版のタグ名
# 簡易テストとするかどうか。releaseとworkflow_dispatch以外は簡易テストとする
IS_SIMPLE_TEST: ${{ github.event_name != 'release' && github.event_name != 'workflow_dispatch' }}

Expand All @@ -41,10 +41,11 @@ defaults:
shell: bash

jobs:
build_and_deploy_strategy_matrix: # 実行対象の条件をフィルタリングする
config: # 全 jobs で利用する定数の定義。実行対象の条件をフィルタリングする
runs-on: ubuntu-latest
outputs:
includes: ${{ steps.strategy_matrix.outputs.includes }}
deploy: ${{ env.VERSION != '0.0.0' }}
steps:
- name: declare strategy matrix
id: strategy_matrix
Expand Down Expand Up @@ -181,11 +182,11 @@ jobs:
echo "includes=${includes}" >> "$GITHUB_OUTPUT"
build_and_deploy:
needs: build_and_deploy_strategy_matrix
needs: config
environment: ${{ github.event.inputs.is_production == 'true' && 'production' || '' }} # 製品版のenvironment
strategy:
matrix:
include: ${{ fromJson(needs.build_and_deploy_strategy_matrix.outputs.includes) }}
include: ${{ fromJson(needs.config.outputs.includes) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3 # 製品版ではない場合
Expand Down Expand Up @@ -318,7 +319,7 @@ jobs:
cd artifact
7z a "../${{ env.ASSET_NAME }}.zip" "${{ env.ASSET_NAME }}"
- name: Upload to Release
if: env.VERSION != '0.0.0' && env.SKIP_UPLOADING_RELEASE_ASSET == '0' && !contains(matrix.target, 'ios')
if: needs.config.outputs.deploy == 'true' && env.SKIP_UPLOADING_RELEASE_ASSET == '0' && !contains(matrix.target, 'ios')
uses: softprops/action-gh-release@v1
with:
prerelease: true
Expand All @@ -327,7 +328,7 @@ jobs:
${{ env.ASSET_NAME }}.zip
target_commitish: ${{ github.sha }}
- name: Upload Python whl to Release
if: env.VERSION != '0.0.0' && matrix.whl_local_version
if: needs.config.outputs.deploy == 'true' && matrix.whl_local_version
uses: softprops/action-gh-release@v1
with:
prerelease: true
Expand All @@ -338,9 +339,10 @@ jobs:

build_xcframework:
if: ${{ !(github.event_name != 'release' && github.event_name != 'workflow_dispatch') }} # !env.IS_SIMPLE_TEST と同じ
needs: build_and_deploy
needs: [config, build_and_deploy]
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Set ASSET_NAME env var
run: echo "ASSET_NAME=voicevox_core-ios-xcframework-cpu-${{ env.VERSION }}" >> "$GITHUB_ENV"
- uses: actions/download-artifact@v2
Expand All @@ -362,18 +364,25 @@ jobs:
- name: Create XCFramework
run: |
mkdir -p "artifact/${{ env.ASSET_NAME }}"
# 必要なファイルだけコピー
mkdir -p "Headers-sim"
cp -v artifact/voicevox_core-x86_64-apple-ios/voicevox_core.h "Headers-sim"
cp -v crates/voicevox_core_c_api/xcframework/Headers/module.modulemap "Headers-sim"
mkdir -p "Headers-aarch64"
cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h "Headers-aarch64"
cp -v crates/voicevox_core_c_api/xcframework/Headers/module.modulemap "Headers-aarch64"
xcodebuild -create-xcframework \
-library "artifact/voicevox_core-sim/libvoicevox_core.dylib" \
-headers "artifact/voicevox_core-x86_64-apple-ios/voicevox_core.h" \
-headers "Headers-sim" \
-library "artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib" \
-headers "artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h" \
-headers "Headers-aarch64" \
-output "artifact/${{ env.ASSET_NAME }}/voicevox_core.xcframework"
- name: Archive artifact
run: |
cd artifact/${{ env.ASSET_NAME }}
7z a "../../${{ env.ASSET_NAME }}.zip" "voicevox_core.xcframework"
- name: Upload to Release
if: env.VERSION != '0.0.0' && env.SKIP_UPLOADING_RELEASE_ASSET == '0'
if: needs.config.outputs.deploy == 'true' && env.SKIP_UPLOADING_RELEASE_ASSET == '0'
uses: softprops/action-gh-release@v1
with:
prerelease: true
Expand All @@ -382,16 +391,9 @@ jobs:
${{ env.ASSET_NAME }}.zip
target_commitish: ${{ github.sha }}

deploy_downloader:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Upload to Release
if: env.VERSION != '0.0.0'
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: ${{ env.VERSION }}
files: |-
scripts/downloads/*
target_commitish: ${{ github.sha }}
download_test:
needs: [config, build_and_deploy]
if: needs.config.outputs.deploy == 'true'
uses: ./.github/workflows/download_test.yml
with:
version: ${{ inputs.version }}
170 changes: 33 additions & 137 deletions .github/workflows/download_test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
name: Download test workflow

on:
workflow_call:
inputs:
version:
description: "テスト対象のコアのバージョン。無指定時はprerelease込みの最新release。"
type: string
required: false
push:
branches:
- main
pull_request:
paths:
- "Cargo.*"
- "crates/download/**"
- "scripts/downloads/*"
- ".github/workflows/download_test.yml"

env:
VERSION: ${{ inputs.version || 'prerelease-latest' }}

defaults:
run:
shell: bash

jobs:
download-releases:
strategy:
Expand All @@ -20,11 +31,11 @@ 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
model/metas.json
model/README.*
open_jtalk_dic_utf_8-1.11
README.txt
# https://github.com/VOICEVOX/voicevox_core/pull/411#issuecomment-1412457592
Expand All @@ -42,7 +53,7 @@ jobs:
download_dir: voicevox_core
check_items: |
voicevox_core.dll
model/metas.json
model/README.*
open_jtalk_dic_utf_8-1.11
README.txt
check_not_exists_items: |
Expand All @@ -59,7 +70,7 @@ jobs:
download_dir: other_output
check_items: |
voicevox_core.dll
model/metas.json
model/README.*
open_jtalk_dic_utf_8-1.11
README.txt
check_not_exists_items: |
Expand All @@ -76,7 +87,7 @@ jobs:
download_dir: voicevox_core
check_items: |
voicevox_core.dll
model/metas.json
model/README.*
README.txt
check_not_exists_items: |
*directml*
Expand All @@ -93,7 +104,7 @@ jobs:
download_dir: voicevox_core
check_items: |
voicevox_core.dll
model/metas.json
model/README.*
open_jtalk_dic_utf_8-1.11
README.txt
DirectML.dll
Expand All @@ -112,7 +123,7 @@ jobs:
download_dir: voicevox_core
check_items: |
voicevox_core.dll
model/metas.json
model/README.*
README.txt
check_not_exists_items: |
*cuda*
Expand All @@ -130,7 +141,7 @@ jobs:
download_dir: voicevox_core
check_items: |
voicevox_core.dll
model/metas.json
model/README.*
open_jtalk_dic_utf_8-1.11
README.txt
EULA.txt
Expand All @@ -152,7 +163,7 @@ jobs:
download_dir: voicevox_core
check_items: |
voicevox_core.dll
model/metas.json
model/README.*
README.txt
check_not_exists_items: |
*directml*
Expand All @@ -168,145 +179,30 @@ jobs:
cufft64_*.dll
curand64_*.dll
open_jtalk_dic_utf_8-1.11
- name: 通常ダウンロード
os: ubuntu-latest
download_command: ./scripts/downloads/download.sh
download_dir: voicevox_core
check_items: |
libvoicevox_core.so
model/metas.json
open_jtalk_dic_utf_8-1.11
README.txt
check_not_exists_items: |
*directml*
*cuda*
*cudnn*
*onnxruntime*providers*
*eula*
*nvidia*
*cufft*
*curand*
- name: CPUArch指定
os: ubuntu-latest
download_command: ./scripts/downloads/download.sh --cpu-arch x64
download_dir: voicevox_core
check_items: |
libvoicevox_core.so
model/metas.json
open_jtalk_dic_utf_8-1.11
README.txt
check_not_exists_items: |
*directml*
*cuda*
*cudnn*
*onnxruntime*providers*
*eula*
*nvidia*
*cufft*
*curand*
- name: output先指定ダウンロード
os: ubuntu-latest
download_command: ./scripts/downloads/download.sh --output other_output
download_dir: other_output
check_items: |
libvoicevox_core.so
model/metas.json
open_jtalk_dic_utf_8-1.11
README.txt
check_not_exists_items: |
*directml*
*cuda*
*cudnn*
*onnxruntime*providers*
*eula*
*nvidia*
*cufft*
*curand*
- name: min option確認
os: ubuntu-latest
download_command: ./scripts/downloads/download.sh --min
download_dir: voicevox_core
check_items: |
libvoicevox_core.so
model/metas.json
README.txt
check_not_exists_items: |
*directml*
*cuda*
*cudnn*
*onnxruntime*providers*
*eula*
*nvidia*
*cufft*
*curand*
open_jtalk_dic_utf_8-1.11
- name: cuda option確認
os: ubuntu-latest
download_command: ./scripts/downloads/download.sh --device cuda
download_dir: voicevox_core
check_items: |
libvoicevox_core.so
model/metas.json
open_jtalk_dic_utf_8-1.11
README.txt
EULA.txt
NVIDIA_SLA_cuDNN_Support.txt
libcublas.so.*
libcublasLt.so.*
libcudnn.so.*
libcudnn_adv_infer.so.*
libcudnn_cnn_infer.so.*
libcudnn_ops_infer.so.*
libcufft.so.*
libcurand.so.*
check_not_exists_items: |
*directml*
- name: cudaかつmin option確認
os: ubuntu-latest
download_command: ./scripts/downloads/download.sh --device cuda --min
download_dir: voicevox_core
check_items: |
libvoicevox_core.so
model/metas.json
README.txt
check_not_exists_items: |
*directml*
EULA.txt
NVIDIA_SLA_cuDNN_Support.txt
libcublas.so.*
libcublasLt.so.*
libcudnn.so.*
libcudnn_adv_infer.so.*
libcudnn_cnn_infer.so.*
libcudnn_ops_infer.so.*
libcufft.so.*
libcurand.so.*
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
Loading

0 comments on commit 7f98938

Please sign in to comment.