forked from slatedb/slatedb
-
Notifications
You must be signed in to change notification settings - Fork 0
208 lines (172 loc) · 7.5 KB
/
java.yaml
File metadata and controls
208 lines (172 loc) · 7.5 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Publish Release (Java)
on:
workflow_dispatch:
inputs:
version:
description: "The version of the release (e.g., 1.0.0)"
required: true
permissions:
contents: read
jobs:
verify-version:
runs-on: ubuntu-latest
steps:
- name: Verify version
uses: matt-usurp/validate-semver@v2
with:
version: ${{ github.event.inputs.version }}
native-linux:
name: Build native libraries (Linux)
runs-on: ubuntu-22.04
needs: verify-version
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Setup Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install cross-compile toolchain
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Add Rust targets
run: rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
- name: Build x86_64 Linux library
run: cargo build -p slatedb-uniffi --release --target x86_64-unknown-linux-gnu
- name: Build aarch64 Linux library
env:
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++
AR_aarch64_unknown_linux_gnu: aarch64-linux-gnu-ar
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
run: cargo build -p slatedb-uniffi --release --target aarch64-unknown-linux-gnu
- name: Stage Linux native artifacts
run: |
mkdir -p artifacts/linux-x86-64 artifacts/linux-aarch64
cp target/x86_64-unknown-linux-gnu/release/libslatedb_uniffi.so artifacts/linux-x86-64/
cp target/aarch64-unknown-linux-gnu/release/libslatedb_uniffi.so artifacts/linux-aarch64/
- name: Upload Linux native artifacts
uses: actions/upload-artifact@v4
with:
name: native-linux
path: artifacts
native-macos:
name: Build native libraries (macOS)
runs-on: macos-14
needs: verify-version
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Setup Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Add Rust targets
run: rustup target add x86_64-apple-darwin aarch64-apple-darwin
- name: Build x86_64 macOS library
run: cargo build -p slatedb-uniffi --release --target x86_64-apple-darwin
- name: Build aarch64 macOS library
run: cargo build -p slatedb-uniffi --release --target aarch64-apple-darwin
- name: Stage macOS native artifacts
run: |
mkdir -p artifacts/darwin-x86-64 artifacts/darwin-aarch64
cp target/x86_64-apple-darwin/release/libslatedb_uniffi.dylib artifacts/darwin-x86-64/
cp target/aarch64-apple-darwin/release/libslatedb_uniffi.dylib artifacts/darwin-aarch64/
- name: Upload macOS native artifacts
uses: actions/upload-artifact@v4
with:
name: native-macos
path: artifacts
native-windows:
name: Build native libraries (Windows)
runs-on: windows-latest
needs: verify-version
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Setup Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Add Rust targets
run: rustup target add x86_64-pc-windows-msvc aarch64-pc-windows-msvc
- name: Build x86_64 Windows library
run: cargo build -p slatedb-uniffi --release --target x86_64-pc-windows-msvc
- name: Build aarch64 Windows library
run: cargo build -p slatedb-uniffi --release --target aarch64-pc-windows-msvc
- name: Stage Windows native artifacts
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path artifacts/win32-x86-64 | Out-Null
New-Item -ItemType Directory -Force -Path artifacts/win32-aarch64 | Out-Null
Copy-Item target/x86_64-pc-windows-msvc/release/slatedb_uniffi.dll artifacts/win32-x86-64/
Copy-Item target/aarch64-pc-windows-msvc/release/slatedb_uniffi.dll artifacts/win32-aarch64/
- name: Upload Windows native artifacts
uses: actions/upload-artifact@v4
with:
name: native-windows
path: artifacts
publish-java:
name: Publish Java to Maven Central
runs-on: ubuntu-latest
needs: [native-linux, native-macos, native-windows]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Set up Java 22
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "22"
- name: Setup Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install uniffi-bindgen-java
env:
RUSTFLAGS: ""
run: cargo install uniffi-bindgen-java --git https://github.com/IronCoreLabs/uniffi-bindgen-java.git --tag 0.4.1
- name: Download Linux artifacts
uses: actions/download-artifact@v4
with:
name: native-linux
path: native-libs/linux
- name: Download macOS artifacts
uses: actions/download-artifact@v4
with:
name: native-macos
path: native-libs/macos
- name: Download Windows artifacts
uses: actions/download-artifact@v4
with:
name: native-windows
path: native-libs/windows
- name: Assemble universal native directory
run: |
mkdir -p native-libs/merged/linux-x86-64
mkdir -p native-libs/merged/linux-aarch64
mkdir -p native-libs/merged/darwin-x86-64
mkdir -p native-libs/merged/darwin-aarch64
mkdir -p native-libs/merged/win32-x86-64
mkdir -p native-libs/merged/win32-aarch64
cp native-libs/linux/linux-x86-64/libslatedb_uniffi.so native-libs/merged/linux-x86-64/
cp native-libs/linux/linux-aarch64/libslatedb_uniffi.so native-libs/merged/linux-aarch64/
cp native-libs/macos/darwin-x86-64/libslatedb_uniffi.dylib native-libs/merged/darwin-x86-64/
cp native-libs/macos/darwin-aarch64/libslatedb_uniffi.dylib native-libs/merged/darwin-aarch64/
cp native-libs/windows/win32-x86-64/slatedb_uniffi.dll native-libs/merged/win32-x86-64/
cp native-libs/windows/win32-aarch64/slatedb_uniffi.dll native-libs/merged/win32-aarch64/
- name: Verify native artifact layout
run: |
test -f native-libs/merged/linux-x86-64/libslatedb_uniffi.so
test -f native-libs/merged/linux-aarch64/libslatedb_uniffi.so
test -f native-libs/merged/darwin-x86-64/libslatedb_uniffi.dylib
test -f native-libs/merged/darwin-aarch64/libslatedb_uniffi.dylib
test -f native-libs/merged/win32-x86-64/slatedb_uniffi.dll
test -f native-libs/merged/win32-aarch64/slatedb_uniffi.dll
- name: Publish to Maven Central
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY_PASSWORD }}
run: |
./bindings/java/gradlew -p bindings/java :slatedb-uniffi:check publishAndReleaseToMavenCentral \
-Pslatedb.version=${{ github.event.inputs.version }} \
-Pslatedb.native.prebuiltDir="${{ github.workspace }}/native-libs/merged"