Skip to content

Commit

Permalink
Add: Java APIを作成 (#558)
Browse files Browse the repository at this point in the history
Co-authored-by: Ryo Yamashita <[email protected]>
Co-authored-by: qryxip <[email protected]>
Co-authored-by: Hiroshiba <[email protected]>
Co-authored-by: Hiroshiba <[email protected]>
  • Loading branch information
5 people authored Aug 30, 2023
1 parent aa41c46 commit 46218d9
Show file tree
Hide file tree
Showing 38 changed files with 3,046 additions and 35 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/generate_document.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Setup Java
uses: actions/setup-java@v2
with:
java-version: "11"
distribution: "adopt"
- name: Install cargo-binstall
uses: taiki-e/install-action@cargo-binstall
- name: Create a venv
Expand All @@ -42,8 +47,14 @@ jobs:
maturin develop --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --locked
- name: Generate Sphinx document
run: sphinx-build docs/apis/python_api public/apis/python_api
- name: Generate Javadoc
run: |
(cd crates/voicevox_core_java_api && ./gradlew javadoc)
mkdir -p public/apis/java_api
cp -r crates/voicevox_core_java_api/lib/build/docs/javadoc/* public/apis/java_api
- name: Uplaod api document
uses: actions/upload-pages-artifact@v1
if: ${{ github.ref_name == 'main' }}
with:
path: public
deploy_api_github_pages:
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,51 @@ jobs:
pip install -r requirements-test.txt
pytest
build-and-test-java-api:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
- os: macos-latest
- os: ubuntu-latest
runs-on: ${{ matrix.os }}
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: "11"
distribution: "adopt"
- name: Build
run: |
cargo build -p voicevox_core_java_api -vv
cargo build -p test_util -vv
- name: 必要なDLLをコピーしてテストを実行
working-directory: crates/voicevox_core_java_api
run: |
OS=$(tr '[:upper:]' '[:lower:]' <<<"$RUNNER_OS")
ARCH=$(tr '[:upper:]' '[:lower:]' <<<"$RUNNER_ARCH")
case "$RUNNER_OS" in
Windows)
DLL_NAME="voicevox_core_java_api.dll"
;;
macOS)
DLL_NAME="libvoicevox_core_java_api.dylib"
;;
Linux)
DLL_NAME="libvoicevox_core_java_api.so"
;;
*)
echo "Unsupported OS: $RUNNER_OS"
exit 1
;;
esac
TARGET_NAME="$OS-$ARCH"
mkdir -p "./lib/src/main/resources/dll/$TARGET_NAME"
cp -v "../../target/debug/$DLL_NAME" "./lib/src/main/resources/dll/$TARGET_NAME/$DLL_NAME"
echo "target = $TARGET_NAME, dll = $DLL_NAME"
./gradlew test --info
Loading

0 comments on commit 46218d9

Please sign in to comment.