Repository navigation
386 lines (359 loc) · 15.2 KB
/
Copy pathjava.yml
File metadata and controls
386 lines (359 loc) · 15.2 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
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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# 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: Java
on:
pull_request:
branches:
- main
paths:
- "java/**"
- ".github/workflows/java.yml"
push:
branches-ignore:
- 'dependabot/**'
paths:
- "java/**"
- ".github/workflows/java.yml"
concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
permissions:
contents: read
defaults:
run:
shell: bash -l -eo pipefail {0}
jobs:
java:
name: "Java ${{ matrix.java }}/Linux"
runs-on: ubuntu-latest
strategy:
matrix:
java: ['11', '17', '21', '25']
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
submodules: recursive
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
cache: "maven"
distribution: "temurin"
java-version: ${{ matrix.java }}
- name: Start test services
run: |
docker compose up --detach --wait flightsql-sqlite-test mssql-test postgres-test
cat .env | grep -v -e '^#' | awk NF | tee -a $GITHUB_ENV
- name: Build/Test
run: |
cd java
mvn install
java-errorprone:
name: "Java ${{ matrix.java }}/Linux with ErrorProne"
runs-on: ubuntu-latest
strategy:
matrix:
java: ['21', '25']
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
submodules: recursive
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
cache: "maven"
distribution: "temurin"
java-version: ${{ matrix.java }}
- name: Build/Test
run: |
cd java
mkdir .mvn
cat <<HERE > .mvn/jvm.config
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
HERE
# Our linters are compile-time, no point re-running tests
mvn -P errorprone install -DskipTests
java-jni-artifacts:
name: "JNI Libraries/${{ matrix.os }} ${{ matrix.arch }}"
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- { os: Linux, arch: amd64, vcpkg_arch: x64, runner: ubuntu-latest, platform: "linux/amd64" }
- { os: Linux, arch: arm64v8, vcpkg_arch: arm64, runner: ubuntu-24.04-arm, platform: "linux/arm64/v8" }
- { os: macOS, arch: arm64v8, vcpkg_arch: arm64, runner: macos-latest }
- { os: Windows, arch: amd64, vcpkg_arch: x64, runner: windows-latest }
env:
VCPKG_ROOT: "${{ github.workspace }}/vcpkg"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
cache: "maven"
distribution: "temurin"
java-version: 11
- name: Retrieve Go from .env
run: |
(. .env && echo "GO_VERSION=${GO}") >> $GITHUB_ENV
- name: Install vcpkg
run: |
./ci/scripts/install_vcpkg.sh "$VCPKG_ROOT"
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: "${{ env.GO_VERSION }}"
check-latest: true
cache: true
cache-dependency-path: adbc/go/adbc/go.sum
- name: Install Homebrew dependencies
if: matrix.os == 'macOS'
run: brew install autoconf bash pkg-config ninja
- name: Build artifacts (Linux)
if: matrix.os == 'Linux'
env:
ARCH: ${{ matrix.arch }}
PLATFORM: ${{ matrix.platform }}
run: |
docker compose run python-wheel-manylinux-build
- name: Build artifacts (macOS)
if: matrix.os == 'macOS'
run: |
export ADBC_BUILD_STATIC=ON
export ADBC_BUILD_TESTS=OFF
export ADBC_USE_ASAN=OFF
export ADBC_USE_UBSAN=OFF
./ci/scripts/python_wheel_unix_build.sh ${{ matrix.arch }} $(pwd) $(pwd)/build
- name: Build artifacts (Windows)
if: matrix.os == 'Windows'
shell: pwsh
run: |
.\ci\scripts\python_wheel_windows_build_drivers.ps1 `
-SourceDir $PWD.Path `
-BuildDir (Join-Path $PWD.Path "build/${{ matrix.vcpkg_arch }}") `
-Architecture "amd64"
- name: Build driver manager (Windows)
if: matrix.os == 'Windows'
run: |
ls -laR $(pwd)/build/${{ matrix.vcpkg_arch }}
rm -rf $(pwd)/build/${{ matrix.vcpkg_arch }}/bin/adbc_driver_manager.dll
rm -rf $(pwd)/build/${{ matrix.vcpkg_arch }}/driver_manager
# I think static and shared conflict on Windows so build static separately
- name: Build driver manager (Windows)
if: matrix.os == 'Windows'
shell: pwsh
run: |
$buildDir = Join-Path $PWD.Path 'buildmanager'
$installPrefix = Join-Path $PWD.Path 'build/${{ matrix.vcpkg_arch }}'
$sourceDir = Join-Path $PWD.Path 'c'
cmake -G 'Visual Studio 18 2026' -A x64 `
'-DADBC_BUILD_SHARED=OFF' `
'-DADBC_BUILD_STATIC=ON' `
'-DCMAKE_VERBOSE_MAKEFILE=ON' `
'-DADBC_DRIVER_MANAGER=ON' `
'-DCMAKE_BUILD_TYPE=RelWithDebInfo' `
"-DCMAKE_INSTALL_PREFIX=$installPrefix" `
-B $buildDir `
$sourceDir
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
cmake --build $buildDir --config Debug --target install --verbose -j
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Build JNI artifacts
run: |
ls -l $(pwd)/build/${{ matrix.vcpkg_arch }}
export ADBC_BUILD_STATIC=ON
export ADBC_BUILD_TESTS=OFF
export ADBC_USE_ASAN=OFF
export ADBC_USE_UBSAN=OFF
./ci/scripts/java_build.sh $(pwd)
./ci/scripts/java_jni_build.sh $(pwd) $(pwd)/build_jni $(pwd)/build/${{ matrix.vcpkg_arch }}
- name: Assemble artifacts
if: matrix.os != 'Windows'
run: |
mkdir artifacts
cp -r java/driver/jni/src/main/resources/ artifacts/jni
cp -r build/${{ matrix.vcpkg_arch }}/lib artifacts/driver
ls -laR artifacts
mv artifacts artifacts-${{ matrix.os }}-${{ matrix.arch }}
tar czf artifacts-${{ matrix.os }}-${{ matrix.arch }}.tgz artifacts-${{ matrix.os }}-${{ matrix.arch }}
- name: Assemble artifacts (Windows)
if: matrix.os == 'Windows'
run: |
mkdir -p artifacts/driver
cp -r java/driver/jni/src/main/resources/ artifacts/jni
cp -r build/${{ matrix.vcpkg_arch }}/bin/*.dll artifacts/driver
ls -laR artifacts
mv artifacts artifacts-${{ matrix.os }}-${{ matrix.arch }}
tar czf artifacts-${{ matrix.os }}-${{ matrix.arch }}.tgz artifacts-${{ matrix.os }}-${{ matrix.arch }}
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: jni-artifacts-${{ matrix.os }}-${{ matrix.arch }}
retention-days: 7
path: |
artifacts-${{ matrix.os }}-${{ matrix.arch }}.tgz
- name: Assemble logs
if: failure()
run: |
mkdir ~/logs
find "$VCPKG_ROOT" -name 'build-*.log' -exec cp '{}' ~/logs ';'
if [[ -d "$(pwd)/build/${{ matrix.vcpkg_arch }}" ]]; then
mv "$(pwd)/build/${{ matrix.vcpkg_arch }}" ~/logs/artifacts
fi
- name: Upload failure logs
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: jni-debug-logs-${{ matrix.os }}-${{ matrix.arch }}
retention-days: 7
path: ~/logs
java-jni:
name: "Java ${{ matrix.java }} JNI/${{ matrix.os }} ${{ matrix.arch }}"
runs-on: ${{ matrix.runner }}
needs:
- java-jni-artifacts
strategy:
matrix:
include:
# To keep the matrix down, only test Java 11 on some platforms
- { java: '11', os: Linux, arch: amd64, runner: ubuntu-latest }
- { java: '11', os: macOS, arch: arm64v8, runner: macos-latest }
- { java: '11', os: Windows, arch: amd64, runner: windows-latest }
- { java: '11', os: Linux, arch: arm64v8, runner: ubuntu-24.04-arm }
- { java: '25', os: Linux, arch: amd64, runner: ubuntu-latest }
- { java: '25', os: macOS, arch: arm64v8, runner: macos-latest }
- { java: '25', os: Windows, arch: amd64, runner: windows-latest }
max-parallel: 4
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
submodules: recursive
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
path: artifacts
pattern: jni-artifacts-*
merge-multiple: true
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
cache: "maven"
distribution: "temurin"
java-version: 11
- name: Build
run: |
set -x
pushd artifacts
tar xvf artifacts-${{ matrix.os }}-${{ matrix.arch }}.tgz
popd
cp -r artifacts/artifacts-${{ matrix.os }}-${{ matrix.arch }}/jni/adbc_driver_jni java/driver/jni/src/main/resources
env BUILD_JNI=ON ./ci/scripts/java_build.sh $(pwd)
- name: Set environment variables
if: matrix.os == 'Linux' && matrix.arch == 'amd64'
run: |
cat .env | grep -v -e '^#' | grep -e '^ADBC_' | awk NF | sed 's/"//g' | tee -a $GITHUB_ENV
# no mssql
- name: Set environment variables
if: matrix.os == 'Linux' && matrix.arch == 'arm64v8'
run: |
cat .env | grep -v -e '^#' | grep -v "MSSQL" | grep -e '^ADBC_' | awk NF | sed 's/"//g' | tee -a $GITHUB_ENV
# only postgresql
- name: Set environment variables
if: matrix.os == 'Windows' || matrix.os == 'macOS'
run: |
cat .env | grep -v -e '^#' | grep "POSTGRESQL" | grep -e '^ADBC_' | awk NF | sed 's/"//g' | tee -a $GITHUB_ENV
- name: Start Dependencies
if: matrix.os == 'Linux' && matrix.arch == 'amd64'
run: |
docker compose up --detach --wait flightsql-test flightsql-sqlite-test mssql-test postgres-test
- name: Start Dependencies
if: matrix.os == 'Linux' && matrix.arch == 'arm64v8'
run: |
docker compose up --detach --wait flightsql-test flightsql-sqlite-test postgres-test
# taking the approach from:
# https://github.com/ikalnytskyi/action-setup-postgres/blob/41a676a2118b02582251d839aa50cc5685355a2f/action.yml
- name: Install Dependencies
if: matrix.os == 'Windows'
env:
POSTGRESQL_VERSION: 18
run: |
choco install postgresql${POSTGRESQL_VERSION} \
--params "/Password:$ADBC_JDBC_POSTGRESQL_PASSWORD" \
--ia "--enable-components server,commandlinetools --extract-only 1" \
--no-progress
export PG_BINDIR=$("$PROGRAMFILES/PostgreSQL/${POSTGRESQL_VERSION}/bin/pg_config.exe" --bindir)
echo "$PG_BINDIR" | tee -a $GITHUB_PATH
- name: Install Dependencies
if: matrix.os == 'macOS'
env:
POSTGRESQL_VERSION: 18
run: |
export HOMEBREW_GITHUB_ACTIONS=1
export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
export HOMEBREW_NO_INSTALL_UPGRADE=1
brew install --quiet postgresql@${POSTGRESQL_VERSION}
brew link --quiet --overwrite postgresql@${POSTGRESQL_VERSION}
- name: Start Dependencies
if: matrix.os == 'Windows' || matrix.os == 'macOS'
run: |
echo "$ADBC_JDBC_POSTGRESQL_PASSWORD" > "$RUNNER_TEMP/postgres_password"
initdb \
--pgdata="$RUNNER_TEMP/pgdata" \
--username "$ADBC_JDBC_POSTGRESQL_USER" \
--pwfile="$RUNNER_TEMP/postgres_password" \
--auth="scram-sha-256" \
--encoding="UTF-8" \
--locale="en_US.UTF-8" \
--no-instructions
pg_ctl start --pgdata="$RUNNER_TEMP/pgdata"
- name: Download thirdparty driver
if: matrix.os == 'Linux' && matrix.arch == 'amd64'
run: |
wget https://dbc-cdn.columnar.tech/mssql/v1.4.0/mssql_linux_amd64_v1.4.0.tar.gz
echo "89371ba78ffa8d5037d2a4d5331bc8f125598774e1da6e5b46b3af45a34e288b mssql_linux_amd64_v1.4.0.tar.gz" > mssql_linux_amd64_v1.4.0.tar.gz.sha256
sha256sum -c mssql_linux_amd64_v1.4.0.tar.gz.sha256
tar xvf mssql_linux_amd64_v1.4.0.tar.gz
mkdir -p ~/.config/adbc/drivers/
mv libadbc_driver_mssql.so ~/.config/adbc/drivers/
echo "manifest_version = 1" > ~/.config/adbc/drivers/test_mssql.toml
echo "[Driver]" >> ~/.config/adbc/drivers/test_mssql.toml
echo "shared = '$HOME/.config/adbc/drivers/libadbc_driver_mssql.so'" >> ~/.config/adbc/drivers/test_mssql.toml
cat ~/.config/adbc/drivers/test_mssql.toml
- name: Test
run: |
for driver in artifacts/*/driver; do
export LD_LIBRARY_PATH=$(pwd)/$driver:${LD_LIBRARY_PATH:-}
export DYLD_LIBRARY_PATH=$(pwd)/$driver:${DYLD_LIBRARY_PATH:-}
export PATH=$(pwd)/$driver:${PATH:-}
done
echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
echo DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
echo PATH=$PATH
cd java
mvn -B -Pjni test -pl :adbc-driver-jni -pl :adbc-driver-jni-validation