Skip to content

Commit

Permalink
Provide prebuilt .jar files for different java versions. (k2-fsa#1307)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Aug 30, 2024
1 parent 3687c9f commit d60a4d4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
35 changes: 30 additions & 5 deletions .github/workflows/linux-jni.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,27 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
java-version: ['8', '11', '16', '17', '21']

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: ${{ matrix.java-version }}

- name: Display PWD
shell: bash
run: |
echo "pwd: $PWD"
ls -lh
du -h -d1 .
- name: Build jar
- name: Build jar ${{ matrix.java-version }}
if: matrix.java-version == '21'
shell: bash
run: |
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
Expand All @@ -44,9 +51,20 @@ jobs:
cd ../..
ls -lh *.jar
- name: Build jar ${{ matrix.java-version }}
shell: bash
run: |
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
cd sherpa-onnx/java-api
make
ls -lh build/
cp build/sherpa-onnx.jar ../../sherpa-onnx-$SHERPA_ONNX_VERSION-java${{ matrix.java-version }}.jar
cd ../..
ls -lh *.jar
- uses: actions/upload-artifact@v4
with:
name: release-jni-linux-jar
name: release-jni-linux-jar-${{ matrix.java-version }}
path: ./*.jar

- name: Release jar
Expand All @@ -56,8 +74,12 @@ jobs:
file_glob: true
overwrite: true
file: ./*.jar
# repo_name: k2-fsa/sherpa-onnx
# repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
# tag: v1.10.23

- name: Build sherpa-onnx
if: matrix.java-version == '21'
uses: addnab/docker-run-action@v3
with:
image: quay.io/pypa/manylinux2014_x86_64
Expand Down Expand Up @@ -122,6 +144,7 @@ jobs:
ls -lh install/bin
- name: Display dependencies of sherpa-onnx for linux
if: matrix.java-version == '21'
shell: bash
run: |
du -h -d1 .
Expand All @@ -140,11 +163,13 @@ jobs:
readelf -d build/bin/sherpa-onnx
- uses: actions/upload-artifact@v4
if: matrix.java-version == '21'
with:
name: release-jni-linux
name: release-jni-linux-${{ matrix.java-version }}
path: build/install/*

- name: Copy files
if: matrix.java-version == '21'
shell: bash
run: |
du -h -d1 .
Expand All @@ -163,7 +188,7 @@ jobs:
du -h -d1 .
- name: Publish to huggingface
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && matrix.java-version == '21'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v3
Expand Down Expand Up @@ -195,7 +220,7 @@ jobs:
git push https://csukuangfj:[email protected]/csukuangfj/sherpa-onnx-libs main
- name: Release pre-compiled binaries and libs for linux x64
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/') && matrix.java-version == '21'
uses: svenstaro/upload-release-action@v2
with:
file_glob: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wasm-simd-hf-space-vad-asr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
run: |
./run-vad-asr.sh
- name: Release jar
- name: Release
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
Expand Down

0 comments on commit d60a4d4

Please sign in to comment.