-
Notifications
You must be signed in to change notification settings - Fork 8
181 lines (156 loc) · 5.93 KB
/
release-java.yml
File metadata and controls
181 lines (156 loc) · 5.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
name: Release Java
on:
workflow_call:
workflow_dispatch:
env:
JDK_VERSION: 8
concurrency:
group: release-java-${{ github.ref }}
cancel-in-progress: false
jobs:
build-native:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
os_name: linux
arch: x86_64
lib_name: libpaimon_mosaic_jni.so
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
os_name: linux
arch: aarch64
lib_name: libpaimon_mosaic_jni.so
- os: macos-latest
target: aarch64-apple-darwin
os_name: macos
arch: aarch64
lib_name: libpaimon_mosaic_jni.dylib
- os: windows-latest
target: x86_64-pc-windows-msvc
os_name: windows
arch: x86_64
lib_name: paimon_mosaic_jni.dll
steps:
- uses: actions/checkout@v6
- name: Setup Rust toolchain
run: |
rustup update stable
rustup default stable
- name: Setup Python
if: matrix.os_name == 'linux'
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Setup Linux zigbuild
if: matrix.os_name == 'linux'
run: pip install cargo-zigbuild
- name: Build Linux JNI library
if: matrix.os_name == 'linux'
shell: bash
run: |
set -euo pipefail
rustup target add "${{ matrix.target }}"
unset ZSTD_SYS_USE_PKG_CONFIG
cargo zigbuild --release -p paimon-mosaic-jni --target "${{ matrix.target }}.2.17"
artifact="target/${{ matrix.target }}/release/${{ matrix.lib_name }}"
test -f "$artifact"
version_info="$(readelf --version-info "$artifact")"
max_glibc="$(
printf '%s\n' "$version_info" \
| grep -Eo 'GLIBC_[0-9][0-9.]*' \
| sort -Vu \
| tail -n1 \
|| true
)"
echo "Maximum required GLIBC version: ${max_glibc:-none}"
if [[ -n "$max_glibc" ]]; then
allowed_glibc="GLIBC_2.17"
highest_glibc="$(printf '%s\n%s\n' "$allowed_glibc" "$max_glibc" | sort -Vu | tail -n1)"
if [[ "$highest_glibc" != "$allowed_glibc" ]]; then
echo "Linux GNU artifact requires $max_glibc, expected <= $allowed_glibc" >&2
exit 1
fi
fi
- name: Build JNI library
if: matrix.os_name != 'linux'
run: |
rustup target add "${{ matrix.target }}"
cargo build --release -p paimon-mosaic-jni --target "${{ matrix.target }}"
- name: Upload native library
uses: actions/upload-artifact@v5
with:
name: native-${{ matrix.os_name }}-${{ matrix.arch }}
path: target/${{ matrix.target }}/release/${{ matrix.lib_name }}
deploy-staging:
if: github.repository == 'apache/paimon-mosaic' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [build-native]
steps:
- uses: actions/checkout@v6
- name: Download linux x86_64 native library
uses: actions/download-artifact@v5
with:
name: native-linux-x86_64
path: java/src/main/resources/native/linux/x86_64
- name: Download linux aarch64 native library
uses: actions/download-artifact@v5
with:
name: native-linux-aarch64
path: java/src/main/resources/native/linux/aarch64
- name: Download macOS aarch64 native library
uses: actions/download-artifact@v5
with:
name: native-macos-aarch64
path: java/src/main/resources/native/macos/aarch64
- name: Download windows x86_64 native library
uses: actions/download-artifact@v5
with:
name: native-windows-x86_64
path: java/src/main/resources/native/windows/x86_64
- name: Verify native libraries
run: find java/src/main/resources/native -type f | sort
- name: Set up JDK ${{ env.JDK_VERSION }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.JDK_VERSION }}
distribution: 'temurin'
server-id: apache.releases.https
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Show Maven version
run: mvn --version
- name: Deploy to Apache Nexus staging
working-directory: java
run: |
mvn clean deploy \
-Prelease \
-DskipTests \
-DretryFailedDeploymentCount=10 \
-Daether.connector.basic.parallelPut=false
env:
MAVEN_USERNAME: ${{ secrets.NEXUS_STAGE_DEPLOYER_USER }}
MAVEN_PASSWORD: ${{ secrets.NEXUS_STAGE_DEPLOYER_PW }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}