From 4ee7225e917b44379267a4579119ae587bd6cc5f Mon Sep 17 00:00:00 2001 From: Lei Xu Date: Thu, 5 Sep 2024 11:48:48 -0700 Subject: [PATCH] ci: public java package (#1485) Co-authored-by: Lu Qiu --- .github/workflows/java-publish.yml | 109 ++++++++++++++++++++++ java/core/pom.xml | 4 +- java/pom.xml | 142 ++++++++++++++++++++++++++++- 3 files changed, 249 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/java-publish.yml diff --git a/.github/workflows/java-publish.yml b/.github/workflows/java-publish.yml new file mode 100644 index 00000000..12d13522 --- /dev/null +++ b/.github/workflows/java-publish.yml @@ -0,0 +1,109 @@ +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: 45 + defaults: + run: + working-directory: ./java/core/lancedb-jni + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - name: Install dependencies + run: | + brew install protobuf + - name: Build release + run: | + cargo build --release + - uses: actions/upload-artifact@v4 + with: + name: liblancedb_jni_darwin_aarch64.zip + path: target/release/liblancedb_jni.dylib + retention-days: 1 + if-no-files-found: error + linux-arm64: + name: Build on Linux Arm64 + runs-on: warp-ubuntu-2204-arm64-8x + timeout-minutes: 45 + defaults: + run: + working-directory: ./java/core/lancedb-jni + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: "1.79.0" + cache-workspaces: "./java/core/lancedb-jni" + # 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" + - 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 + - uses: actions/upload-artifact@v4 + with: + name: liblancedb_jni_linux_aarch64.zip + path: target/release/liblancedb_jni.so + retention-days: 1 + if-no-files-found: error + linux-x86: + runs-on: warp-ubuntu-2204-x64-8x + 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 Java 8 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 8 + cache: "maven" + server-id: ossrh + server-username: SONATYPE_USER + server-password: SONATYPE_TOKEN + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} + - name: Install dependencies + run: | + sudo apt -y -qq update + sudo apt install -y protobuf-compiler libssl-dev pkg-config + - name: Download artifact + uses: actions/download-artifact@v4 + - name: Copy native libs + run: | + mkdir -p ./core/target/classes/nativelib/darwin-aarch64 ./core/target/classes/nativelib/linux-aarch64 + cp ../liblancedb_jni_darwin_aarch64.zip/liblancedb_jni.dylib ./core/target/classes/nativelib/darwin-aarch64/liblancedb_jni.dylib + cp ../liblancedb_jni_linux_aarch64.zip/liblancedb_jni.so ./core/target/classes/nativelib/linux-aarch64/liblancedb_jni.so + - name: Set github + run: | + git config --global user.email "LanceDB Github Runner" + git config --global user.name "dev+gha@lancedb.com" + - name: Publish with Java 8 + run: | + echo "use-agent" >> ~/.gnupg/gpg.conf + echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf + export GPG_TTY=$(tty) + mvn --batch-mode -DskipTests -DpushChanges=false -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} deploy -P deploy-to-ossrh + env: + SONATYPE_USER: ${{ secrets.SONATYPE_USER }} + SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }} diff --git a/java/core/pom.xml b/java/core/pom.xml index a469c3ae..b6fedc19 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -8,7 +8,7 @@ com.lancedb lancedb-parent - 0.1-SNAPSHOT + 0.0.3 ../pom.xml @@ -68,7 +68,7 @@ lancedb-jni - + true ${project.build.directory}/classes/nativelib true diff --git a/java/pom.xml b/java/pom.xml index 48a64c12..6a0a95a7 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -6,15 +6,28 @@ com.lancedb lancedb-parent - 0.1-SNAPSHOT + 0.0.3 pom - Lance Parent + LanceDB Parent + LanceDB vector database Java API + http://lancedb.com/ + + + + Lance DB Dev Group + dev@lancedb.com + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + UTF-8 - 11 - 11 15.0.0 @@ -22,6 +35,12 @@ core + + scm:git:https://github.com/lancedb/lancedb.git + scm:git:ssh://git@github.com/lancedb/lancedb.git + https://github.com/lancedb/lancedb + + @@ -62,8 +81,45 @@ + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + org.apache.maven.plugins maven-checkstyle-plugin @@ -126,4 +182,82 @@ + + + + jdk8 + + [1.8,1.8.999] + + + 1.8 + 1.8 + + + + jdk11+ + + [11,) + + + 11 + 11 + + + + + maven-surefire-plugin + 3.2.5 + + --add-opens=java.base/java.nio=ALL-UNNAMED + + false + + + + + + + deploy-to-ossrh + + + + org.sonatype.central + central-publishing-maven-plugin + 0.4.0 + true + + ossrh + true + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.13 + true + + ossrh + https://s01.oss.sonatype.org/ + true + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + +