-
Notifications
You must be signed in to change notification settings - Fork 117
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
Java API:ビルドWorkflowを追加 #621
Java API:ビルドWorkflowを追加 #621
Conversation
[skip ci]
[skip ci]
[skip ci]
[skip ci]
[skip ci]
[skip ci]
[skip ci]
[skip ci]
[skip ci]
[skip ci]
[skip ci]
[skip ci]
[skip ci]
[skip ci]
- name: Set up Java | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: "17" |
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.
Android Gradle Pluginは17以上じゃないと動かなかったので。
- name: set cargo version | ||
run: | | ||
cargo set-version "$VERSION" --exclude voicevox_core_python_api --exclude download --exclude xtask | ||
- name: "Download artifact (windows-x64-cpu)" |
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.
かなり混沌としてるので何とかしたい(何とかできなさそうな感じはする)
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.
github cli使ってダウンロードするところからgradle叩くところまでをシェルスクリプトにして実行、とかですかねぇ 😇
(本当はこっちのほうがローカルでも動かせるので良い)
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.
github cliは実行中のArtifactを落とせないっぽみがありました(記憶違いかも)
cp -v "artifact/$artifact_name"/* "crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/${target}/" | ||
done | ||
|
||
cp ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/arm64-v8a/ |
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.
stdc++_shared.soがないとロード時にクラッシュするので。
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.
正直なところ、ちょっと需要に対してメンテコード大きすぎそうだな〜と感じました。。
2〜30行くらいなら良いのですが、250行は・・・。
とりあえず需要がわかっている(自分たちで使いたい)android版だけ作っといて、それ以外は実際にニーズが現れてから考えるのでも遅くないかも・・・?
(あるいは+windowsのdirectml版だけとか)
ls -l ./target/wheels | ||
echo "whl=$(find ./target/wheels -type f | head -1)" >> "$GITHUB_OUTPUT" |
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.
これなんで必要になった感じでしょう 👀
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.
分からないですね…なぜか落ちるようになりました
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.
もしかしたらキャッシュが原因かなと思いました。やっぱキャッシュむずい!!!!!!!!!!!!!
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.
あー!その可能性はありますね
上でrm -rf ./target/wheels/*を走らせれば直りはするでしょうが、まぁ怖くなってきました
- name: cache target | ||
uses: actions/cache@v3 | ||
if: github.event.inputs.is_production != 'true' | ||
with: | ||
path: | | ||
~/.cargo | ||
target | ||
key: ${{ matrix.artifact_name }}-rust-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ matrix.artifact_name }}-rust- |
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.
結構早くなる感じでしょうか?
(キャッシュ、すぐバグにつながる印象があるのでちょっと避けたいなという思いがあります 😇 )
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.
5分くらいですね。
ビルドにスピードが求められるのはWorkflowテストくらいなので製品版ビルドでは無効化しています
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.
なるほどです、確かに5分短縮は嬉しいのですが・・・。
キャッシュのキーってこのリポジトリ全てで共通なグローバル変数で、かつ未来方向と過去方向にもちゃんと一意になっているかを意識し続けないといけないため、相当気を使うんですよね・・・。
これ以降のコードがキャッシュファイルがあることを想定して書く必要もあり、かつそうなっていない気がするので、できれば避けたい気持ちがあります。
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.
https://github.com/Swatinem/rust-cacheではなくactions/cache
を使っている理由はあったりしますでしょうか?
(キーとしてはCargo.lock以外にもrust-toolchainだったりあるかなと思った次第で、rust-cacheはそれも含んでくれます)
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.
ないですね、そっちにしてみました。(まぁキャッシュ自体を消す可能性もありますが)
[skip ci]
[skip ci]
[skip ci]
Android版だけにしました。 |
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.
一点だけ!
Co-authored-by: Ryo Yamashita <[email protected]>
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.
LGTM!
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.
ほぼLGTMです!!
レビューを反映しました。 |
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.
LGTM!!
すみません見落とし1箇所だけコメントしました!
意図的でしたらそのままマージしていただければ。
マージします。 |
内容
Java APIをビルドするWorkflowを追加します。
publishToMavenLocalした後に
~/.m2/repository/
をzip圧縮しています。https://github.com/sevenc-nanashi/vv_core_registry/blob/c874a9569934d8442160353b6a2422fc4870cd5b/inject.ts#L166 こんな感じのスクリプトを書けば配信できます。
関連 Issue
その他
サンプルビルド: https://github.com/sevenc-nanashi/voicevox_core/releases/tag/0.15.0-preview.java-workflow.3