Elffuss BraidHub

kikocis/lancedb public

main · 3.9 KiBRawPermalink
1name: Build and publish Java packages
2on:
3 release:
4 types: [released]
5 pull_request:
6 paths:
7 - .github/workflows/java-publish.yml
8
9jobs:
10 macos-arm64:
11 name: Build on MacOS Arm64
12 runs-on: macos-14
13 timeout-minutes: 45
14 defaults:
15 run:
16 working-directory: ./java/core/lancedb-jni
17 steps:
18 - name: Checkout repository
19 uses: actions/checkout@v4
20 - uses: Swatinem/rust-cache@v2
21 - name: Install dependencies
22 run: |
23 brew install protobuf
24 - name: Build release
25 run: |
26 cargo build --release
27 - uses: actions/upload-artifact@v4
28 with:
29 name: liblancedb_jni_darwin_aarch64.zip
30 path: target/release/liblancedb_jni.dylib
31 retention-days: 1
32 if-no-files-found: error
33 linux-arm64:
34 name: Build on Linux Arm64
35 runs-on: warp-ubuntu-2204-arm64-8x
36 timeout-minutes: 45
37 defaults:
38 run:
39 working-directory: ./java/core/lancedb-jni
40 steps:
41 - name: Checkout repository
42 uses: actions/checkout@v4
43 - uses: Swatinem/rust-cache@v2
44 - uses: actions-rust-lang/setup-rust-toolchain@v1
45 with:
46 toolchain: "1.79.0"
47 cache-workspaces: "./java/core/lancedb-jni"
48 # Disable full debug symbol generation to speed up CI build and keep memory down
49 # "1" means line tables only, which is useful for panic tracebacks.
50 rustflags: "-C debuginfo=1"
51 - name: Install dependencies
52 run: |
53 sudo apt -y -qq update
54 sudo apt install -y protobuf-compiler libssl-dev pkg-config
55 - name: Build release
56 run: |
57 cargo build --release
58 - uses: actions/upload-artifact@v4
59 with:
60 name: liblancedb_jni_linux_aarch64.zip
61 path: target/release/liblancedb_jni.so
62 retention-days: 1
63 if-no-files-found: error
64 linux-x86:
65 runs-on: warp-ubuntu-2204-x64-8x
66 timeout-minutes: 30
67 needs: [macos-arm64, linux-arm64]
68 defaults:
69 run:
70 working-directory: ./java
71 steps:
72 - name: Checkout repository
73 uses: actions/checkout@v4
74 - uses: Swatinem/rust-cache@v2
75 - name: Set up Java 8
76 uses: actions/setup-java@v4
77 with:
78 distribution: temurin
79 java-version: 8
80 cache: "maven"
81 server-id: ossrh
82 server-username: SONATYPE_USER
83 server-password: SONATYPE_TOKEN
84 gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
85 gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
86 - name: Install dependencies
87 run: |
88 sudo apt -y -qq update
89 sudo apt install -y protobuf-compiler libssl-dev pkg-config
90 - name: Download artifact
91 uses: actions/download-artifact@v4
92 - name: Copy native libs
93 run: |
94 mkdir -p ./core/target/classes/nativelib/darwin-aarch64 ./core/target/classes/nativelib/linux-aarch64
95 cp ../liblancedb_jni_darwin_aarch64.zip/liblancedb_jni.dylib ./core/target/classes/nativelib/darwin-aarch64/liblancedb_jni.dylib
96 cp ../liblancedb_jni_linux_aarch64.zip/liblancedb_jni.so ./core/target/classes/nativelib/linux-aarch64/liblancedb_jni.so
97 - name: Dry run
98 if: github.event_name == 'pull_request'
99 run: |
100 mvn --batch-mode -DskipTests package
101 - name: Set github
102 run: |
103 git config --global user.email "LanceDB Github Runner"
104 git config --global user.name "dev+gha@lancedb.com"
105 - name: Publish with Java 8
106 if: github.event_name == 'release'
107 run: |
108 echo "use-agent" >> ~/.gnupg/gpg.conf
109 echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
110 export GPG_TTY=$(tty)
111 mvn --batch-mode -DskipTests -DpushChanges=false -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} deploy -P deploy-to-ossrh
112 env:
113 SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
114 SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }}