Skip to content

Commit 08fd9d2

Browse files
authored
ci(java): use Debian 10 with glibc 2.28 for publishing Java artifacts (#3703)
Fixes #3691 Fixes #3653
1 parent 622ac7d commit 08fd9d2

1 file changed

Lines changed: 193 additions & 32 deletions

File tree

.github/workflows/java-publish.yml

Lines changed: 193 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,68 @@ jobs:
3636
name: Build on Linux Arm64
3737
runs-on: ubuntu-2404-8x-arm64
3838
timeout-minutes: 60
39-
defaults:
40-
run:
41-
working-directory: ./java
4239
steps:
4340
- name: Checkout repository
4441
uses: actions/checkout@v4
45-
- uses: Swatinem/rust-cache@v2
46-
- uses: actions-rust-lang/setup-rust-toolchain@v1
47-
with:
48-
toolchain: "stable"
49-
cache-workspaces: "src/rust"
50-
# Disable full debug symbol generation to speed up CI build and keep memory down
51-
# "1" means line tables only, which is useful for panic tracebacks.
52-
rustflags: "-C debuginfo=1"
53-
- name: Install dependencies
54-
run: |
55-
sudo apt -y -qq update
56-
sudo apt install -y protobuf-compiler libssl-dev pkg-config
57-
- name: Build release
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
- name: Check glibc version outside docker
45+
run: ldd --version
46+
- name: Build and run in Ubuntu 20.04 container
5847
run: |
59-
cargo build --release
60-
cp ../target/release/liblance_jni.so liblance_jni.so
48+
docker run --platform linux/arm64 -v ${{ github.workspace }}:/workspace -w /workspace debian:10 bash -c "
49+
50+
set -ex
51+
apt-get update
52+
53+
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes \
54+
apt-transport-https \
55+
ca-certificates \
56+
curl \
57+
gpg \
58+
bash \
59+
less \
60+
openssl \
61+
libssl-dev \
62+
pkg-config \
63+
libsqlite3-dev \
64+
libsqlite3-0 \
65+
libreadline-dev \
66+
git \
67+
cmake \
68+
dh-autoreconf \
69+
clang \
70+
g++ \
71+
libc++-dev \
72+
libc++abi-dev \
73+
libprotobuf-dev \
74+
libncurses5-dev \
75+
libncursesw5-dev \
76+
libudev-dev \
77+
libhidapi-dev \
78+
zip \
79+
unzip
80+
81+
# https://github.com/databendlabs/databend/issues/8035
82+
PROTOC_ZIP=protoc-3.15.0-linux-aarch_64.zip
83+
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.15.0/\$PROTOC_ZIP
84+
unzip -o \$PROTOC_ZIP -d /usr/local
85+
rm -f \$PROTOC_ZIP
86+
protoc --version
87+
88+
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
89+
source \$HOME/.cargo/env
90+
91+
cd java
92+
93+
# https://github.com/rustls/rustls/issues/1967
94+
export CC=clang
95+
export CXX=clang++
96+
ldd --version
97+
98+
cargo build --release
99+
cp ../target/release/liblance_jni.so liblance_jni.so
100+
"
61101
- uses: actions/upload-artifact@v4
62102
with:
63103
name: liblance_jni_linux_aarch64.zip
@@ -97,21 +137,142 @@ jobs:
97137
mkdir -p ./core/target/classes/nativelib/darwin-aarch64 ./core/target/classes/nativelib/linux-aarch64
98138
cp ../liblance_jni_darwin_aarch64.zip/liblance_jni.dylib ./core/target/classes/nativelib/darwin-aarch64/liblance_jni.dylib
99139
cp ../liblance_jni_linux_aarch64.zip/liblance_jni.so ./core/target/classes/nativelib/linux-aarch64/liblance_jni.so
100-
- name: Set github
101-
run: |
102-
git config --global user.email "Lance Github Runner"
103-
git config --global user.name "dev+gha@lancedb.com"
104-
- name: Dry run
140+
- name: Set up Docker Buildx
141+
uses: docker/setup-buildx-action@v3
142+
- name: Check glibc version outside docker
143+
run: ldd --version
144+
- name: Build and run in Ubuntu 20.04 container (Dry Run)
105145
if: github.event_name == 'pull_request'
106146
run: |
107-
mvn --batch-mode -DskipTests -Drust.release.build=true package
108-
- name: Publish with Java 8
147+
docker run --platform linux/amd64 -v ${{ github.workspace }}:/workspace -w /workspace openjdk:8-jdk-buster bash -c "
148+
set -ex
149+
apt-get update
150+
151+
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes \
152+
apt-transport-https \
153+
ca-certificates \
154+
curl \
155+
gpg \
156+
bash \
157+
less \
158+
openssl \
159+
libssl-dev \
160+
pkg-config \
161+
libsqlite3-dev \
162+
libsqlite3-0 \
163+
libreadline-dev \
164+
git \
165+
cmake \
166+
dh-autoreconf \
167+
clang \
168+
g++ \
169+
libc++-dev \
170+
libc++abi-dev \
171+
libprotobuf-dev \
172+
libncurses5-dev \
173+
libncursesw5-dev \
174+
libudev-dev \
175+
libhidapi-dev \
176+
zip \
177+
unzip \
178+
179+
# manually install maven, apt will use java11
180+
MAVEN_VERSION=3.9.6
181+
curl -OL https://dlcdn.apache.org/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.tar.gz
182+
tar -xzf apache-maven-3.9.9-bin.tar.gz
183+
mv apache-maven-3.9.9 /opt/maven
184+
ln -s /opt/maven/bin/mvn /usr/bin/mvn
185+
186+
# https://github.com/databendlabs/databend/issues/8035
187+
PROTOC_ZIP=protoc-3.15.0-linux-x86_64.zip
188+
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.15.0/\$PROTOC_ZIP
189+
unzip -o \$PROTOC_ZIP -d /usr/local
190+
rm -f \$PROTOC_ZIP
191+
protoc --version
192+
193+
# set Github
194+
git config --global user.email \"Lance Github Runner\"
195+
git config --global user.name \"dev+gha@lancedb.com\"
196+
197+
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
198+
source \$HOME/.cargo/env
199+
200+
cd java
201+
202+
# https://github.com/rustls/rustls/issues/1967
203+
export CC=clang
204+
export CXX=clang++
205+
ldd --version
206+
207+
mvn --batch-mode -DskipTests -Drust.release.build=true package
208+
"
209+
- name: Build and run in Ubuntu 20.04 container (Publish to Sonatype)
109210
if: github.event_name == 'release'
110211
run: |
111-
echo "use-agent" >> ~/.gnupg/gpg.conf
112-
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
113-
export GPG_TTY=$(tty)
114-
mvn --batch-mode -DskipTests -Drust.release.build=true -DpushChanges=false -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} deploy -P deploy-to-ossrh -P shade-jar
115-
env:
116-
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
117-
SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }}
212+
docker run --platform linux/amd64 -v ${{ github.workspace }}:/workspace -w /workspace openjdk:8-jdk-buster bash -c "
213+
set -ex
214+
apt-get update
215+
216+
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes \
217+
apt-transport-https \
218+
ca-certificates \
219+
curl \
220+
gpg \
221+
bash \
222+
less \
223+
openssl \
224+
libssl-dev \
225+
pkg-config \
226+
libsqlite3-dev \
227+
libsqlite3-0 \
228+
libreadline-dev \
229+
git \
230+
cmake \
231+
dh-autoreconf \
232+
clang \
233+
g++ \
234+
libc++-dev \
235+
libc++abi-dev \
236+
libprotobuf-dev \
237+
libncurses5-dev \
238+
libncursesw5-dev \
239+
libudev-dev \
240+
libhidapi-dev \
241+
zip \
242+
unzip
243+
244+
# manually install maven, apt will use java11
245+
MAVEN_VERSION=3.9.6
246+
curl -OL https://dlcdn.apache.org/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.tar.gz
247+
tar -xzf apache-maven-3.9.9-bin.tar.gz
248+
mv apache-maven-3.9.9 /opt/maven
249+
ln -s /opt/maven/bin/mvn /usr/bin/mvn
250+
251+
# https://github.com/databendlabs/databend/issues/8035
252+
PROTOC_ZIP=protoc-3.15.0-linux-x86_64.zip
253+
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.15.0/\$PROTOC_ZIP
254+
unzip -o \$PROTOC_ZIP -d /usr/local
255+
rm -f \$PROTOC_ZIP
256+
protoc --version
257+
258+
# set Github
259+
git config --global user.email \"Lance Github Runner\"
260+
git config --global user.name \"dev+gha@lancedb.com\"
261+
262+
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
263+
source \$HOME/.cargo/env
264+
265+
cd java
266+
267+
# https://github.com/rustls/rustls/issues/1967
268+
export CC=clang
269+
export CXX=clang++
270+
ldd --version
271+
272+
export SONATYPE_USER=${{ secrets.SONATYPE_USER }}
273+
export SONATYPE_TOKEN=${{ secrets.SONATYPE_TOKEN }}
274+
echo "use-agent" >> ~/.gnupg/gpg.conf
275+
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
276+
export GPG_TTY=$(tty)
277+
mvn --batch-mode -DskipTests -Drust.release.build=true -DpushChanges=false -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} deploy -P deploy-to-ossrh -P shade-jar
278+
"

0 commit comments

Comments
 (0)