Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[project-vvm-async-api] mainをマージする #536

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 78 additions & 29 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
name: build and deploy workflow

# 製品版もビルドできる。製品版ビルド時の違いは以下の3点
# 1. production環境を使う
# 2. 製品版リポジトリのコードをmergeする
# 3. RESOURCEリポジトリからモデルをダウンロードして置き換える

on:
workflow_dispatch:
inputs:
Expand All @@ -9,6 +15,12 @@ on:
description: "コード署名する"
type: boolean
required: false
default: false
is_production:
description: "製品版をビルドする"
type: boolean
required: false
default: false
release:
types:
- published
Expand All @@ -18,15 +30,17 @@ on:
- "*"
- "**/*"
env:
VOICEVOX_RESOURCE_VERSION: "0.15.0-preview.1"
VOICEVOX_FAT_RESOURCE_VERSION: "0.15.0-preview.0"
# releaseタグ名か、workflow_dispatchでのバージョン名か、'0.0.0'が入る
VERSION: ${{ github.event.release.tag_name || github.event.inputs.version || '0.0.0' }}

# Raw character weights are not public.
# Skip uploading to GitHub Release on public repo.
SKIP_UPLOADING_RELEASE_ASSET: ${{ secrets.SKIP_UPLOADING_RELEASE_ASSET || '1' }}
PRODUCTION_REPOSITORY_TAG: "0.15.0-preview.0" # 製品版のタグ名
defaults:
run:
shell: bash
jobs:
build_and_deploy:
environment: ${{ github.event.inputs.code_signing == 'true' && 'code_signing' || '' }} # コード署名用のenvironment
environment: ${{ github.event.inputs.is_production == 'true' && 'production' || '' }} # 製品版のenvironment
strategy:
matrix:
include:
Expand Down Expand Up @@ -111,7 +125,22 @@ jobs:
use_cuda: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3 # 製品版ではない場合
if: ${{ github.event.inputs.is_production != 'true' }}
- uses: actions/checkout@v3 # 製品版の場合
if: ${{ github.event.inputs.is_production == 'true' }}
with:
fetch-depth: 0 # 全履歴取得
token: ${{ secrets.PRODUCTION_GITHUB_TOKEN }}
- name: Merge production branch
if: github.event.inputs.is_production == 'true'
shell: bash
run: |
(
git remote add private ${{ secrets.PRODUCTION_REPOSITORY_URL }}
git fetch private refs/tags/${{ env.PRODUCTION_REPOSITORY_TAG }}
git -c user.name=dummy -c [email protected] merge FETCH_HEAD
) > /dev/null 2>&1
- name: Set up Python 3.8
if: matrix.whl_local_version
uses: actions/setup-python@v4
Expand All @@ -124,7 +153,6 @@ jobs:
targets: ${{ matrix.target }}
- name: Install cross compiler for aarch64-unknown-linux-gnu
if: matrix.target == 'aarch64-unknown-linux-gnu'
shell: bash
run: |
sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
Expand All @@ -134,40 +162,70 @@ jobs:
ndk-version: r25b
- name: Set path for android
if: endsWith(matrix.target, '-linux-android')
shell: bash
run: |
echo "$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin" >> "$GITHUB_PATH"
echo "AR_${{ matrix.target }}=llvm-ar" >> "$GITHUB_ENV"
- name: Checkout VOICEVOX RESOURCE
if: github.event.inputs.is_production == 'true'
uses: actions/checkout@v3
with:
repository: VOICEVOX/voicevox_resource
ref: ${{ env.VOICEVOX_RESOURCE_VERSION }}
path: download/resource
- name: Checkout VOICEVOX FAT RESOURCE
if: github.event.inputs.is_production == 'true'
uses: actions/checkout@v3
with:
repository: VOICEVOX/voicevox_fat_resource
ref: ${{ env.VOICEVOX_FAT_RESOURCE_VERSION }}
path: download/fat_resource
- name: Raplace resource
if: github.event.inputs.is_production == 'true'
shell: bash
run: |
mv -f download/resource/core/README.md ./README.md
rm -r ./model; mv download/fat_resource/core/model ./model
- name: Install cargo-binstall
uses: taiki-e/install-action@cargo-binstall
- name: Install cargo-edit
shell: bash
run: cargo binstall cargo-edit@^0.11 --no-confirm --log-level debug
- name: set cargo version
shell: bash
run: |
cargo set-version "$VERSION" --exclude voicevox_core_python_api --exclude download --exclude xtask
if ${{ !!matrix.whl_local_version }}; then cargo set-version "$VERSION+"${{ matrix.whl_local_version }} -p voicevox_core_python_api; fi
- name: build voicevox_core_c_api
run: cargo build -p voicevox_core_c_api -vv --features ${{ matrix.features }}, --target ${{ matrix.target }} --release
shell: bash
run: |
function build() {
cargo build -p voicevox_core_c_api -vv --features ${{ matrix.features }}, --target ${{ matrix.target }} --release
}
if ${{ github.event.inputs.is_production != 'true' }}; then
build
else
build > /dev/null 2>&1
fi
env:
RUSTFLAGS: -C panic=abort
ORT_USE_CUDA: ${{ matrix.use_cuda }}
- name: build voicevox_core_python_api
if: matrix.whl_local_version
id: build-voicevox-core-python-api
shell: bash
run: |
pip install -r ./crates/voicevox_core_python_api/requirements.txt
maturin build --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --features ${{ matrix.features }}, --target ${{ matrix.target }} --release
function build() {
maturin build --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --features ${{ matrix.features }}, --target ${{ matrix.target }} --release
}
if ${{ github.event.inputs.is_production != 'true' }}; then
build
else
build > /dev/null 2>&1
fi
echo "whl=$(find ./target/wheels -type f)" >> "$GITHUB_OUTPUT"
env:
ORT_USE_CUDA: ${{ matrix.use_cuda }}
- name: Set ASSET_NAME env var
shell: bash
run: echo "ASSET_NAME=voicevox_core-${{ matrix.artifact_name }}-${{ env.VERSION }}" >> "$GITHUB_ENV"
- name: Organize artifact
shell: bash
run: |
mkdir -p "artifact/${{ env.ASSET_NAME }}"
cp -v crates/voicevox_core_c_api/include/voicevox_core.h "artifact/${{ env.ASSET_NAME }}"
Expand All @@ -181,20 +239,18 @@ jobs:
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 }}/voicevox_core.dll"
env:
CERT_BASE64: ${{ secrets.CERT_BASE64 }}
CERT_PASSWORD: ${{ secrets.CERT_PASSWORD }}
- name: Upload artifact to build XCFramework
if: contains(matrix.target, 'ios')
if: contains(matrix.target, 'ios')
uses: actions/upload-artifact@v2
with:
name: voicevox_core-${{ matrix.target }}
path: artifact/${{ env.ASSET_NAME }}
- name: Archive artifact
shell: bash
run: |
cd artifact
7z a "../${{ env.ASSET_NAME }}.zip" "${{ env.ASSET_NAME }}"
Expand All @@ -208,7 +264,7 @@ jobs:
${{ env.ASSET_NAME }}.zip
target_commitish: ${{ github.sha }}
- name: Upload Python whl to Release
if: env.VERSION != '0.0.0' && env.SKIP_UPLOADING_RELEASE_ASSET == '0' && matrix.whl_local_version
if: env.VERSION != '0.0.0' && matrix.whl_local_version
uses: softprops/action-gh-release@v1
with:
prerelease: true
Expand All @@ -221,7 +277,6 @@ jobs:
runs-on: macos-12
steps:
- name: Set ASSET_NAME env var
shell: bash
run: echo "ASSET_NAME=voicevox_core-ios-xcframework-cpu-${{ env.VERSION }}" >> "$GITHUB_ENV"
- uses: actions/download-artifact@v2
with:
Expand All @@ -236,12 +291,10 @@ jobs:
name: voicevox_core-aarch64-apple-ios
path: artifact/voicevox_core-aarch64-apple-ios
- name: Create fat binary
shell: bash
run: |
mkdir -p "artifact/voicevox_core-sim"
lipo -create "artifact/voicevox_core-x86_64-apple-ios/libvoicevox_core.dylib" "artifact/voicevox_core-aarch64-apple-ios-sim/libvoicevox_core.dylib" -output "artifact/voicevox_core-sim/libvoicevox_core.dylib"
- name: Create XCFramework
shell: bash
run: |
mkdir -p "artifact/${{ env.ASSET_NAME }}"
xcodebuild -create-xcframework \
Expand All @@ -251,7 +304,6 @@ jobs:
-headers "artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h" \
-output "artifact/${{ env.ASSET_NAME }}/voicevox_core.xcframework"
- name: Archive artifact
shell: bash
run: |
cd artifact/${{ env.ASSET_NAME }}
7z a "../../${{ env.ASSET_NAME }}.zip" "voicevox_core.xcframework"
Expand All @@ -269,7 +321,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Upload to Release
if: env.VERSION != '0.0.0' && env.SKIP_UPLOADING_RELEASE_ASSET == '0'
if: env.VERSION != '0.0.0'
uses: softprops/action-gh-release@v1
with:
prerelease: true
Expand All @@ -278,7 +330,7 @@ jobs:
scripts/downloads/*
target_commitish: ${{ github.sha }}
deploy_precompiled_downloader:
environment: ${{ github.event.inputs.code_signing == 'true' && 'code_signing' || '' }} # コード署名用のenvironment
environment: ${{ github.event.inputs.is_production == 'true' && 'production' || '' }} # コード署名用のenvironment
strategy:
matrix:
include:
Expand All @@ -302,7 +354,6 @@ jobs:
- uses: actions/checkout@v3
- name: Install cross compiler for aarch64-unknown-linux-gnu
if: matrix.target == 'aarch64-unknown-linux-gnu'
shell: bash
run: |
sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
Expand All @@ -313,7 +364,6 @@ jobs:
- name: Build downloader
run: cargo build -vv --release -p download --target ${{ matrix.target }}
- name: Rename the binary
shell: bash
run: |
case "$OS" in
Windows) exe_suffix=.exe;;
Expand All @@ -322,14 +372,13 @@ jobs:
mv $"target/${{ matrix.target }}/release/download$exe_suffix" ./${{ matrix.name }}
- name: Code signing (Windows)
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 }}
- name: Upload to Release
if: env.VERSION != '0.0.0' && env.SKIP_UPLOADING_RELEASE_ASSET == '0'
if: env.VERSION != '0.0.0'
uses: softprops/action-gh-release@v1
with:
prerelease: true
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/cargo-deny.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: cargo-deny
on:
push:
pull_request:
defaults:
run:
shell: bash
jobs:
cargo-deny:
runs-on: ubuntu-20.04
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/download_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
- "crates/download/**"
- "scripts/downloads/*"
- ".github/workflows/download_test.yml"
defaults:
run:
shell: bash
jobs:
download-releases:
strategy:
Expand Down Expand Up @@ -296,18 +299,15 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get latest version
if: ${{ env.EXPECTED_VOICEVOX_CORE_VERSION == 'latest' }}
shell: bash
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
shell: bash
run: |
[ -e "${{ matrix.download_dir }}/VERSION" ]
[ "$(cat "${{ matrix.download_dir }}/VERSION")" = "${{ env.EXPECTED_VOICEVOX_CORE_VERSION }}" ]
- name: Check downloaded files
shell: bash
run: |
mapfile -t items < <(echo -n '${{ matrix.check_items }}')
for item in "${items[@]}"
Expand All @@ -317,7 +317,6 @@ jobs:
[ -e "${{ matrix.download_dir }}"/${item} ]
done
- name: Check should not exists files
shell: bash
run: |
mapfile -t items < <(echo -n '${{ matrix.check_not_exists_items }}')
for item in "${items[@]}"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/generate_document.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
branches:
- main
pull_request:
defaults:
run:
shell: bash
jobs:
generate_api_document:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Issue Labeler
on:
issues:
types: [opened]
defaults:
run:
shell: bash

jobs:
triage:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/psscriptanalyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
paths:
- '**.ps1'
- '.github/workflows/psscriptanalyzer.yml'
defaults:
run:
shell: bash
jobs:
psscriptanalyzer:
runs-on: ubuntu-22.04
Expand Down
Loading