Skip to content

build and deploy workflow #357

build and deploy workflow

build and deploy workflow #357

name: build and deploy workflow
# 製品版もビルドできる。製品版ビルド時の違いは以下の3点
# 1. production環境を使う
# 2. 製品版リポジトリのコードをmergeする
# 3. RESOURCEリポジトリからモデルをダウンロードして置き換える
on:
workflow_dispatch:
inputs:
version:
description: "バージョン情報(A.BB.C / A.BB.C-preview.D)"
required: true
code_signing:
description: "コード署名する"
type: boolean
required: false
default: false
is_production:
description: "製品版をビルドする"
type: boolean
required: false
default: false
release:
types:
- published
pull_request:
push:
env:
VOICEVOX_RESOURCE_VERSION: "0.15.0-preview.1"
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.2" # 製品版のタグ名
# 簡易テストとするかどうか。releaseとworkflow_dispatch以外は簡易テストとする
IS_SIMPLE_TEST: ${{ github.event_name != 'release' && github.event_name != 'workflow_dispatch' }}
defaults:
run:
shell: bash
jobs:
build_and_deploy_strategy_matrix: # 実行対象の条件をフィルタリングする
runs-on: ubuntu-latest
outputs:
includes: ${{ steps.strategy_matrix.outputs.includes }}
steps:
- name: declare strategy matrix
id: strategy_matrix
run: |
includes='[
{
"os": "windows-2019",
"features": "",
"target": "x86_64-pc-windows-msvc",
"artifact_name": "windows-x64-cpu",
"whl_local_version": "cpu",
"use_cuda": false,
"can_skip_in_simple_test": true
},
{
"os": "windows-2019",
"features": "directml",
"target": "x86_64-pc-windows-msvc",
"artifact_name": "windows-x64-directml",
"whl_local_version": "directml",
"use_cuda": false,
"can_skip_in_simple_test": false
},
{
"os": "windows-2019",
"features": "",
"target": "x86_64-pc-windows-msvc",
"artifact_name": "windows-x64-cuda",
"whl_local_version": "cuda",
"use_cuda": true,
"can_skip_in_simple_test": true
},
{
"os": "windows-2019",
"features": "",
"target": "i686-pc-windows-msvc",
"artifact_name": "windows-x86-cpu",
"whl_local_version": "cpu",
"use_cuda": false,
"can_skip_in_simple_test": true
},
{
"os": "ubuntu-20.04",
"features": "",
"target": "x86_64-unknown-linux-gnu",
"artifact_name": "linux-x64-cpu",
"whl_local_version": "cpu",
"use_cuda": false,
"can_skip_in_simple_test": true
},
{
"os": "ubuntu-20.04",
"features": "",
"target": "x86_64-unknown-linux-gnu",
"artifact_name": "linux-x64-gpu",
"whl_local_version": "cuda",
"use_cuda": true,
"can_skip_in_simple_test": false
},
{
"os": "ubuntu-20.04",
"features": "",
"target": "aarch64-unknown-linux-gnu",
"artifact_name": "linux-arm64-cpu",
"whl_local_version": "cpu",
"use_cuda": false,
"can_skip_in_simple_test": true
},
{
"os": "ubuntu-20.04",
"features": "",
"target": "aarch64-linux-android",
"artifact_name": "android-arm64-cpu",
"use_cuda": false,
"can_skip_in_simple_test": true
},
{
"os": "ubuntu-20.04",
"features": "",
"target": "x86_64-linux-android",
"artifact_name": "android-x86_64-cpu",
"use_cuda": false,
"can_skip_in_simple_test": true
},
{
"os": "macos-11",
"features": "",
"target": "aarch64-apple-darwin",
"artifact_name": "osx-arm64-cpu",
"whl_local_version": "cpu",
"use_cuda": false,
"can_skip_in_simple_test": false
},
{
"os": "macos-11",
"features": "",
"target": "x86_64-apple-darwin",
"artifact_name": "osx-x64-cpu",
"whl_local_version": "cpu",
"use_cuda": false,
"can_skip_in_simple_test": true
},
{
"os": "macos-12",
"features": "",
"target": "aarch64-apple-ios",
"artifact_name": "ios-arm64-cpu",
"use_cuda": false,
"can_skip_in_simple_test": true
},
{
"os": "macos-12",
"features": "",
"target": "aarch64-apple-ios-sim",
"artifact_name": "ios-arm64-cpu-sim",
"use_cuda": false,
"can_skip_in_simple_test": true
},
{
"os": "macos-12",
"features": "",
"target": "x86_64-apple-ios",
"artifact_name": "ios-x64-cpu",
"use_cuda": false,
"can_skip_in_simple_test": true
}
]'
# FIXME: composite action に切り出す
if ${{ env.IS_SIMPLE_TEST }}; then
includes=$(echo "$includes" | jq -c '[.[] | select(.can_skip_in_simple_test == false)]')
fi
includes=$(echo "$includes" | jq -c '[.[] | del(.can_skip_in_simple_test)]')
echo "includes=${includes}" >> "$GITHUB_OUTPUT"
build_and_deploy:
needs: build_and_deploy_strategy_matrix
environment: ${{ github.event.inputs.is_production == 'true' && 'production' || '' }} # 製品版のenvironment
strategy:
matrix:
include: ${{ fromJson(needs.build_and_deploy_strategy_matrix.outputs.includes) }}
runs-on: ${{ matrix.os }}
steps:
- 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
with:
python-version: "3.8"
architecture: ${{ contains(matrix.artifact_name,'x86') && 'x86' || 'x64' }}
- name: set up ${{ matrix.target }}
uses: ./.github/actions/rust-toolchain-from-file
with:
targets: ${{ matrix.target }}
- name: Install cross compiler for aarch64-unknown-linux-gnu
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- uses: nttld/setup-ndk@v1
if: endsWith(matrix.target, '-linux-android')
with:
ndk-version: r25b
- name: Set path for android
if: endsWith(matrix.target, '-linux-android')
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
run: cargo binstall cargo-edit@^0.11 --no-confirm --log-level debug
- name: set cargo version
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: cache target
uses: actions/cache@v3
with:
path: ./target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: build voicevox_core_c_api
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
run: |
pip install -r ./crates/voicevox_core_python_api/requirements.txt
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 | head -1)" >> "$GITHUB_OUTPUT"
env:
ORT_USE_CUDA: ${{ matrix.use_cuda }}
- name: build voicevox_core_java_api
id: build-voicevox-core-java-api
working-directory: ./crates/voicevox_core_java_api
run: |
function build() {
cargo build --features ${{ matrix.features }}, --target ${{ matrix.target }} --release
}
if ${{ github.event.inputs.is_production != 'true' }}; then
build
else
build > /dev/null 2>&1
fi
env:
ORT_USE_CUDA: ${{ matrix.use_cuda }}
- name: Set ASSET_NAME env var
run: echo "ASSET_NAME=voicevox_core-${{ matrix.artifact_name }}-${{ env.VERSION }}" >> "$GITHUB_ENV"
- name: Organize artifact
run: |
mkdir -p "artifact/${{ env.ASSET_NAME }}"
cp -v crates/voicevox_core_c_api/include/voicevox_core.h "artifact/${{ env.ASSET_NAME }}"
cp -v target/${{ matrix.target }}/release/*voicevox_core.{dll,so,dylib} "artifact/${{ env.ASSET_NAME }}" || true
cp -v target/${{ matrix.target }}/release/voicevox_core.dll.lib "artifact/${{ env.ASSET_NAME }}/voicevox_core.lib" || true
cp -v -n target/${{ matrix.target }}/release/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/*.{dll,so.*,so,dylib} "artifact/${{ env.ASSET_NAME }}" || true
# 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 }}/"
echo "${{ env.VERSION }}" > "artifact/${{ env.ASSET_NAME }}/VERSION"
case $RUNNER_OS
in
Linux)
JAVA_DLL_NAME="libvoicevox_core_java_api.so"
;;
macOS)
JAVA_DLL_NAME="libvoicevox_core_java_api.dylib"
;;
Windows)
JAVA_DLL_NAME="voicevox_core_java_api.dll"
;;
esac
echo "JAVA_DLL_NAME=${JAVA_DLL_NAME}" >> "$GITHUB_ENV"
- name: Code signing (Windows)
if: startsWith(matrix.os, 'windows') && github.event.inputs.code_signing == 'true'
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')
uses: actions/upload-artifact@v2
with:
name: voicevox_core-${{ matrix.target }}
path: artifact/${{ env.ASSET_NAME }}
- name: Upload artifact to build Java API
if: contains(matrix.target, 'ios') != true
uses: actions/upload-artifact@v3
with:
name: voicevox_core-java-${{ matrix.artifact_name }}
path: "target/${{ matrix.target }}/release/${{ env.JAVA_DLL_NAME }}"
- name: Archive artifact
run: |
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')
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: ${{ env.VERSION }}
files: |-
${{ env.ASSET_NAME }}.zip
target_commitish: ${{ github.sha }}
- name: Upload Python whl to Release
if: env.VERSION != '0.0.0' && matrix.whl_local_version
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: ${{ env.VERSION }}
files: |-
${{ steps.build-voicevox-core-python-api.outputs.whl }}
target_commitish: ${{ github.sha }}
build_xcframework:
if: ${{ !(github.event_name != 'release' && github.event_name != 'workflow_dispatch') }} # !env.IS_SIMPLE_TEST と同じ
needs: 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
with:
name: voicevox_core-x86_64-apple-ios
path: artifact/voicevox_core-x86_64-apple-ios
- uses: actions/download-artifact@v2
with:
name: voicevox_core-aarch64-apple-ios-sim
path: artifact/voicevox_core-aarch64-apple-ios-sim
- uses: actions/download-artifact@v2
with:
name: voicevox_core-aarch64-apple-ios
path: artifact/voicevox_core-aarch64-apple-ios
- name: Create fat binary
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
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 "Headers-sim" \
-library "artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib" \
-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'
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: ${{ env.VERSION }}
files: |-
${{ env.ASSET_NAME }}.zip
target_commitish: ${{ github.sha }}
build-java-api:
needs: build_and_deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Download artifact (windows-x64-cpu)"
uses: actions/download-artifact@v3
with:
name: voicevox_core-java-windows-x64-cpu
path: artifact/windows-x64-cpu
- name: "Download artifact (windows-x64-directml)"
uses: actions/download-artifact@v3
with:
name: voicevox_core-java-windows-x64-directml
path: artifact/windows-x64-directml
- name: "Download artifact (windows-x64-cuda)"
uses: actions/download-artifact@v3
with:
name: voicevox_core-java-windows-x64-cuda
path: artifact/windows-x64-cuda
- name: "Download artifact (windows-x86-cpu)"
uses: actions/download-artifact@v3
with:
name: voicevox_core-java-windows-x86-cpu
path: artifact/windows-x86-cpu
- name: "Download artifact (linux-x64-cpu)"
uses: actions/download-artifact@v3
with:
name: voicevox_core-java-linux-x64-cpu
path: artifact/linux-x64-cpu
- name: "Download artifact (linux-x64-gpu)"
uses: actions/download-artifact@v3
with:
name: voicevox_core-java-linux-x64-gpu
path: artifact/linux-x64-gpu
- name: "Download artifact (linux-arm64-cpu)"
uses: actions/download-artifact@v3
with:
name: voicevox_core-java-linux-arm64-cpu
path: artifact/linux-arm64-cpu
- name: "Download artifact (android-arm64-cpu)"
uses: actions/download-artifact@v3
with:
name: voicevox_core-java-android-arm64-cpu
path: artifact/android-arm64-cpu
- name: "Download artifact (android-x86_64-cpu)"
uses: actions/download-artifact@v3
with:
name: voicevox_core-java-android-x86_64-cpu
path: artifact/android-x86_64-cpu
- name: "Download artifact (osx-arm64-cpu)"
uses: actions/download-artifact@v3
with:
name: voicevox_core-java-osx-arm64-cpu
path: artifact/osx-arm64-cpu
- name: "Download artifact (osx-x64-cpu)"
uses: actions/download-artifact@v3
with:
name: voicevox_core-java-osx-x64-cpu
path: artifact/osx-x64-cpu
- name: Install cargo-binstall
uses: taiki-e/install-action@cargo-binstall
- name: Install cargo-edit
run: cargo binstall cargo-edit@^0.11 --no-confirm --log-level debug
- name: set cargo version
run: |
cargo set-version "$VERSION" --exclude voicevox_core_python_api --exclude download --exclude xtask
- name: set environment variables for directory
run: |
echo "JAVA_RESOURCES_DIR=$(realpath ./crates/voicevox_core_java_api/lib/src/main/resources)" >> "$GITHUB_ENV"
echo "ARTIFACT_DIR=$(realpath ./artifact)" >> "$GITHUB_ENV"
echo "ORT_DIR=$(realpath ./onnxruntime)" >> "$GITHUB_ENV"
- name: copy dlls
working-directory: crates/voicevox_core_java_api
run: |
mkdir "$JAVA_RESOURCES_DIR/dll/windows-x64"
mkdir "$JAVA_RESOURCES_DIR/dll/windows-x86"
mkdir "$JAVA_RESOURCES_DIR/dll/linux-x64"
mkdir "$JAVA_RESOURCES_DIR/dll/linux-arm64"
mkdir "$JAVA_RESOURCES_DIR/dll/osx-x64"
mkdir "$JAVA_RESOURCES_DIR/dll/osx-arm64"
mkdir "$JAVA_RESOURCES_DIR/jniLibs/arm64-v8a"
mkdir "$JAVA_RESOURCES_DIR/jniLibs/x86_64"
cp -v "$ARTIFACT_DIR/windows-x64-cpu/voicevox_core_java_api.dll" "$JAVA_RESOURCES_DIR/dll/windows-x64/voicevox_core_java_api.dll"
cp -v "$ARTIFACT_DIR/windows-x86-cpu/voicevox_core_java_api.dll" "$JAVA_RESOURCES_DIR/dll/windows-x86/voicevox_core_java_api.dll"
cp -v "$ARTIFACT_DIR/linux-x64-cpu/libvoicevox_core_java_api.so" "$JAVA_RESOURCES_DIR/dll/linux-x64/libvoicevox_core_java_api.so"
cp -v "$ARTIFACT_DIR/linux-arm64-cpu/libvoicevox_core_java_api.so" "$JAVA_RESOURCES_DIR/dll/linux-arm64/libvoicevox_core_java_api.so"
cp -v "$ARTIFACT_DIR/osx-x64-cpu/libvoicevox_core_java_api.dylib" "$JAVA_RESOURCES_DIR/dll/osx-x64/libvoicevox_core_java_api.dylib"
cp -v "$ARTIFACT_DIR/osx-arm64-cpu/libvoicevox_core_java_api.dylib" "$JAVA_RESOURCES_DIR/dll/osx-arm64/libvoicevox_core_java_api.dylib"
- name: copy onnxruntime
working-directory: crates/voicevox_core_java_api
run: |
curl -LfO https://github.com/microsoft/onnxruntime/releases/download/v1.14.0/onnxruntime-win-x64-1.14.0.zip
curl -LfO https://github.com/microsoft/onnxruntime/releases/download/v1.14.0/onnxruntime-win-x86-1.14.0.zip
curl -LfO https://github.com/microsoft/onnxruntime/releases/download/v1.14.0/onnxruntime-linux-aarch64-1.14.0.tgz
curl -LfO https://github.com/microsoft/onnxruntime/releases/download/v1.14.0/onnxruntime-linux-x64-1.14.0.tgz
curl -LfO https://github.com/microsoft/onnxruntime/releases/download/v1.14.0/onnxruntime-osx-arm64-1.14.0.tgz
curl -LfO https://github.com/microsoft/onnxruntime/releases/download/v1.14.0/onnxruntime-osx-x86_64-1.14.0.tgz
curl -LfO https://github.com/microsoft/onnxruntime/releases/download/v1.14.0/onnxruntime-win-x64-gpu-1.14.0.zip
curl -LfO https://github.com/microsoft/onnxruntime/releases/download/v1.14.0/onnxruntime-linux-x64-gpu-1.14.0.tgz
unzip -o onnxruntime-win-x64-1.14.0.zip -d "$ORT_DIR/"
unzip -o onnxruntime-win-x86-1.14.0.zip -d "$ORT_DIR/"
tar -xf onnxruntime-linux-aarch64-1.14.0.tgz -C "$ORT_DIR/"
tar -xf onnxruntime-linux-x64-1.14.0.tgz -C "$ORT_DIR/"
tar -xf onnxruntime-osx-arm64-1.14.0.tgz -C "$ORT_DIR/"
tar -xf onnxruntime-osx-x86_64-1.14.0.tgz -C "$ORT_DIR/"
unzip -o onnxruntime-win-x64-gpu-1.14.0.zip -d "$ORT_DIR/"
tar -xf onnxruntime-linux-x64-gpu-1.14.0.tgz -C "$ORT_DIR/"
cp -v "$ORT_DIR/onnxruntime-win-x64-1.14.0/lib/onnxruntime.dll" "$JAVA_RESOURCES_DIR/dll/windows-x64/onnxruntime.dll"
cp -v "$ORT_DIR/onnxruntime-win-x86-1.14.0/lib/onnxruntime.dll" "$JAVA_RESOURCES_DIR/dll/windows-x86/onnxruntime.dll"
cp -v "$ORT_DIR/onnxruntime-linux-aarch64-1.14.0/lib/libonnxruntime.so.1.14.0" "$JAVA_RESOURCES_DIR/dll/linux-arm64/libonnxruntime.so"
cp -v "$ORT_DIR/onnxruntime-linux-x64-1.14.0/lib/libonnxruntime.so.1.14.0" "$JAVA_RESOURCES_DIR/dll/linux-x64/libonnxruntime.so"
cp -v "$ORT_DIR/onnxruntime-osx-arm64-1.14.0/lib/libonnxruntime.1.14.0.dylib" "$JAVA_RESOURCES_DIR/dll/osx-arm64/libonnxruntime.dylib"
cp -v "$ORT_DIR/onnxruntime-osx-x86_64-1.14.0/lib/libonnxruntime.1.14.0.dylib" "$JAVA_RESOURCES_DIR/dll/osx-x64/libonnxruntime.dylib"
- name: build cpu version
working-directory: crates/voicevox_core_java_api
run: |
./gradlew build --info -x test
mkdir -p "../../build"
cp ./lib/build/libs/lib-*.jar ../../build/voicevox_core_java_api-$VERSION-cpu.jar
- name: build directml version
working-directory: crates/voicevox_core_java_api
run: |
cp -v "$ARTIFACT_DIR/windows-x64-directml/voicevox_core_java_api.dll" "$JAVA_RESOURCES_DIR/dll/windows-x64/voicevox_core_java_api.dll"
./gradlew build --info -x test
cp ./lib/build/libs/lib-*.jar ../../build/voicevox_core_java_api-$VERSION-directml.jar
- name: build cuda version
working-directory: crates/voicevox_core_java_api
run: |
cp -v "$ARTIFACT_DIR/windows-x64-cuda/voicevox_core_java_api.dll" "$JAVA_RESOURCES_DIR/dll/windows-x64/voicevox_core_java_api.dll"
cp -v "$ARTIFACT_DIR/linux-x64-gpu/libvoicevox_core_java_api.so" "$JAVA_RESOURCES_DIR/dll/linux-x64/libvoicevox_core_java_api.so"
cp -v "$ORT_DIR/onnxruntime-win-x64-gpu-1.14.0/lib/onnxruntime_providers_shared.dll" "$JAVA_RESOURCES_DIR/dll/windows-x64/onnxruntime_providers_shared.dll"
cp -v "$ORT_DIR/onnxruntime-win-x64-gpu-1.14.0/lib/onnxruntime_providers_cuda.dll" "$JAVA_RESOURCES_DIR/dll/windows-x64/onnxruntime_providers_cuda.dll"
cp -v "$ORT_DIR/onnxruntime-linux-x64-gpu-1.14.0/lib/libonnxruntime_providers_shared.so" "$JAVA_RESOURCES_DIR/dll/linux-x64/libonnxruntime_providers_shared.so"
cp -v "$ORT_DIR/onnxruntime-linux-x64-gpu-1.14.0/lib/libonnxruntime_providers_cuda.so" "$JAVA_RESOURCES_DIR/dll/linux-x64/libonnxruntime_providers_cuda.so"
./gradlew build --info -x test
cp ./lib/build/libs/lib-*.jar ../../build/voicevox_core_java_api-$VERSION-cuda.jar
- name: build android version
working-directory: crates/voicevox_core_java_api
run: |
rm -rf "$JAVA_RESOURCES_DIR/dll"
cp -v "$ARTIFACT_DIR/android-arm64-cpu/libvoicevox_core_java_api.so" "$JAVA_RESOURCES_DIR/jniLibs/arm64-v8a/libvoicevox_core_java_api.so"
cp -v "$ARTIFACT_DIR/android-x86_64-cpu/libvoicevox_core_java_api.so" "$JAVA_RESOURCES_DIR/jniLibs/x86_64/libvoicevox_core_java_api.so"
./gradlew build --info -x test
cp ./lib/build/libs/lib-*.jar ../../build/voicevox_core_java_api-$VERSION-android.jar
- name: Upload to Release
if: env.VERSION != '0.0.0' && env.SKIP_UPLOADING_RELEASE_ASSET == '0'
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: ${{ env.VERSION }}
files: ./build/*.jar
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 }}