Skip to content

Build Java Package

Build Java Package #7

Workflow file for this run

name: Build Java Package
on:
workflow_dispatch:
jobs:
macos:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: aarch64-apple-darwin
- name: Build
run: |
cargo build --target x86_64-apple-darwin --package feathr_piper_jni --release
cargo build --target aarch64-apple-darwin --package feathr_piper_jni --release
mv target/x86_64-apple-darwin/release/libfeathr_piper_jni.dylib libfeathr_piper_jni_osx_amd64.dylib
mv target/aarch64-apple-darwin/release/libfeathr_piper_jni.dylib libfeathr_piper_jni_osx_aarch64.dylib
- uses: actions/upload-artifact@v3
with:
name: macos-jni
retention-days: 1
path: |
libfeathr_piper_jni_osx_amd64.dylib
libfeathr_piper_jni_osx_aarch64.dylib
linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: x86_64-pc-windows-gnu
- name: Install MinGW64
run: sudo apt-get -y update && sudo apt-get install -y gcc-mingw-w64
- name: Build
run: |
cargo build --target x86_64-unknown-linux-gnu --package feathr_piper_jni --release
cargo build --target x86_64-pc-windows-gnu --package feathr_piper_jni --release
mv target/x86_64-unknown-linux-gnu/release/libfeathr_piper_jni.so libfeathr_piper_jni_linux_amd64.so
mv target/x86_64-pc-windows-gnu/release/feathr_piper_jni.dll feathr_piper_jni_windows_amd64.dll
- uses: actions/upload-artifact@v3
with:
name: linux-jni
retention-days: 1
path: |
libfeathr_piper_jni_linux_amd64.so
feathr_piper_jni_windows_amd64.dll
jar:
runs-on: ubuntu-latest
needs: [ macos, linux ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup
uses: actions/setup-java@v3
with:
distribution: 'liberica' # See 'Supported distributions' for available options
java-version: '8'
- name: Download MacOS JNI libs
uses: actions/download-artifact@v3
with:
name: macos-jni
path: java/feathrpiper/src/main/resources/native
- name: Download Linux JNI libs
uses: actions/download-artifact@v3
with:
name: linux-jni
path: java/feathrpiper/src/main/resources/native
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd java; ./gradlew publish