Skip to content

Commit

Permalink
Refactor Java API (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Apr 24, 2024
1 parent c769165 commit c3a2e8a
Show file tree
Hide file tree
Showing 42 changed files with 1,004 additions and 964 deletions.
50 changes: 48 additions & 2 deletions .github/workflows/run-java-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- 'java-api-examples/**'
- 'sherpa-onnx/csrc/*'
- 'sherpa-onnx/jni/*'
- 'sherpa-onnx/java-api/**'
pull_request:
branches:
- master
Expand All @@ -21,6 +22,7 @@ on:
- 'java-api-examples/**'
- 'sherpa-onnx/csrc/*'
- 'sherpa-onnx/jni/*'
- 'sherpa-onnx/java-api/**'
workflow_dispatch:

concurrency:
Expand All @@ -46,14 +48,50 @@ jobs:
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}
key: ${{ matrix.os }}-java

- name: Display java version
shell: bash
run: |
java -version
echo "JAVA_HOME is: ${JAVA_HOME}"
cmake --version
- name: Build sherpa-onnx (jar)
shell: bash
run: |
cd sherpa-onnx/java-api/
make
ls -lh
- uses: actions/upload-artifact@v4
with:
name: sherpa-onnx-jar-${{ matrix.os }}
path: sherpa-onnx/java-api/build

- name: Build sherpa-onnx (C++)
shell: bash
run: |
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
mkdir build
cd build
cmake \
-DSHERPA_ONNX_ENABLE_PYTHON=OFF \
-DSHERPA_ONNX_ENABLE_TESTS=OFF \
-DSHERPA_ONNX_ENABLE_CHECK=OFF \
-DBUILD_SHARED_LIBS=ON \
-DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \
-DSHERPA_ONNX_ENABLE_BINARY=OFF \
-DSHERPA_ONNX_ENABLE_JNI=ON \
..
make -j4
ls -lh lib
- name: Run java test
shell: bash
run: |
Expand All @@ -62,4 +100,12 @@ jobs:
cmake --version
cd ./java-api-examples
./runtest.sh
./run-streaming-decode-file-ctc.sh
# Delete model files to save space
rm -rf sherpa-onnx-streaming-*
./run-streaming-decode-file-paraformer.sh
rm -rf sherpa-onnx-streaming-*
./run-streaming-decode-file-transducer.sh
rm -rf sherpa-onnx-streaming-*
6 changes: 3 additions & 3 deletions .github/workflows/test-build-wheel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ jobs:
- os: macos-14
python-version: "3.12"

- os: windows-2019
- os: windows-2022
python-version: "3.7"
- os: windows-2019
- os: windows-2022
python-version: "3.8"
- os: windows-2019
- os: windows-2022
python-version: "3.9"

- os: windows-2022
Expand Down
1 change: 1 addition & 0 deletions java-api-examples/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
lib
hs_err*
!run-streaming*.sh
101 changes: 0 additions & 101 deletions java-api-examples/Makefile

This file was deleted.

Loading

0 comments on commit c3a2e8a

Please sign in to comment.