-
Notifications
You must be signed in to change notification settings - Fork 119
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
このリポジトリで製品ビルドを可能にする #527
Merged
The head ref may contain hidden characters: "\u88FD\u54C1\u30D3\u30EB\u30C9\u3092\u53EF\u80FD\u306B\u3059\u308B"
Merged
このリポジトリで製品ビルドを可能にする #527
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d26fd22
is_productionに変更、UPLOADフラグを消去
Hiroshiba b271b60
READMEとMODELを置き換え
Hiroshiba d978b66
privをmergeしてビルドできる
Hiroshiba d78524e
to code_signing
Hiroshiba 75f0211
a
Hiroshiba 8dec50e
shell: bash
Hiroshiba c230ec5
コメント追加
Hiroshiba 317b75e
Merge remote-tracking branch 'upstream/main' into 製品ビルドを可能にする
Hiroshiba 2c439ca
error-tag
Hiroshiba d3a1148
戻す
Hiroshiba 74c8833
タグ情報を更新
Hiroshiba 2872279
is_production入れ替え
Hiroshiba 45a9682
Update .github/workflows/build_and_deploy.yml
Hiroshiba baf0fe0
スマートに
Hiroshiba e39f9d6
github.event.inputs.is_production != 'true'
Hiroshiba f6a46ab
Merge branch 'main' into 製品ビルドを可能にする
Hiroshiba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
|
@@ -9,6 +15,12 @@ on: | |
description: "コード署名する" | ||
type: boolean | ||
required: false | ||
default: false | ||
is_production: | ||
description: "製品版をビルドする" | ||
type: boolean | ||
required: false | ||
default: false | ||
release: | ||
types: | ||
- published | ||
|
@@ -18,15 +30,14 @@ 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" # 製品版のタグ名 | ||
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: | ||
|
@@ -111,7 +122,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 | ||
|
@@ -138,6 +164,26 @@ jobs: | |
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 | ||
|
@@ -149,7 +195,13 @@ jobs: | |
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: | | ||
if [[ "${{ github.event.inputs.is_production }}" != "true" ]]; then | ||
cargo build -p voicevox_core_c_api -vv --features ${{ matrix.features }}, --target ${{ matrix.target }} --release | ||
else | ||
cargo build -p voicevox_core_c_api -vv --features ${{ matrix.features }}, --target ${{ matrix.target }} --release > /dev/null 2>&1 | ||
fi | ||
Hiroshiba marked this conversation as resolved.
Show resolved
Hide resolved
|
||
env: | ||
RUSTFLAGS: -C panic=abort | ||
ORT_USE_CUDA: ${{ matrix.use_cuda }} | ||
|
@@ -159,7 +211,11 @@ jobs: | |
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 | ||
if [[ "${{ github.event.inputs.is_production }}" != "true" ]]; then | ||
maturin build --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --features ${{ matrix.features }}, --target ${{ matrix.target }} --release | ||
else | ||
maturin build --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --features ${{ matrix.features }}, --target ${{ matrix.target }} --release > /dev/null 2>&1 | ||
fi | ||
echo "whl=$(find ./target/wheels -type f)" >> "$GITHUB_OUTPUT" | ||
env: | ||
ORT_USE_CUDA: ${{ matrix.use_cuda }} | ||
|
@@ -188,7 +244,7 @@ jobs: | |
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 }} | ||
|
@@ -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 | ||
|
@@ -269,7 +325,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 | ||
|
@@ -278,7 +334,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' && 'code_signing' || '' }} # コード署名用のenvironment | ||
Hiroshiba marked this conversation as resolved.
Show resolved
Hide resolved
|
||
strategy: | ||
matrix: | ||
include: | ||
|
@@ -329,7 +385,7 @@ jobs: | |
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 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OSS版バイナリに署名することはないので二つのboolパラメータを統合して三値にした方がいいのではないかと思ったのですが、
code_signing
はもうcodesign.bashを実行するか否かに使われていないので、OSS版バイナリに署名しても事故ではないのならcode_signing
とis_production
は排反でもいいと思います。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ちょっと僕が勘違いしてるかもなのですが、
code_signing
引数でcodesign.bashを実行するかどうか制御してます。https://github.com/Hiroshiba/voicevox_core/blob/45a9682b8d59fc99a634b2f27af516f7ba885d92/.github/workflows/build_and_deploy.yml#L239
production environmentを使うかどうかは
production
引数で制御してます。production environmentを使うけど、コード署名はしない(実験版リリース)というケースを想定してます。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
気になったのは
is_production && !code_signing
のケースでした。ダミー音声版を署名したい場合があるのかなと思った次第です。ただcodesign.bash自体がActions上で動くかどうかを確かめたいというケースはありそうですね...is_production
code_signing
false
true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
署名するテストをしたいときは、今まで通りenvironmentを使わずにsecretsを設定すれば可能です。
(environmentはsecretsのサブセットを持っているだけ)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なるほどこの状態でもできるんですね。
(↑の表の
is_production
、上下逆でした... あとis_production && !code_signing
じゃなくて!is_production && code_signing
...)