Elffuss BraidHub

kikocis/lancedb public

ci: public java package (#1485)

Co-authored-by: Lu Qiu <luqiujob@gmail.com>
Changeset76ea2547d3cf245e151eb0c84640dd4e6992b668c145c801509707a3b8608ad1
AuthorLei Xu <lei@lancedb.com> · 2024-09-05 11:48 -07:00
CommitterGitHub <noreply@github.com> · 2024-09-05 11:48 -07:00
Parents8c51603cbd2a

Browse the files at this changeset

3 files changed

added .github/workflows/java-publish.yml +109 −0
@@ -0,0 +1,109 @@
1+name: Build and publish Java packages
2+on:
3+ release:
4+ types: [released]
5+ pull_request:
6+ paths:
7+ - .github/workflows/java-publish.yml
8+
9+jobs:
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: Set github
98+ run: |
99+ git config --global user.email "LanceDB Github Runner"
100+ git config --global user.name "dev+gha@lancedb.com"
101+ - name: Publish with Java 8
102+ run: |
103+ echo "use-agent" >> ~/.gnupg/gpg.conf
104+ echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
105+ export GPG_TTY=$(tty)
106+ mvn --batch-mode -DskipTests -DpushChanges=false -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} deploy -P deploy-to-ossrh
107+ env:
108+ SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
109+ SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }}
modified java/core/pom.xml +2 −2
@@ -8,7 +8,7 @@
88 <parent>
99 <groupId>com.lancedb</groupId>
1010 <artifactId>lancedb-parent</artifactId>
11- <version>0.1-SNAPSHOT</version>
11+ <version>0.0.3</version>
1212 <relativePath>../pom.xml</relativePath>
1313 </parent>
1414
@@ -68,7 +68,7 @@
6868 </goals>
6969 <configuration>
7070 <path>lancedb-jni</path>
71- <!--<release>true</release>-->
71+ <release>true</release>
7272 <!-- Copy native libraries to target/classes for runtime access -->
7373 <copyTo>${project.build.directory}/classes/nativelib</copyTo>
7474 <copyWithPlatformDir>true</copyWithPlatformDir>
modified java/pom.xml +138 −4
@@ -6,15 +6,28 @@
66
77 <groupId>com.lancedb</groupId>
88 <artifactId>lancedb-parent</artifactId>
9- <version>0.1-SNAPSHOT</version>
9+ <version>0.0.3</version>
1010 <packaging>pom</packaging>
1111
12- <name>Lance Parent</name>
12+ <name>LanceDB Parent</name>
13+ <description>LanceDB vector database Java API</description>
14+ <url>http://lancedb.com/</url>
15+
16+ <developers>
17+ <developer>
18+ <name>Lance DB Dev Group</name>
19+ <email>dev@lancedb.com</email>
20+ </developer>
21+ </developers>
22+ <licenses>
23+ <license>
24+ <name>The Apache Software License, Version 2.0</name>
25+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
26+ </license>
27+ </licenses>
1328
1429 <properties>
1530 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16- <maven.compiler.source>11</maven.compiler.source>
17- <maven.compiler.target>11</maven.compiler.target>
1831 <arrow.version>15.0.0</arrow.version>
1932 </properties>
2033
@@ -22,6 +35,12 @@
2235 <module>core</module>
2336 </modules>
2437
38+ <scm>
39+ <connection>scm:git:https://github.com/lancedb/lancedb.git</connection>
40+ <developerConnection>scm:git:ssh://git@github.com/lancedb/lancedb.git</developerConnection>
41+ <url>https://github.com/lancedb/lancedb</url>
42+ </scm>
43+
2544 <dependencyManagement>
2645 <dependencies>
2746 <dependency>
@@ -62,8 +81,45 @@
6281 </dependencies>
6382 </dependencyManagement>
6483
84+ <distributionManagement>
85+ <snapshotRepository>
86+ <id>ossrh</id>
87+ <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
88+ </snapshotRepository>
89+ <repository>
90+ <id>ossrh</id>
91+ <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
92+ </repository>
93+ </distributionManagement>
94+
6595 <build>
6696 <plugins>
97+ <plugin>
98+ <groupId>org.apache.maven.plugins</groupId>
99+ <artifactId>maven-source-plugin</artifactId>
100+ <version>2.2.1</version>
101+ <executions>
102+ <execution>
103+ <id>attach-sources</id>
104+ <goals>
105+ <goal>jar-no-fork</goal>
106+ </goals>
107+ </execution>
108+ </executions>
109+ </plugin>
110+ <plugin>
111+ <groupId>org.apache.maven.plugins</groupId>
112+ <artifactId>maven-javadoc-plugin</artifactId>
113+ <version>2.9.1</version>
114+ <executions>
115+ <execution>
116+ <id>attach-javadocs</id>
117+ <goals>
118+ <goal>jar</goal>
119+ </goals>
120+ </execution>
121+ </executions>
122+ </plugin>
67123 <plugin>
68124 <groupId>org.apache.maven.plugins</groupId>
69125 <artifactId>maven-checkstyle-plugin</artifactId>
@@ -126,4 +182,82 @@
126182 </plugins>
127183 </pluginManagement>
128184 </build>
185+
186+ <profiles>
187+ <profile>
188+ <id>jdk8</id>
189+ <activation>
190+ <jdk>[1.8,1.8.999]</jdk>
191+ </activation>
192+ <properties>
193+ <maven.compiler.source>1.8</maven.compiler.source>
194+ <maven.compiler.target>1.8</maven.compiler.target>
195+ </properties>
196+ </profile>
197+ <profile>
198+ <id>jdk11+</id>
199+ <activation>
200+ <jdk>[11,)</jdk>
201+ </activation>
202+ <properties>
203+ <maven.compiler.source>11</maven.compiler.source>
204+ <maven.compiler.target>11</maven.compiler.target>
205+ </properties>
206+ <build>
207+ <plugins>
208+ <plugin>
209+ <artifactId>maven-surefire-plugin</artifactId>
210+ <version>3.2.5</version>
211+ <configuration>
212+ <argLine>--add-opens=java.base/java.nio=ALL-UNNAMED</argLine>
213+ <forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory" />
214+ <useSystemClassLoader>false</useSystemClassLoader>
215+ </configuration>
216+ </plugin>
217+ </plugins>
218+ </build>
219+ </profile>
220+ <profile>
221+ <id>deploy-to-ossrh</id>
222+ <build>
223+ <plugins>
224+ <plugin>
225+ <groupId>org.sonatype.central</groupId>
226+ <artifactId>central-publishing-maven-plugin</artifactId>
227+ <version>0.4.0</version>
228+ <extensions>true</extensions>
229+ <configuration>
230+ <publishingServerId>ossrh</publishingServerId>
231+ <tokenAuth>true</tokenAuth>
232+ </configuration>
233+ </plugin>
234+ <plugin>
235+ <groupId>org.sonatype.plugins</groupId>
236+ <artifactId>nexus-staging-maven-plugin</artifactId>
237+ <version>1.6.13</version>
238+ <extensions>true</extensions>
239+ <configuration>
240+ <serverId>ossrh</serverId>
241+ <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
242+ <autoReleaseAfterClose>true</autoReleaseAfterClose>
243+ </configuration>
244+ </plugin>
245+ <plugin>
246+ <groupId>org.apache.maven.plugins</groupId>
247+ <artifactId>maven-gpg-plugin</artifactId>
248+ <version>1.5</version>
249+ <executions>
250+ <execution>
251+ <id>sign-artifacts</id>
252+ <phase>verify</phase>
253+ <goals>
254+ <goal>sign</goal>
255+ </goals>
256+ </execution>
257+ </executions>
258+ </plugin>
259+ </plugins>
260+ </build>
261+ </profile>
262+ </profiles>
129263 </project>