-
Notifications
You must be signed in to change notification settings - Fork 34
258 lines (227 loc) · 7.86 KB
/
Java.yml
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
name: Java JDBC
on:
push:
pull_request:
workflow_call:
workflow_dispatch:
repository_dispatch:
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
OVERRIDE_GIT_DESCRIBE: ${{ inputs.override_git_describe }}
jobs:
format_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.git_ref }}
- run: |
python3 -m pip install --user clang_format==11.0.1
make format-check
java-linux:
needs: format_check
strategy:
matrix:
config: [ { runner: ubuntu-latest, arch: amd64, image: x86_64 }, { runner: ubuntu-24.04-arm, arch: aarch64, image: aarch64 } ]
name: Java Linux (${{ matrix.config.arch }})
runs-on: ${{ matrix.config.runner }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.git_ref }}
- name: Build
shell: bash
run: |
export PWD=`pwd`
docker run \
-v$PWD:$PWD \
-e CMAKE_BUILD_PARALLEL_LEVEL=2 \
quay.io/pypa/manylinux2014_${{ matrix.config.image }} \
bash -c "yum install -y java-1.8.0-openjdk-devel && git config --global --add safe.directory $PWD && make release -C $PWD"
- name: Java Tests
shell: bash
if: ${{ inputs.skip_tests != 'true' }}
run: make test
- name: Deploy
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_DUCKDB_STAGING_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DUCKDB_STAGING_KEY }}
run: |
cp build/release/duckdb_jdbc.jar duckdb_jdbc-linux-${{ matrix.config.arch }}.jar
./scripts/upload-assets-to-staging.sh github_release duckdb_jdbc-linux-${{ matrix.config.arch }}.jar
- uses: actions/upload-artifact@v4
with:
name: java-linux-${{ matrix.config.arch }}
path: |
build/release/duckdb_jdbc.jar
java-windows-amd64:
name: Java Windows (amd64)
runs-on: windows-2019
needs: java-linux
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.git_ref }}
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Setup Ccache
uses: hendrikmuhs/ccache-action@main
with:
key: ${{ github.job }}
save: ${{ github.ref == 'refs/heads/main' || github.repository != 'duckdb/duckdb-java' }}
- name: Build
shell: bash
run: make release
- name: Java Tests
if: ${{ inputs.skip_tests != 'true' }}
shell: bash
run: |
ls -R .
make test
- name: Deploy
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_DUCKDB_STAGING_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DUCKDB_STAGING_KEY }}
run: |
cp build/release/duckdb_jdbc.jar duckdb_jdbc-windows-amd64.jar
./scripts/upload-assets-to-staging.sh github_release duckdb_jdbc-windows-amd64.jar
- uses: actions/upload-artifact@v4
with:
name: java-windows-amd64
path: |
build/release/duckdb_jdbc.jar
java-osx-universal:
name: Java OSX (Universal)
runs-on: macos-14
needs: java-linux
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.git_ref }}
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Setup Ccache
uses: hendrikmuhs/ccache-action@main
with:
key: ${{ github.job }}
save: ${{ github.ref == 'refs/heads/main' }}
- name: Build
shell: bash
run: make release
- name: Java Tests
if: ${{ inputs.skip_tests != 'true' }}
shell: bash
run: make test
- name: See if this actually universal
shell: bash
run: lipo -archs build/release/libduckdb_java.so_osx_universal | grep "x86_64 arm64"
- name: Deploy
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_DUCKDB_STAGING_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DUCKDB_STAGING_KEY }}
run: |
cp build/release/duckdb_jdbc.jar duckdb_jdbc-osx-universal.jar
./scripts/upload-assets-to-staging.sh github_release duckdb_jdbc-osx-universal.jar
- uses: actions/upload-artifact@v4
with:
name: java-osx-universal
path: |
build/release/duckdb_jdbc.jar
java-combine:
if: ${{ inputs.override_git_describe == '' }}
name: Java Combine
runs-on: ubuntu-latest
needs:
- java-linux
- java-windows-amd64
- java-osx-universal
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.git_ref }}
- shell: bash
run: mkdir jdbc-artifacts
- uses: actions/download-artifact@v4
with:
name: java-linux-aarch64
path: jdbc-artifacts/java-linux-aarch64
- uses: actions/download-artifact@v4
with:
name: java-linux-amd64
path: jdbc-artifacts/java-linux-amd64
- uses: actions/download-artifact@v4
with:
name: java-windows-amd64
path: jdbc-artifacts/java-windows-amd64
- uses: actions/download-artifact@v4
with:
name: java-osx-universal
path: jdbc-artifacts/java-osx-universal
- name: Combine JARs
shell: bash
run: |
mkdir -m 700 -p ~/.gnupg
echo -e "passphrase asdf\npinentry-mode loopback\nno-tty\nbatch\n" > ~/.gnupg/gpg.conf
if [[ "$GITHUB_REF" =~ ^(refs/heads/main|refs/tags/v.+)$ && "$GITHUB_REPOSITORY" = "duckdb/duckdb-java" ]] ; then
export XML='
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>ossrh</id>
<username>hfmuehleisen</username> <!-- Sonatype OSSRH JIRA user/pw -->
<password>PASSWORD</password>
</server>
</servers>
</settings> '
mkdir ~/.m2
echo $XML | sed "s|PASSWORD|${{ secrets.MAVEN_PASSWORD }}|" > ~/.m2/settings.xml
echo "${{ secrets.MAVEN_PGP_PK }}" | base64 -d > maven_pgp_key
gpg --batch --import maven_pgp_key
python scripts/jdbc_maven_deploy.py ${{ github.ref_name }} jdbc-artifacts .
fi
ls -lahR jdbc-artifacts
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: java-jars
path: |
jdbc-artifacts
jdbc-compliance:
name: JDBC Compliance
runs-on: ubuntu-latest
if: ${{ inputs.skip_tests != 'true' }}
needs: java-linux
steps:
- name: Install jdbccts
shell: bash
run: git clone https://github.com/cwida/jdbccts.git
- name: Downgrade Java(TM)
shell: bash
run: |
sudo apt-get update -y
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
java -version
javac -version
- uses: actions/download-artifact@v4
with:
name: java-linux-amd64
path: jdbc-driver
- name: Test
shell: bash
run: (cd jdbccts && make DUCKDB_JAR=../jdbc-driver/duckdb_jdbc-linux-amd64.jar test)