Elffuss BraidHub

kikocis/lancedb public

main · 4.0 KiBRawPermalink
1name: Build and Run Java JNI Tests
2on:
3 push:
4 branches:
5 - main
6 paths:
7 - java/**
8 pull_request:
9 paths:
10 - java/**
11 - rust/**
12 - .github/workflows/java.yml
13env:
14 # This env var is used by Swatinem/rust-cache@v2 for the cache
15 # key, so we set it to make sure it is always consistent.
16 CARGO_TERM_COLOR: always
17 # Disable full debug symbol generation to speed up CI build and keep memory down
18 # "1" means line tables only, which is useful for panic tracebacks.
19 RUSTFLAGS: "-C debuginfo=1"
20 RUST_BACKTRACE: "1"
21 # according to: https://matklad.github.io/2021/09/04/fast-rust-builds.html
22 # CI builds are faster with incremental disabled.
23 CARGO_INCREMENTAL: "0"
24 CARGO_BUILD_JOBS: "1"
25jobs:
26 linux-build-java-11:
27 runs-on: ubuntu-22.04
28 name: ubuntu-22.04 + Java 11
29 defaults:
30 run:
31 working-directory: ./java
32 steps:
33 - name: Checkout repository
34 uses: actions/checkout@v4
35 - uses: Swatinem/rust-cache@v2
36 with:
37 workspaces: java/core/lancedb-jni
38 - name: Run cargo fmt
39 run: cargo fmt --check
40 working-directory: ./java/core/lancedb-jni
41 - name: Install dependencies
42 run: |
43 sudo apt update
44 sudo apt install -y protobuf-compiler libssl-dev
45 - name: Install Java 11
46 uses: actions/setup-java@v4
47 with:
48 distribution: temurin
49 java-version: 11
50 cache: "maven"
51 - name: Java Style Check
52 run: mvn checkstyle:check
53 # Disable because of issues in lancedb rust core code
54 # - name: Rust Clippy
55 # working-directory: java/core/lancedb-jni
56 # run: cargo clippy --all-targets -- -D warnings
57 - name: Running tests with Java 11
58 run: mvn clean test
59 linux-build-java-17:
60 runs-on: ubuntu-22.04
61 name: ubuntu-22.04 + Java 17
62 defaults:
63 run:
64 working-directory: ./java
65 steps:
66 - name: Checkout repository
67 uses: actions/checkout@v4
68 - uses: Swatinem/rust-cache@v2
69 with:
70 workspaces: java/core/lancedb-jni
71 - name: Run cargo fmt
72 run: cargo fmt --check
73 working-directory: ./java/core/lancedb-jni
74 - name: Install dependencies
75 run: |
76 sudo apt update
77 sudo apt install -y protobuf-compiler libssl-dev
78 - name: Install Java 17
79 uses: actions/setup-java@v4
80 with:
81 distribution: temurin
82 java-version: 17
83 cache: "maven"
84 - run: echo "JAVA_17=$JAVA_HOME" >> $GITHUB_ENV
85 - name: Java Style Check
86 run: mvn checkstyle:check
87 # Disable because of issues in lancedb rust core code
88 # - name: Rust Clippy
89 # working-directory: java/core/lancedb-jni
90 # run: cargo clippy --all-targets -- -D warnings
91 - name: Running tests with Java 17
92 run: |
93 export JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS \
94 -XX:+IgnoreUnrecognizedVMOptions \
95 --add-opens=java.base/java.lang=ALL-UNNAMED \
96 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED \
97 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
98 --add-opens=java.base/java.io=ALL-UNNAMED \
99 --add-opens=java.base/java.net=ALL-UNNAMED \
100 --add-opens=java.base/java.nio=ALL-UNNAMED \
101 --add-opens=java.base/java.util=ALL-UNNAMED \
102 --add-opens=java.base/java.util.concurrent=ALL-UNNAMED \
103 --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED \
104 --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED \
105 --add-opens=java.base/sun.nio.ch=ALL-UNNAMED \
106 --add-opens=java.base/sun.nio.cs=ALL-UNNAMED \
107 --add-opens=java.base/sun.security.action=ALL-UNNAMED \
108 --add-opens=java.base/sun.util.calendar=ALL-UNNAMED \
109 --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED \
110 -Djdk.reflect.useDirectMethodHandle=false \
111 -Dio.netty.tryReflectionSetAccessible=true"
112 JAVA_HOME=$JAVA_17 mvn clean test
113