-
Notifications
You must be signed in to change notification settings - Fork 4
235 lines (225 loc) · 6.96 KB
/
java.yml
File metadata and controls
235 lines (225 loc) · 6.96 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
name: Java
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: read
defaults:
run:
shell: bash
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
compile-bindings:
name: Compile native bindings
strategy:
matrix:
# macos-15-intel is x86, macos-latest is arm64
os:
[
ubuntu-22.04,
ubuntu-24.04-arm,
windows-latest,
windows-11-arm,
macos-15-intel,
macos-latest,
]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Compile
run: cargo build --locked --package sysand-java --release
- uses: actions/setup-python@v6
if: ${{ matrix.os == 'ubuntu-22.04' }}
with:
python-version: 3.14
- name: Create version.txt
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: python bindings/java/scripts/java-builder.py create-version-file
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}
- name: Upload native bindings
uses: actions/upload-artifact@v5
with:
name: native-bindings-${{ matrix.os }}
path: |
target/release/*.so
target/release/*.dylib
target/release/*.dll
retention-days: 5
- name: Upload version.txt
uses: actions/upload-artifact@v5
if: ${{ matrix.os == 'ubuntu-22.04' }}
with:
name: version
path: version.txt
if-no-files-found: error
retention-days: 5
build-jar:
name: Build Java JAR
runs-on: ubuntu-latest
needs: [compile-bindings]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: 3.14
- uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "21"
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Download version.txt
uses: actions/download-artifact@v6
with:
name: version
- name: Download native bindings
uses: actions/download-artifact@v6
with:
path: native-bindings
- name: Debugging
run: ls -la native-bindings/*
- name: Build JAR
run: |
python bindings/java/scripts/java-builder.py build \
--use-existing-native-libs native-bindings \
--use-release-build \
${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE && '--sign-artifacts' || '' }}
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}
- name: Build Sysand Maven plugin and run integration tests
run: |
python bindings/java/scripts/java-builder.py build-plugin \
${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE && '--sign-artifacts' || '' }}
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}
- name: Upload JARs
uses: actions/upload-artifact@v5
with:
name: jars
path: target/java
retention-days: 5
- name: Upload Maven plugin JAR
uses: actions/upload-artifact@v5
with:
name: maven-plugin-jar
path: target/java-plugin
retention-days: 5
# We need to include hidden files because integration tests use
# .meta.json and .project.json files.
include-hidden-files: true
test-jar:
name: Test Java JAR
strategy:
matrix:
# macos-13 is x86, macos-latest is arm64
os:
[
ubuntu-22.04,
ubuntu-24.04-arm,
windows-latest,
windows-11-arm,
macos-15-intel,
macos-latest,
]
fail-fast: false
runs-on: ${{ matrix.os }}
needs: [build-jar]
steps:
- uses: actions/checkout@v6
- name: Download JARs
uses: actions/download-artifact@v6
with:
name: jars
path: target/java
- name: Download version.txt
uses: actions/download-artifact@v6
with:
name: version
- name: Debugging
run: |
find . -iname "*.jar"
ls -la *
ls -la target/*
ls -la target/java/*
ls -la target/java/target/*
- uses: actions/setup-python@v6
with:
python-version: 3.14
- uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "21"
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Test Java JAR
run: python bindings/java/scripts/java-builder.py test
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}
nightly-release:
name: Nightly Release
runs-on: ubuntu-latest
needs: [build-jar, test-jar]
if: ${{ github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') }}
permissions:
# Use to sign the release artifacts
id-token: write
# Used to upload release artifacts
contents: write
# Used to generate artifact attestation
attestations: write
steps:
- uses: actions/checkout@v6
- name: Download native bindings
uses: actions/download-artifact@v6
with:
name: jars
path: target/java
- name: Download Maven plugin JAR
uses: actions/download-artifact@v6
with:
name: maven-plugin-jar
path: target/java-plugin
- name: Download version.txt
uses: actions/download-artifact@v6
with:
name: version
- name: Debugging
run: |
find . -iname "*.jar"
find target/java-plugin/target/it/
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v3
with:
subject-path: "target/java/target/*.jar"
- uses: actions/setup-python@v6
with:
python-version: 3.14
- uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "21"
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Deploy Java bindings
run: python bindings/java/scripts/java-builder.py deploy
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}