[WIP] feat(java): enable java build #39
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and publish Java packages | |
on: | |
release: | |
types: [released] | |
pull_request: | |
paths: | |
- .github/workflows/java-publish.yml | |
jobs: | |
macos-arm64: | |
name: Build on MacOS Arm64 | |
runs-on: macos-14 | |
timeout-minutes: 30 | |
defaults: | |
run: | |
working-directory: ./java | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Set up Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: | | |
brew install protobuf | |
- name: Build release | |
run: | | |
cargo build --release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: liblance_jni_darwin_aarch64.zip | |
path: target/release/liblance_jni.dylib | |
retention-days: 1 | |
if-no-files-found: error | |
linux-arm64: | |
name: Build on Linux Arm64 | |
runs-on: warp-ubuntu-2204-x64-8x | |
timeout-minutes: 30 | |
defaults: | |
run: | |
working-directory: ./java | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: rust | |
- name: Set up Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: "1.79.0" | |
cache-workspaces: "src/rust" | |
# Disable full debug symbol generation to speed up CI build and keep memory down | |
# "1" means line tables only, which is useful for panic tracebacks. | |
rustflags: "-C debuginfo=1" | |
components: "rustfmt,clippy" | |
- name: Install dependencies | |
run: | | |
sudo apt -y -qq update | |
sudo apt install -y protobuf-compiler libssl-dev pkg-config | |
- name: Build release | |
run: | | |
cargo build --release | |
cp ../target/release/liblance_jni.so liblance_jni.so | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: liblance_jni_linux_aarch64.zip | |
path: target/release/liblance_jni.so | |
retention-days: 1 | |
if-no-files-found: error | |
linux-x86: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
needs: [macos-arm64, linux-arm64] | |
defaults: | |
run: | |
working-directory: ./java | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Set up Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- name: Set up Java 8 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 8 | |
cache: "maven" | |
server-id: ossrh | |
server-username: ${{ secrets.SONATYPE_USER }} | |
server-password: ${{ secrets.SONATYPE_TOKEN }} | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y protobuf-compiler libssl-dev | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
- name: Copy native libs | |
run: | | |
mkdir -p ./core/src/main/resources/nativelib/darwin-aarch64 ./core/src/main/resources/nativelib/linux-aarch64 | |
cp ../liblance_jni_darwin_aarch64.zip/liblance_jni.dylib ./core/src/main/resources/nativelib/darwin-aarch64/liblance_jni.dylib | |
cp ../liblance_jni_linux_aarch64.zip/liblance_jni.so ./core/src/main/resources/nativelib/linux-aarch64/liblance_jni.so | |
- name: Build and publish with Java 8 | |
run: | | |
# mvn release:prepare -DdryRun=true | |
mvn clean install | |
- name: Find Spark Jar | |
run: | | |
RELATIVE_JAR_PATH=$(find spark/target -name 'lance-spark-2.12-*-jar-with-dependencies.jar') | |
JAR_NAME=$(basename $RELATIVE_JAR_PATH) | |
JAR_PATH=$(readlink -f "$RELATIVE_JAR_PATH") | |
echo "JAR_PATH=$JAR_PATH" >> $GITHUB_ENV | |
echo "JAR_NAME=$JAR_NAME" >> $GITHUB_ENV | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.JAR_NAME }} | |
path: ${{ env.JAR_PATH }} | |
retention-days: 1 | |
if-no-files-found: error |