Repository navigation
132 lines (126 loc) · 4.87 KB
/
Copy pathjava.yml
File metadata and controls
132 lines (126 loc) · 4.87 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
name: Build and Run Java JNI Tests
on:
push:
branches:
- main
- release/**
pull_request:
branches:
- main
- release/**
paths:
- java/**
- rust/**
- .github/workflows/java.yml
env:
# This env var is used by Swatinem/rust-cache@v2 for the cache
# key, so we set it to make sure it is always consistent.
CARGO_TERM_COLOR: always
RUST_BACKTRACE: "1"
permissions:
contents: read
jobs:
rust-clippy-fmt:
runs-on: ubuntu-24.04
name: Rust Clippy and Fmt Check
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
workspaces: |
lance
java/lance-jni -> ../target/rust-maven-plugin/lance-jni
- name: Install protoc
uses: taiki-e/install-action@66068bfca13dcb2ea07c3f613ca2836a37c755d5 # protoc
with:
tool: protoc
- uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
- name: Run cargo fmt
working-directory: java/lance-jni
run: cargo fmt --check
- name: Rust Clippy
working-directory: java/lance-jni
run: cargo clippy --all-targets --locked -- -D warnings
build-jni:
runs-on: ubuntu-24.04-4x
timeout-minutes: 60
name: Build and Test lance-jni
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install protoc
uses: taiki-e/install-action@66068bfca13dcb2ea07c3f613ca2836a37c755d5 # protoc
with:
tool: protoc
# pin the toolchain version to avoid surprises
- uses: actions-rust-lang/setup-rust-toolchain@a0b538fa0b742a6aa35d6e2c169b4bd06d225a98 # v1
with:
toolchain: stable
- uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
workspaces: java/lance-jni -> ../target/rust-maven-plugin/lance-jni
- name: Set up Java
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
with:
distribution: temurin
java-version: 17
cache: "maven"
# Runs the build-jni profile (cargo build + cargo test) but skips the Java
# tests, which run in the per-JDK jobs against the uploaded library.
- name: Build and test lance-jni
working-directory: java
run: mvn test -Dmaven.test.skip=true -Dspotless.skip=true
- name: Upload native library
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: lance-jni-nativelib
path: java/target/classes/nativelib
if-no-files-found: error
retention-days: 1
build-and-test-java:
needs: build-jni
runs-on: ubuntu-24.04
timeout-minutes: 60
strategy:
matrix:
java-version: [11, 17, 21, 25]
name: Build and Test with Java ${{ matrix.java-version }}
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
# JarJniLoader loads the library from /nativelib/<platform> on the classpath.
- name: Download native library
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: lance-jni-nativelib
path: java/target/classes/nativelib
- name: Set up Java ${{ matrix.java-version }}
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
with:
distribution: temurin
java-version: ${{ matrix.java-version }}
cache: "maven"
# Skip the format gate on Java 25: google-java-format 1.22.0 (pinned via
# spotless) reaches into com.sun.tools.javac internals and throws
# NoSuchMethodError on JDK 25's javac. No google-java-format release runs
# on JDK 25 without also dropping JDK 11/17 support, so we exclude 25 from
# the (JDK-independent, already-enforced-on-11/17/21) style check instead.
- name: Running code style check with Java ${{ matrix.java-version }}
if: matrix.java-version != '25'
working-directory: java
run: |
mvn spotless:check
- name: Start localstack
run: |
docker compose -f docker-compose.yml up -d --wait
- name: Running tests with Java ${{ matrix.java-version }}
working-directory: java
env:
LANCE_INTEGRATION_TEST: "1"
run: |
# spotless is also bound into the build lifecycle, so on Java 25 the
# format gate must be skipped here too (-Dspotless.skip=true), not just
# in the standalone step above.
mvn install -Dskip.build.jni=true ${{ matrix.java-version == '25' && '-Dspotless.skip=true' || '' }}