diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 1994a34e0..32cb43a00 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -257,6 +257,9 @@ jobs: 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: Swatinem/rust-cache@v2 + if: github.event.inputs.is_production != 'true' - name: build voicevox_core_c_api shell: bash run: | @@ -275,6 +278,7 @@ jobs: if: matrix.whl_local_version id: build-voicevox-core-python-api run: | + rm -rf ./target/wheels 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 @@ -287,6 +291,17 @@ jobs: echo "whl=$(find ./target/wheels -type f)" >> "$GITHUB_OUTPUT" env: ORT_USE_CUDA: ${{ matrix.use_cuda }} + - name: build voicevox_core_java_api + if: "contains(matrix.target, 'android')" + run: | + function build() { + cargo build -p voicevox_core_java_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 - name: Set ASSET_NAME env var run: echo "ASSET_NAME=voicevox_core-${{ matrix.artifact_name }}-${{ env.VERSION }}" >> "$GITHUB_ENV" - name: Organize artifact @@ -301,6 +316,9 @@ jobs: 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" + + mkdir java_artifact + cp -v target/${{ matrix.target }}/release/libvoicevox_core_java_api.so java_artifact/ || true - name: Code signing (Windows) if: startsWith(matrix.os, 'windows') && github.event.inputs.code_signing == 'true' run: | @@ -310,7 +328,7 @@ jobs: CERT_PASSWORD: ${{ secrets.CERT_PASSWORD }} - name: Upload artifact to build XCFramework if: contains(matrix.target, 'ios') - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: voicevox_core-${{ matrix.target }} path: artifact/${{ env.ASSET_NAME }} @@ -336,6 +354,12 @@ jobs: files: |- ${{ steps.build-voicevox-core-python-api.outputs.whl }} target_commitish: ${{ github.sha }} + - name: Upload voicevox_core_java_api artifact + if: env.VERSION != '0.0.0' && contains(matrix.target, 'android') + uses: actions/upload-artifact@v3 + with: + name: voicevox_core_java_api-${{ matrix.artifact_name }} + path: java_artifact build_xcframework: if: ${{ !(github.event_name != 'release' && github.event_name != 'workflow_dispatch') }} # !env.IS_SIMPLE_TEST と同じ @@ -391,6 +415,81 @@ jobs: ${{ env.ASSET_NAME }}.zip target_commitish: ${{ github.sha }} + build_java_package: + runs-on: ubuntu-latest + if: ${{ !(github.event_name != 'release' && github.event_name != 'workflow_dispatch') }} # !env.IS_SIMPLE_TEST と同じ + needs: + - build_and_deploy + steps: + - uses: actions/checkout@v3 + - name: Set up Rust + uses: ./.github/actions/rust-toolchain-from-file + - name: Set up Java + uses: actions/setup-java@v2 + with: + java-version: "17" + distribution: "adopt" + - uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r25b + - name: Install cargo-binstall + uses: taiki-e/install-action@cargo-binstall + - name: Install cargo-edit + run: cargo binstall cargo-edit@^0.11 --no-confirm + - name: set cargo version + run: | + cargo set-version "$VERSION" -p voicevox_core_java_api + + - name: "Download artifact (android-arm64-cpu)" + uses: actions/download-artifact@v3 + with: + name: voicevox_core_java_api-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_api-android-x86_64-cpu + path: artifact/android-x86_64-cpu + + - name: Print tree + run: tree artifact + + - name: Build voicevoxcore-android + run: | + rm -rf crates/voicevox_core_java_api/lib/src/main/resources/dll + cat <