-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (115 loc) · 4.43 KB
/
Copy pathci-java.yml
File metadata and controls
135 lines (115 loc) · 4.43 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
name: CI Java
# Reusable Java SDK workflow: Linux runs the full `gradle build` across every
# JDK (sharing one prebuilt cdylib); a smoke build covers the other published
# platforms. Called by ci.yml when Java-relevant paths change.
on:
workflow_call:
permissions:
contents: read
env:
CARGO_HTTP_MULTIPLEXING: "false"
CARGO_NET_RETRY: "10"
jobs:
# Build the JDK-independent cdylib once; test legs reuse it as an artifact.
native:
name: Build native library
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Rust
uses: ./.github/actions/setup-rust
- name: Build the JNI cdylib
run: cargo build --release --features postgres,redis,workflows -p taskito-java
- name: Upload the cdylib
uses: actions/upload-artifact@v7
with:
name: taskito-java-native
path: target/release/libtaskito_java.so
if-no-files-found: error
retention-days: 1
# Build + test on every supported JDK; the SDK targets 17 but runs on 17/21/25
# over a native .so, so JVM behaviour is runtime-sensitive.
test:
name: Java SDK Tests (JDK ${{ matrix.java }})
needs: native
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: ["17", "21", "25"]
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Java + Gradle
uses: ./.github/actions/setup-java
with:
java-version: ${{ matrix.java }}
# Stage the prebuilt .so where copyNative expects it, so no Rust is needed.
- name: Download the cdylib
uses: actions/download-artifact@v8
with:
name: taskito-java-native
path: target/release
# -x cargoBuild skips the Rust compile; copyNative still stages the .so.
- name: Build and test the Java SDK
working-directory: sdks/java
# Spotless/Checkstyle are JDK-independent (and palantir-java-format reaches
# into javac internals that newer JDKs change), so run the full `build`
# (which includes `check`) only on the baseline JDK; the other legs run the
# test suite to verify runtime behaviour on each JDK.
run: ./gradlew ${{ matrix.java == '17' && 'build' || 'test' }} -x cargoBuild --no-daemon
# Smoke the other published platforms on one JDK: their native binary differs,
# so they rebuild it (cargoBuild) instead of reusing the Linux artifact.
smoke:
name: Java SDK Smoke (${{ matrix.classifier }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- classifier: osx-aarch64
runner: macos-15
- classifier: windows-x86_64
runner: windows-latest
steps:
- name: Check out repository
uses: actions/checkout@v7
# Vendored OpenSSL needs Perl; point openssl-sys at Strawberry Perl.
- name: Point vendored OpenSSL at Strawberry Perl (Windows)
if: runner.os == 'Windows'
shell: bash
run: echo "OPENSSL_SRC_PERL=C:/Strawberry/perl/bin/perl.exe" >> "$GITHUB_ENV"
- name: Set up Rust
uses: ./.github/actions/setup-rust
- name: Set up Java + Gradle
uses: ./.github/actions/setup-java
# bash so `./gradlew` runs uniformly on the Windows runner too.
- name: Build and test the Java SDK
working-directory: sdks/java
shell: bash
run: ./gradlew build --no-daemon
# Prove the SDK works under GraalVM native-image: run the smoke under the
# tracing agent to collect JNI/reflection/resource metadata, then build a
# native image with it and run the binary.
graalvm:
name: Java SDK GraalVM native-image
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Rust
uses: ./.github/actions/setup-rust
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: "21"
distribution: graalvm
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Collect metadata, build, and run the native image
working-directory: sdks/java
run: |
./gradlew -Pagent :graalvm-smoke:run --no-daemon
./gradlew :graalvm-smoke:metadataCopy --no-daemon
./gradlew :graalvm-smoke:nativeCompile --no-daemon
./graalvm-smoke/build/native/nativeCompile/graalvm-smoke