-
Notifications
You must be signed in to change notification settings - Fork 1.5k
545 lines (491 loc) · 23.3 KB
/
Copy pathjava-sdk-tests.yml
File metadata and controls
545 lines (491 loc) · 23.3 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
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
name: "Java SDK Tests"
on:
workflow_dispatch:
workflow_call:
permissions:
contents: read
env:
JAVA_PUBLICATION_REVISION: "0.0.0-ci"
MAVEN_OPTS: >-
-Daether.connector.http.retryHandler.count=3
-Daether.connector.http.retryHandler.serviceUnavailable=429,502,503
jobs:
java-sdk-inprocess:
name: "Java SDK InProcess Tests (${{ matrix.classifier }})"
if: github.event.repository.fork == false
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
classifier: linux-x64
- os: ubuntu-24.04-arm
classifier: linux-arm64
maven-args: -Dcopilot.native.libc=glibc
- os: windows-latest
classifier: win32-x64
- os: windows-11-arm
classifier: win32-arm64
- os: macos-26
classifier: darwin-arm64
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./java
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: "25"
distribution: "microsoft"
cache: "maven"
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 22
- name: Validate native host
run: node copilot-native/scripts/validate-native-host.mjs ${{ matrix.classifier }}
- name: Run Java SDK tests (InProcess)
env:
CI: "true"
run: mvn clean verify -Pinprocess ${{ matrix.maven-args }}
- name: Generate Test Report Summary
if: failure()
uses: ./.github/actions/java-test-report
with:
title: "Copilot Java SDK :: Test Results InProcess"
- name: Upload test results on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: java-test-results-inprocess-${{ matrix.classifier }}
path: |
java/sdk/target/surefire-reports/
java/sdk/target/surefire-reports-isolated/
java/sdk/target/failsafe-reports/
retention-days: 7
java-native-publication-linux-arm64:
name: "Java Native Publication Input (linux-arm64)"
if: github.event.repository.fork == false
runs-on: ubuntu-24.04-arm
permissions:
contents: read
outputs:
source_sha: ${{ steps.build.outputs.source_sha }}
version: ${{ steps.build.outputs.version }}
defaults:
run:
shell: bash
working-directory: ./java
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: "25"
distribution: "microsoft"
cache: "maven"
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 22
- name: Build and validate linux-arm64 classifier
id: build
run: |
set -euo pipefail
VERSION="$JAVA_PUBLICATION_REVISION"
node copilot-native/scripts/validate-native-host.mjs linux-arm64
mvn -B -pl copilot-native package -DskipTests -Dcopilot.native.libc=glibc "-Drevision=$VERSION"
JAR="copilot-native/target/copilot-sdk-java-runtime-$VERSION-linux-arm64.jar"
PRIMARY_JAR="copilot-native/target/copilot-sdk-java-runtime-$VERSION.jar"
test -f "$JAR"
node copilot-native/scripts/validate-native-artifact.mjs \
classifier linux-arm64 "$JAR" "$(basename "$JAR")" ..
node copilot-native/scripts/validate-native-artifact.mjs placeholder "$PRIMARY_JAR"
MANIFEST="copilot-native/target/linux-arm64-$VERSION.sha256"
HASH=$(sha256sum "$JAR" | cut -d ' ' -f 1)
printf '%s %s' "$HASH" "$(basename "$JAR")" > "$MANIFEST"
node copilot-native/scripts/validate-native-artifact.mjs \
checksum "$JAR" "$MANIFEST" "$(basename "$JAR")"
echo "source_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: java-native-publication-linux-arm64-${{ github.run_id }}
path: |
java/copilot-native/target/copilot-sdk-java-runtime-${{ steps.build.outputs.version }}-linux-arm64.jar
java/copilot-native/target/linux-arm64-${{ steps.build.outputs.version }}.sha256
if-no-files-found: error
overwrite: true
retention-days: 1
java-native-publication-windows:
name: "Java Native Publication Input (win32-x64)"
if: github.event.repository.fork == false
runs-on: windows-latest
permissions:
contents: read
outputs:
source_sha: ${{ steps.build.outputs.source_sha }}
version: ${{ steps.build.outputs.version }}
defaults:
run:
shell: pwsh
working-directory: ./java
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: "25"
distribution: "microsoft"
cache: "maven"
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 22
- name: Build and validate win32-x64 classifier
id: build
run: |
$version = $env:JAVA_PUBLICATION_REVISION
node copilot-native/scripts/validate-native-host.mjs win32-x64
mvn -B -pl copilot-native package -DskipTests "-Drevision=$version"
$jar = "copilot-native/target/copilot-sdk-java-runtime-$version-win32-x64.jar"
$primaryJar = "copilot-native/target/copilot-sdk-java-runtime-$version.jar"
if (-not (Test-Path -LiteralPath $jar -PathType Leaf)) {
throw "Expected Windows classifier was not produced: $jar"
}
node copilot-native/scripts/validate-native-artifact.mjs classifier win32-x64 $jar ([IO.Path]::GetFileName($jar)) ..
node copilot-native/scripts/validate-native-artifact.mjs placeholder $primaryJar
$manifest = "copilot-native/target/win32-x64-$version.sha256"
$hash = (Get-FileHash -Algorithm SHA256 -LiteralPath $jar).Hash.ToLowerInvariant()
"$hash $([IO.Path]::GetFileName($jar))" | Set-Content -NoNewline -Encoding ascii $manifest
node copilot-native/scripts/validate-native-artifact.mjs checksum $jar $manifest ([IO.Path]::GetFileName($jar))
echo "source_sha=$(git rev-parse HEAD)" >> $env:GITHUB_OUTPUT
echo "version=$version" >> $env:GITHUB_OUTPUT
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: java-native-publication-win32-x64-${{ github.run_id }}
path: |
java/copilot-native/target/copilot-sdk-java-runtime-${{ steps.build.outputs.version }}-win32-x64.jar
java/copilot-native/target/win32-x64-${{ steps.build.outputs.version }}.sha256
if-no-files-found: error
overwrite: true
retention-days: 1
java-native-publication-windows-arm64:
name: "Java Native Publication Input (win32-arm64)"
if: github.event.repository.fork == false
runs-on: windows-11-arm
permissions:
contents: read
outputs:
source_sha: ${{ steps.build.outputs.source_sha }}
version: ${{ steps.build.outputs.version }}
defaults:
run:
shell: pwsh
working-directory: ./java
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: "25"
distribution: "microsoft"
cache: "maven"
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 22
- name: Build and validate win32-arm64 classifier
id: build
run: |
$version = $env:JAVA_PUBLICATION_REVISION
node copilot-native/scripts/validate-native-host.mjs win32-arm64
mvn -B -pl copilot-native package -DskipTests "-Drevision=$version"
$jar = "copilot-native/target/copilot-sdk-java-runtime-$version-win32-arm64.jar"
$primaryJar = "copilot-native/target/copilot-sdk-java-runtime-$version.jar"
if (-not (Test-Path -LiteralPath $jar -PathType Leaf)) {
throw "Expected Windows ARM64 classifier was not produced: $jar"
}
node copilot-native/scripts/validate-native-artifact.mjs classifier win32-arm64 $jar ([IO.Path]::GetFileName($jar)) ..
node copilot-native/scripts/validate-native-artifact.mjs placeholder $primaryJar
$manifest = "copilot-native/target/win32-arm64-$version.sha256"
$hash = (Get-FileHash -Algorithm SHA256 -LiteralPath $jar).Hash.ToLowerInvariant()
"$hash $([IO.Path]::GetFileName($jar))" | Set-Content -NoNewline -Encoding ascii $manifest
node copilot-native/scripts/validate-native-artifact.mjs checksum $jar $manifest ([IO.Path]::GetFileName($jar))
echo "source_sha=$(git rev-parse HEAD)" >> $env:GITHUB_OUTPUT
echo "version=$version" >> $env:GITHUB_OUTPUT
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: java-native-publication-win32-arm64-${{ github.run_id }}
path: |
java/copilot-native/target/copilot-sdk-java-runtime-${{ steps.build.outputs.version }}-win32-arm64.jar
java/copilot-native/target/win32-arm64-${{ steps.build.outputs.version }}.sha256
if-no-files-found: error
overwrite: true
retention-days: 1
java-native-publication-darwin:
name: "Java Native Publication Input (darwin-arm64)"
if: github.event.repository.fork == false
runs-on: macos-26
permissions:
contents: read
outputs:
source_sha: ${{ steps.build.outputs.source_sha }}
version: ${{ steps.build.outputs.version }}
defaults:
run:
shell: bash
working-directory: ./java
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: "25"
distribution: "microsoft"
cache: "maven"
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 22
- name: Build and validate darwin-arm64 classifier
id: build
run: |
set -euo pipefail
VERSION="$JAVA_PUBLICATION_REVISION"
node copilot-native/scripts/validate-native-host.mjs darwin-arm64
mvn -B -pl copilot-native package -DskipTests "-Drevision=$VERSION"
JAR="copilot-native/target/copilot-sdk-java-runtime-$VERSION-darwin-arm64.jar"
PRIMARY_JAR="copilot-native/target/copilot-sdk-java-runtime-$VERSION.jar"
test -f "$JAR"
node copilot-native/scripts/validate-native-artifact.mjs \
classifier darwin-arm64 "$JAR" "$(basename "$JAR")" ..
node copilot-native/scripts/validate-native-artifact.mjs placeholder "$PRIMARY_JAR"
MANIFEST="copilot-native/target/darwin-arm64-$VERSION.sha256"
HASH=$(shasum -a 256 "$JAR" | cut -d ' ' -f 1)
printf '%s %s' "$HASH" "$(basename "$JAR")" > "$MANIFEST"
node copilot-native/scripts/validate-native-artifact.mjs \
checksum "$JAR" "$MANIFEST" "$(basename "$JAR")"
echo "source_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: java-native-publication-darwin-arm64-${{ github.run_id }}
path: |
java/copilot-native/target/copilot-sdk-java-runtime-${{ steps.build.outputs.version }}-darwin-arm64.jar
java/copilot-native/target/darwin-arm64-${{ steps.build.outputs.version }}.sha256
if-no-files-found: error
overwrite: true
retention-days: 1
java-native-publication-assembly:
name: "Java Native Publication Assembly"
if: github.event.repository.fork == false
needs:
[
java-native-publication-linux-arm64,
java-native-publication-windows,
java-native-publication-windows-arm64,
java-native-publication-darwin,
]
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./java
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.sha }}
persist-credentials: false
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: "25"
distribution: "microsoft"
cache: "maven"
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 22
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: java-native-publication-linux-arm64-${{ github.run_id }}
path: ${{ github.workspace }}/java/native-publication-input/linux-arm64
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: java-native-publication-win32-x64-${{ github.run_id }}
path: ${{ github.workspace }}/java/native-publication-input/windows
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: java-native-publication-win32-arm64-${{ github.run_id }}
path: ${{ github.workspace }}/java/native-publication-input/windows-arm64
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: java-native-publication-darwin-arm64-${{ github.run_id }}
path: ${{ github.workspace }}/java/native-publication-input/darwin
- name: Verify native inputs and install the complete local release
run: |
set -euo pipefail
test "$(git rev-parse HEAD)" = "${{ needs.java-native-publication-linux-arm64.outputs.source_sha }}"
test "$(git rev-parse HEAD)" = "${{ needs.java-native-publication-windows.outputs.source_sha }}"
test "$(git rev-parse HEAD)" = "${{ needs.java-native-publication-windows-arm64.outputs.source_sha }}"
test "$(git rev-parse HEAD)" = "${{ needs.java-native-publication-darwin.outputs.source_sha }}"
VERSION="${{ needs.java-native-publication-windows.outputs.version }}"
test "$VERSION" = "$JAVA_PUBLICATION_REVISION"
test "$VERSION" = "${{ needs.java-native-publication-linux-arm64.outputs.version }}"
test "$VERSION" = "${{ needs.java-native-publication-windows-arm64.outputs.version }}"
test "$VERSION" = "${{ needs.java-native-publication-darwin.outputs.version }}"
LINUX_ARM64_DIRECTORY="$GITHUB_WORKSPACE/java/native-publication-input/linux-arm64"
WINDOWS_DIRECTORY="$GITHUB_WORKSPACE/java/native-publication-input/windows"
WINDOWS_ARM64_DIRECTORY="$GITHUB_WORKSPACE/java/native-publication-input/windows-arm64"
DARWIN_DIRECTORY="$GITHUB_WORKSPACE/java/native-publication-input/darwin"
LINUX_ARM64_JAR="$LINUX_ARM64_DIRECTORY/copilot-sdk-java-runtime-$VERSION-linux-arm64.jar"
LINUX_ARM64_MANIFEST="$LINUX_ARM64_DIRECTORY/linux-arm64-$VERSION.sha256"
WINDOWS_JAR="$WINDOWS_DIRECTORY/copilot-sdk-java-runtime-$VERSION-win32-x64.jar"
WINDOWS_MANIFEST="$WINDOWS_DIRECTORY/win32-x64-$VERSION.sha256"
WINDOWS_ARM64_JAR="$WINDOWS_ARM64_DIRECTORY/copilot-sdk-java-runtime-$VERSION-win32-arm64.jar"
WINDOWS_ARM64_MANIFEST="$WINDOWS_ARM64_DIRECTORY/win32-arm64-$VERSION.sha256"
DARWIN_JAR="$DARWIN_DIRECTORY/copilot-sdk-java-runtime-$VERSION-darwin-arm64.jar"
DARWIN_MANIFEST="$DARWIN_DIRECTORY/darwin-arm64-$VERSION.sha256"
node copilot-native/scripts/validate-native-artifact.mjs \
checksum "$LINUX_ARM64_JAR" "$LINUX_ARM64_MANIFEST" "$(basename "$LINUX_ARM64_JAR")"
node copilot-native/scripts/validate-native-artifact.mjs \
classifier linux-arm64 "$LINUX_ARM64_JAR" "$(basename "$LINUX_ARM64_JAR")" ..
node copilot-native/scripts/validate-native-artifact.mjs \
checksum "$WINDOWS_JAR" "$WINDOWS_MANIFEST" "$(basename "$WINDOWS_JAR")"
node copilot-native/scripts/validate-native-artifact.mjs \
classifier win32-x64 "$WINDOWS_JAR" "$(basename "$WINDOWS_JAR")" ..
node copilot-native/scripts/validate-native-artifact.mjs \
checksum "$WINDOWS_ARM64_JAR" "$WINDOWS_ARM64_MANIFEST" "$(basename "$WINDOWS_ARM64_JAR")"
node copilot-native/scripts/validate-native-artifact.mjs \
classifier win32-arm64 "$WINDOWS_ARM64_JAR" "$(basename "$WINDOWS_ARM64_JAR")" ..
node copilot-native/scripts/validate-native-artifact.mjs \
checksum "$DARWIN_JAR" "$DARWIN_MANIFEST" "$(basename "$DARWIN_JAR")"
node copilot-native/scripts/validate-native-artifact.mjs \
classifier darwin-arm64 "$DARWIN_JAR" "$(basename "$DARWIN_JAR")" ..
export GNUPGHOME="$GITHUB_WORKSPACE/java/copilot-native/target/local-publication-gpg"
rm -rf "$GNUPGHOME"
mkdir -p "$GNUPGHOME"
chmod 700 "$GNUPGHOME"
gpg --batch --pinentry-mode loopback --passphrase '' \
--quick-generate-key 'Copilot SDK local validation <local-validation@example.invalid>' rsa2048 sign 1d
LOCAL_REPOSITORY="$GITHUB_WORKSPACE/java/copilot-native/target/local-publication-repository"
rm -rf "$LOCAL_REPOSITORY"
mvn -B -pl copilot-native install -Prelease -DskipTests \
"-Drevision=$VERSION" \
-Dcopilot.native.libc=glibc \
"-Dcopilot.native.external.linux.arm64.classifier.path=$LINUX_ARM64_JAR" \
"-Dcopilot.native.external.win32.classifier.path=$WINDOWS_JAR" \
"-Dcopilot.native.external.win32.arm64.classifier.path=$WINDOWS_ARM64_JAR" \
"-Dcopilot.native.external.darwin.classifier.path=$DARWIN_JAR" \
"-Dmaven.repo.local=$LOCAL_REPOSITORY"
node copilot-native/scripts/validate-local-publication.mjs \
"$LOCAL_REPOSITORY" copilot-sdk-java-runtime "$VERSION" .. --signatures
mvn -B -pl sdk install -Prelease -DskipTests -DskipITs \
"-Drevision=$VERSION" \
"-Dmaven.repo.local=$LOCAL_REPOSITORY"
node copilot-native/scripts/validate-local-publication.mjs \
"$LOCAL_REPOSITORY" copilot-sdk-java "$VERSION" .. --signatures
java-sdk:
name: "Java SDK Tests (JDK ${{ matrix.test-jdk }})"
if: github.event.repository.fork == false
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test-jdk: ["25", "17"]
defaults:
run:
shell: bash
working-directory: ./java
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: "25"
distribution: "microsoft"
cache: "maven"
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 22
- name: Test documentation version updater
if: matrix.test-jdk == '25'
run: ./scripts/test-update-documentation-versions.sh
- name: Test release source validation
if: matrix.test-jdk == '25'
run: node --test scripts/resolve-release-source.test.mjs
- name: Build SDK and set up test harness
run: mvn test-compile jar:jar
- name: Verify Javadoc generation
if: matrix.test-jdk == '25'
run: mvn javadoc:javadoc -q
- name: Verify CLI works
run: |
npm --prefix ../nodejs ci --ignore-scripts
cli_path=$(npm --prefix ../nodejs run --silent prepare:runtime -- --print-path)
test -x "$cli_path"
legacy_cli=$(npm --prefix ../nodejs run --silent prepare:runtime -- --print-legacy-path)
node "$legacy_cli" --version
- name: Run spotless check
if: matrix.test-jdk == '25'
run: |
max_attempts=3
for ((attempt=1; attempt<=max_attempts; attempt++)); do
if mvn spotless:check; then
echo "✅ spotless:check passed"
exit 0
fi
if [ "$attempt" -lt "$max_attempts" ]; then
echo "⚠️ spotless:check failed (attempt $attempt/$max_attempts), retrying in 10s..."
sleep 10
fi
done
echo "❌ spotless:check failed after $max_attempts attempts. Please run 'mvn spotless:apply' in java/"
exit 1
- name: Run Java SDK tests (JDK 25)
if: matrix.test-jdk == '25'
env:
CI: "true"
# Native artifacts are built and exercised by every classifier job.
run: mvn -pl sdk verify -Dskip.test.harness=true
- name: Switch to JDK 17
if: matrix.test-jdk == '17'
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: "17"
distribution: "microsoft"
- name: Run Java SDK tests (JDK 17, no recompilation)
if: matrix.test-jdk == '17'
env:
CI: "true"
run: |
echo "Running tests against JDK 25-built classes using JDK 17 runtime..."
java -version
mvn -pl sdk jacoco:prepare-agent@wire-up-coverage-instrumentation antrun:run@print-test-jdk-banner surefire:test failsafe:integration-test failsafe:verify jacoco:report@build-coverage-report-from-tests -Denforcer.skip=true
- name: Upload test results for site generation
if: success() && github.event_name == 'merge_group' && matrix.test-jdk == '25'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: test-results-for-site
path: |
java/sdk/target/jacoco-test-results/sdk-tests.exec
java/sdk/target/surefire-reports/
java/sdk/target/surefire-reports-isolated/
retention-days: 1
- name: Generate Test Report Summary
if: always()
uses: ./.github/actions/java-test-report
with:
title: "Copilot Java SDK :: Test Results JDK ${{ matrix.test-jdk }}"
- name: Upload test results on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: java-test-results-jdk-${{ matrix.test-jdk }}
path: |
java/sdk/target/surefire-reports/
java/sdk/target/surefire-reports-isolated/
java/sdk/target/failsafe-reports/
retention-days: 7