forked from oracle/graal
681 lines (670 loc) · 29.6 KB
/
base-windows.yml
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
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
name: Windows Mandrel-Quarkus tests
on:
workflow_call:
inputs:
quarkus-version:
type: string
description: 'Quarkus version to test (branch, tag, commit, or "latest")'
# "latest" is replaced by the latest release available in maven
default: "main"
quarkus-repo:
type: string
description: 'The Quarkus repository to be used'
default: 'quarkusio/quarkus'
version:
type: string
description: 'Mandrel version to test (branch, tag, or commit)'
default: "graal/master"
repo:
type: string
description: 'The Mandrel/Graal repository to be used'
default: 'graalvm/mandrel'
mandrel-packaging-version:
type: string
description: 'Mandrel packaging version to test (branch, tag, or commit)'
default: "master"
mandrel-packaging-repo:
type: string
description: 'Mandrel packaging repository to be used'
default: "graalvm/mandrel-packaging"
build-type:
type: string
description: 'Build distribution (Mandrel/GraalVM) from source or grab a release'
default: "mandrel-source"
jdk:
type: string
description: 'OpenJDK to use. One of <feature-version>/ga, <feature-version>/ea, e.g. 17/ga or 17/ea (/ga and /ea suffixes are only relevant when building from source)'
default: "17/ga"
# Builder image can't be tested on Windows due to https://github.com/actions/virtual-environments/issues/1143
# builder-image:
# description: 'The builder image to use instead of a release or building from source (e.g. quay.io/quarkus/ubi-quarkus-mandrel:20.3-java11)'
# default: "null"
issue-number:
type: string
description: 'The issue number to report results to'
default: "null"
issue-repo:
type: string
description: 'The repository to report results to'
default: "graalvm/mandrel"
mandrel-it-issue-number:
type: string
description: 'The issue number to report results to mandrel-integration-tests'
default: "null"
build-stats-tag:
type: string
description: 'The tag to use for build stats upload of native tests (e.g. 22.3.0-dev-jdk17-mytest-patch-before)'
default: "null"
secrets:
ISSUE_BOT_TOKEN:
description: 'A token used to report results in GH issues'
required: false
UPLOAD_COLLECTOR_TOKEN:
description: 'A token used to report build statistics to a collector'
required: false
env:
# Workaround testsuite locale issue
LANG: en_US.UTF-8
DB_USER: hibernate_orm_test
DB_PASSWORD: hibernate_orm_test
DB_NAME: hibernate_orm_test
COMMON_MAVEN_ARGS: "-e -B --settings .github/mvn-settings.xml --fail-at-end"
NATIVE_TEST_MAVEN_OPTS: "-Dtest-containers -Dstart-containers -DfailIfNoTests=false -Dquarkus.native.native-image-xmx=13g -Dnative -Dnative.surefire.skip -Dformat.skip -Dno-descriptor-tests -DskipDocs"
MX_GIT_CACHE: refcache
JAVA_HOME: ${{ github.workspace }}\openjdk
GRAALVM_HOME: ${{ github.workspace }}\graalvm-home
MANDREL_REPO: ${{ github.workspace }}\mandrel
MANDREL_HOME: ${{ github.workspace }}\..\mandrelvm
MX_PATH: ${{ github.workspace }}\mx
MX_PYTHON: python
QUARKUS_PATH: ${{ github.workspace }}\quarkus
MANDREL_PACKAGING_REPO: ${{ github.workspace }}\mandrel-packaging
COLLECTOR_URL: https://collector.foci.life/api/v1/image-stats
jobs:
build-vars:
name: Set distribution and build-from-source variables based on build-type
runs-on: ubuntu-latest
outputs:
build-from-source: ${{ steps.source-build.outputs.build-from-source }}
distribution: ${{ steps.distro.outputs.distribution }}
steps:
- name: Set build-from-source output
id: source-build
run: |
echo "${{ inputs.build-type }}"
bfs_token=$(echo ${{ inputs.build-type }} | cut -d'-' -f2)
if [ "${bfs_token}" == "release" ]
then
source_build=false
elif [ "${bfs_token}" == "source" ]
then
source_build=true
else
echo "Unexpected input 'build-type' = ${{ inputs.build-type }}"
exit 1
fi
echo "source_build=$source_build"
echo "build-from-source=$source_build" >> $GITHUB_OUTPUT
- name: Set distribution output
id: distro
run: |
bfs_token=$(echo ${{ inputs.build-type }} | cut -d'-' -f1)
if [ "${bfs_token}" == "graal" ]
then
distro="graalvm"
elif [ "${bfs_token}" == "mandrel" ]
then
distro="mandrel"
else
echo "Unexpected input 'build-type' = ${{ inputs.build-type }}"
exit 1
fi
echo "distro=$distro"
echo "distribution=$distro" >> $GITHUB_OUTPUT
get-test-matrix:
name: Get test matrix
runs-on: ubuntu-latest
outputs:
quarkus-version: ${{ steps.version.outputs.quarkus-version }}
tests-matrix: ${{ steps.version.outputs.tests-matrix }}
artifacts-suffix: ${{ steps.suffix.outputs.suffix }}
steps:
- id: suffix
run: |
export SUFFIX=$(echo '${{ toJson(inputs) }}' | jq -j '. | to_entries[] | "-\(.value)"' | tr '":<>|*?\\r\n\/' '-')
echo $SUFFIX
echo "suffix=$SUFFIX" >> $GITHUB_OUTPUT
- name: Get Quarkus version and test matrix
id: version
run: |
if [ ${{ inputs.quarkus-version }} == "latest" ]
then
export QUARKUS_VERSION=$(curl -s https://repo1.maven.org/maven2/io/quarkus/quarkus-bom/maven-metadata.xml | awk -F"[<>]" '/Final/ {print $3}' | sort -V | tail -n 1)
elif $(expr match "${{ inputs.quarkus-version }}" "^.*\.\(Final\|CR\|Alpha\|Beta\)[0-9]\?$" > /dev/null)
then
export QUARKUS_VERSION=${{ inputs.quarkus-version }}
else
export QUARKUS_VERSION=$(git ls-remote ${GITHUB_SERVER_URL}/${{ inputs.quarkus-repo }} | grep "refs/heads/${{ inputs.quarkus-version }}$\|refs/tags/${{ inputs.quarkus-version }}$" | cut -f 1)
fi
if [ "$QUARKUS_VERSION" == "" ]
then
export QUARKUS_VERSION=${{ inputs.quarkus-version }}
fi
echo ${QUARKUS_VERSION}
echo "quarkus-version=${QUARKUS_VERSION}" >> $GITHUB_OUTPUT
curl --output native-tests.json https://raw.githubusercontent.com/${{ inputs.quarkus-repo }}/${QUARKUS_VERSION}/.github/native-tests.json
tests_json=$(tr -d '\n' < native-tests.json)
echo ${tests_json}
echo "tests-matrix=${tests_json}" >> $GITHUB_OUTPUT
build-mandrel:
name: Mandrel build
runs-on: windows-2022
needs:
- get-test-matrix
- build-vars
steps:
- uses: actions/checkout@v4
if: fromJson(needs.build-vars.outputs.build-from-source) == true && needs.build-vars.outputs.distribution == 'mandrel' #&& inputs.builder-image == 'null'
with:
repository: ${{ inputs.repo }}
fetch-depth: 1
ref: ${{ inputs.version }}
path: ${{ env.MANDREL_REPO }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Checkout MX
if: fromJson(needs.build-vars.outputs.build-from-source) == true && needs.build-vars.outputs.distribution == 'mandrel' #&& inputs.builder-image == 'null'
run: |
VERSION=$(jq -r .mx_version ${MANDREL_REPO}/common.json)
git clone ${GITHUB_SERVER_URL}/graalvm/mx --depth 1 --branch ${VERSION} mx
./mx/mx --version
shell: bash
- uses: actions/checkout@v4
if: fromJson(needs.build-vars.outputs.build-from-source) == true && needs.build-vars.outputs.distribution == 'mandrel' #&& inputs.builder-image == 'null'
with:
repository: ${{ inputs.mandrel-packaging-repo }}
ref: ${{ inputs.mandrel-packaging-version }}
path: ${{ env.MANDREL_PACKAGING_REPO }}
- uses: actions/cache@v4
if: fromJson(needs.build-vars.outputs.build-from-source) == true && needs.build-vars.outputs.distribution == 'mandrel' #&& inputs.builder-image == 'null'
with:
path: ~/.mx
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }}
restore-keys: ${{ runner.os }}-mx-
- name: Get OpenJDK with static libs
if: fromJson(needs.build-vars.outputs.build-from-source) == true && needs.build-vars.outputs.distribution == 'mandrel' #&& inputs.builder-image == 'null'
run: |
$wc = New-Object System.Net.WebClient
$wc.DownloadFile("https://api.adoptium.net/v3/binary/latest/${{ inputs.jdk }}/windows/x64/jdk/hotspot/normal/eclipse", "$Env:temp\jdk.zip")
Expand-Archive "$Env:temp\jdk.zip" -DestinationPath "$Env:temp"
Move-Item -Path "$Env:temp\jdk-*" -Destination $Env:JAVA_HOME
$wc.DownloadFile("https://api.adoptium.net/v3/binary/latest/${{ inputs.jdk }}/windows/x64/staticlibs/hotspot/normal/eclipse", "$Env:temp\jdk-staticlibs.zip")
Expand-Archive "$Env:temp\jdk-staticlibs.zip" -DestinationPath "$Env:temp"
Move-Item -Path "$Env:temp\jdk-*\lib\static" -Destination $Env:JAVA_HOME\lib\
Remove-Item -Recurse "$Env:temp\jdk-*"
& $Env:JAVA_HOME\bin\java -version
- name: Build Mandrel
if: fromJson(needs.build-vars.outputs.build-from-source) == true && needs.build-vars.outputs.distribution == 'mandrel' #&& inputs.builder-image == 'null'
run: |
cmd.exe /c "call `"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars64.txt"
Get-Content "$Env:temp\vcvars64.txt" | Foreach-Object {
if ($_ -match "^(.*?)=(.*)$") {
Set-Content "Env:\$($matches[1])" $matches[2]
}
}
Set-Location -Path $Env:MANDREL_PACKAGING_REPO
& $Env:JAVA_HOME\bin\java -ea build.java `
--mx-home $Env:MX_PATH `
--mandrel-repo $Env:MANDREL_REPO `
--mandrel-home $Env:MANDREL_HOME
if(!$?) { Exit $LASTEXITCODE }
& $Env:MANDREL_HOME\bin\native-image --version
if(!$?) { Exit $LASTEXITCODE }
Remove-Item -Recurse $Env:JAVA_HOME
Move-Item -Path $Env:MANDREL_HOME -Destination $Env:JAVA_HOME
- name: Archive JDK
if: fromJson(needs.build-vars.outputs.build-from-source) == true && needs.build-vars.outputs.distribution == 'mandrel' #&& inputs.builder-image == 'null'
shell: bash
run: tar czvf jdk.tgz -C $(dirname ${JAVA_HOME}) $(basename ${JAVA_HOME})
- name: Persist Mandrel build
if: fromJson(needs.build-vars.outputs.build-from-source) == true && needs.build-vars.outputs.distribution == 'mandrel' #&& inputs.builder-image == 'null'
uses: actions/upload-artifact@v4
with:
name: win-jdk-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: jdk.tgz
- name: Prepare failure archive (if maven failed)
if: failure()
shell: bash
run: find . -name '*svm_err_*pid*.md' | tar czvf test-reports.tgz -T -
- name: Upload failure Archive (if maven failed)
uses: actions/upload-artifact@v4
if: failure()
with:
name: mandrel-reports-native-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: 'test-reports.tgz'
build-graal:
name: GraalVM CE build
runs-on: windows-2022
needs:
- get-test-matrix
- build-vars
steps:
- uses: actions/checkout@v4
if: fromJson(needs.build-vars.outputs.build-from-source) == true && needs.build-vars.outputs.distribution == 'graalvm' #&& inputs.builder-image == 'null'
with:
repository: ${{ inputs.repo }}
fetch-depth: 1
ref: ${{ inputs.version }}
path: graal
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Checkout MX
if: fromJson(needs.build-vars.outputs.build-from-source) == true && needs.build-vars.outputs.distribution == 'graalvm' #&& inputs.builder-image == 'null'
run: |
VERSION=$(jq -r .mx_version graal/common.json)
git clone ${GITHUB_SERVER_URL}/graalvm/mx --depth 1 --branch ${VERSION} mx
./mx/mx --version
shell: bash
- uses: actions/cache@v4
if: fromJson(needs.build-vars.outputs.build-from-source) == true && needs.build-vars.outputs.distribution == 'graalvm' #&& inputs.builder-image == 'null'
with:
path: ~/.mx
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }}
restore-keys: ${{ runner.os }}-mx-
- name: Build graalvm native-image
if: fromJson(needs.build-vars.outputs.build-from-source) == true && needs.build-vars.outputs.distribution == 'graalvm' #&& inputs.builder-image == 'null'
run: |
cmd.exe /c "call `"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars64.txt"
Get-Content "$Env:temp\vcvars64.txt" | Foreach-Object {
if ($_ -match "^(.*?)=(.*)$") {
Set-Content "Env:\$($matches[1])" $matches[2]
}
}
Set-Location graal\substratevm
mkdir -p "$Env:temp\jdk-dl"
& $Env:MX_PATH\mx.cmd --java-home= fetch-jdk --java-distribution labsjdk-ce-$(("${{ inputs.jdk }}" -split "/")[0]) --to "$Env:temp\jdk-dl" --alias $Env:JAVA_HOME
& $Env:JAVA_HOME\bin\java --version
& $Env:MX_PATH\mx.cmd --native=native-image,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent --components="Native Image,LibGraal,svml" build
${graalvm-home} = @(& $Env:MX_PATH\mx.cmd --native=native-image,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent --components="Native Image,LibGraal,svml" graalvm-home)
rm -Recurse -Force $Env:JAVA_HOME
mv ${graalvm-home} $Env:JAVA_HOME
& $Env:JAVA_HOME\bin\native-image --version
- name: Archive JDK
if: fromJson(needs.build-vars.outputs.build-from-source) == true && needs.build-vars.outputs.distribution == 'graalvm' #&& inputs.builder-image == 'null'
shell: bash
run: tar czvf jdk.tgz -C $(dirname ${JAVA_HOME}) $(basename ${JAVA_HOME})
- name: Persist GraalVM CE build
if: fromJson(needs.build-vars.outputs.build-from-source) == true && needs.build-vars.outputs.distribution == 'graalvm' #&& inputs.builder-image == 'null'
uses: actions/upload-artifact@v4
with:
name: win-jdk-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: jdk.tgz
- name: Prepare failure archive (if maven failed)
if: failure()
shell: bash
run: find . -name '*svm_err_*pid*.md' | tar czvf test-reports.tgz -T -
- name: Upload failure Archive (if maven failed)
uses: actions/upload-artifact@v4
if: failure()
with:
name: graal-reports-native-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: 'test-reports.tgz'
get-jdk:
name: Get JDK ${{ inputs.jdk }}
runs-on: windows-2022
needs:
- get-test-matrix
- build-vars
steps:
- name: Get Mandrel ${{ inputs.version }}
if: fromJson(needs.build-vars.outputs.build-from-source) == false && needs.build-vars.outputs.distribution == 'mandrel' #&& inputs.builder-image == 'null'
run: |
$VERSION="${{ inputs.version }}"
$VERSION_SHORT=@($VERSION -replace 'mandrel-')
$wc = New-Object System.Net.WebClient
$url="$Env:GITHUB_SERVER_URL/graalvm/mandrel/releases/download/${VERSION}/mandrel-java$(("${{ inputs.jdk }}" -split "/")[0])-windows-amd64-${VERSION_SHORT}.zip"
$wc.DownloadFile($($url), "mandrel.zip")
Expand-Archive "mandrel.zip" -DestinationPath "$Env:temp"
Move-Item -Path "$Env:temp\mandrel-*" -Destination $Env:JAVA_HOME
& $Env:JAVA_HOME\bin\native-image --version
- name: Get GraalVM CE ${{ inputs.version }}
if: fromJson(needs.build-vars.outputs.build-from-source) == false && needs.build-vars.outputs.distribution == 'graalvm' #&& inputs.builder-image == 'null'
run: |
$VERSION="${{ inputs.version }}"
$VERSION_SHORT=@($VERSION -replace 'vm-')
$wc = New-Object System.Net.WebClient
$url="$Env:GITHUB_SERVER_URL/graalvm/graalvm-ce-builds/releases/download/${VERSION}/graalvm-ce-java$(("${{ inputs.jdk }}" -split "/")[0])-windows-amd64-${VERSION_SHORT}.zip"
$wc.DownloadFile($($url), "graalvm.zip")
Expand-Archive "graalvm.zip" -DestinationPath "$Env:temp"
Move-Item -Path "$Env:temp\graalvm-*" -Destination $Env:JAVA_HOME
& $Env:JAVA_HOME\bin\gu install native-image
& $Env:JAVA_HOME\bin\native-image --version
- name: Archive JDK
if: fromJson(needs.build-vars.outputs.build-from-source) == false
shell: bash
run: tar czvf jdk.tgz -C $(dirname ${JAVA_HOME}) $(basename ${JAVA_HOME})
- name: Persist Mandrel or GraalVM
if: fromJson(needs.build-vars.outputs.build-from-source) == false
uses: actions/upload-artifact@v4
with:
name: win-jdk-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: jdk.tgz
build-quarkus:
name: Quarkus build
runs-on: ubuntu-latest
needs:
- get-test-matrix
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
repository: graalvm/mandrel
fetch-depth: 1
path: workflow-mandrel
- uses: actions/checkout@v4
with:
repository: ${{ inputs.quarkus-repo }}
fetch-depth: 1
ref: ${{ needs.get-test-matrix.outputs.quarkus-version }}
path: quarkus
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: base-windows-${{ needs.get-test-matrix.outputs.quarkus-version }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: base-windows-${{ needs.get-test-matrix.outputs.quarkus-version }}-maven-
- name: Change quarkus.version for Quarkus 2.2 to make mandrel-integration-test not apply quarkus_main.patch
# See https://github.com/Karm/mandrel-integration-tests/pull/64
shell: bash
run: |
if [ "${{ inputs.quarkus-version }}" == "2.2" ]
then
cd quarkus
bash ../workflow-mandrel/.github/update_quarkus_version.sh 2.2.999
fi
# Use Java 17 to build Quarkus as that's the lowest supported JDK version currently
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Build quarkus
run: |
cd quarkus
./mvnw ${COMMON_MAVEN_ARGS} -Dquickly
- name: Tar Maven Repo
shell: bash
run: tar -I 'pigz -9' -cf maven-repo.tgz -C ~ .m2/repository
- name: Persist Maven Repo
uses: actions/upload-artifact@v4
with:
name: win-maven-repo-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: maven-repo.tgz
- name: Delete Local Artifacts From Cache
shell: bash
run: rm -r ~/.m2/repository/io/quarkus
native-tests:
name: Q IT ${{ matrix.category }}
needs:
- build-quarkus
- build-mandrel
- build-graal
- get-jdk
- get-test-matrix
runs-on: windows-2022
env:
# leave more space for the actual native compilation and execution
MAVEN_OPTS: -Xmx1g
# USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM: false
# Ignore the following YAML Schema error
timeout-minutes: ${{matrix.timeout}}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.get-test-matrix.outputs.tests-matrix) }}
steps:
- name: Support longpaths on Windows
run: git config --global core.longpaths true
- uses: actions/checkout@v4
with:
repository: graalvm/mandrel
fetch-depth: 1
path: workflow-mandrel
- name: Download Maven Repo
if: startsWith(matrix.os-name, 'windows')
uses: actions/download-artifact@v4
with:
name: win-maven-repo-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: .
- name: Extract Maven Repo
if: startsWith(matrix.os-name, 'windows')
shell: bash
run: tar -xzf maven-repo.tgz -C ~
- uses: actions/checkout@v4
if: startsWith(matrix.os-name, 'windows')
with:
repository: ${{ inputs.quarkus-repo }}
fetch-depth: 1
ref: ${{ needs.get-test-matrix.outputs.quarkus-version }}
path: ${{ env.QUARKUS_PATH }}
- uses: actions/cache@v4
if: startsWith(matrix.os-name, 'windows')
with:
path: ~/.m2/repository
key: base-windows-${{ needs.get-test-matrix.outputs.quarkus-version }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: base-windows-${{ needs.get-test-matrix.outputs.quarkus-version }}-maven-
# Use Java 17 for Quarkus as it doesn't work with Java 21 yet
- uses: actions/setup-java@v4
if: startsWith(matrix.os-name, 'windows')
with:
distribution: 'temurin'
java-version: '17'
- name: Download Mandrel or GraalVM
if: startsWith(matrix.os-name, 'windows')
uses: actions/download-artifact@v4
with:
name: win-jdk-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: .
- name: Extract Mandrel or GraalVM
if: startsWith(matrix.os-name, 'windows')
shell: bash
run: |
mkdir -p "${GRAALVM_HOME}"
tar -xzvf jdk.tgz -C graalvm-home --strip-components=1
${GRAALVM_HOME}/bin/java -version
# - name: Reclaim disk space
# shell: bash
# run: ${QUARKUS_PATH}/.github/ci-prerequisites.sh
# We do this so we can get better analytics for the downloaded version of the build images
- name: Update Docker Client User Agent
if: startsWith(matrix.os-name, 'windows')
shell: bash
run: |
if [ -f ~/.docker/config.json ]; then
cat <<< $(jq '.HttpHeaders += {"User-Agent": "Mandrel-CI-Docker-Client"}' ~/.docker/config.json) > ~/.docker/config.json.new
mv ~/.docker/config.json.new ~/.docker/config.json
fi
- name: Change quarkus.version for Quarkus 2.2 to make mandrel-integration-test not apply quarkus_main.patch
if: startsWith(matrix.os-name, 'windows')
# See https://github.com/Karm/mandrel-integration-tests/pull/64
shell: bash
run: |
if [ "${{ inputs.quarkus-version }}" == "2.2" ]
then
cd quarkus
bash ../workflow-mandrel/.github/update_quarkus_version.sh 2.2.999
fi
- name: Build with Maven
if: startsWith(matrix.os-name, 'windows')
env:
TEST_MODULES: ${{matrix.test-modules}}
CATEGORY: ${{matrix.category}}
run: |
cmd.exe /c "call `"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars64.txt"
Get-Content "$Env:temp\vcvars64.txt" | Foreach-Object {
if ($_ -match "^(.*?)=(.*)$") {
Set-Content "Env:\$($matches[1])" $matches[2]
}
}
cd $Env:QUARKUS_PATH
Write-Host "$Env:GRAALVM_HOME"
if (Test-Path "$Env:GRAALVM_HOME/bin/native-image" -PathType leaf) {
& "$Env:GRAALVM_HOME/bin/native-image" --version
}
$opts=@()
-split $Env:NATIVE_TEST_MAVEN_OPTS | foreach { $opts += "`"$_`"" }
#if ( "${{ inputs.builder-image }}" -eq "null" ) {
mvn -f integration-tests -pl "$Env:TEST_MODULES" -amd "-Dquarkus.native.container-build=false" $opts install
#} else {
# mvn -pl $do_modules "-Dquarkus.native.container-build=true" "-Dquarkus.native.builder-image=${{ inputs.builder-image }}" $opts package
#}
- name: Prepare failure archive (if maven failed)
if: failure()
shell: bash
run: find . -type d -name '*-reports' -o -wholename '*/build/reports/tests/functionalTest' -o -name '*svm_err_*pid*.md' | tar czvf test-reports.tgz -T -
- name: Upload failure Archive (if maven failed)
uses: actions/upload-artifact@v4
if: failure()
with:
name: win-test-reports-native-${{matrix.category}}-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: 'test-reports.tgz'
- name: Collect build JSON stats
if: ${{ startsWith(matrix.os-name, 'windows') && inputs.build-stats-tag != 'null' }}
shell: bash
run: find . -name '*runner*.json' | tar czvf build-stats.tgz -T -
- name: Upload build JSON stats
if: ${{ startsWith(matrix.os-name, 'windows') && inputs.build-stats-tag != 'null' }}
uses: actions/upload-artifact@v4
with:
name: build-stats-${{matrix.category}}-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: 'build-stats.tgz'
native-tests-stats-upload:
name: Upload build stats to collector
if: ${{ always() && inputs.build-stats-tag != 'null' && github.event_name != 'pull_request' }}
needs:
- native-tests
- get-test-matrix
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.get-test-matrix.outputs.tests-matrix) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
if: startsWith(matrix.os-name, 'windows')
with:
repository: graalvm/mandrel
fetch-depth: 1
path: workflow-mandrel
- uses: actions/download-artifact@v4
if: startsWith(matrix.os-name, 'windows')
with:
name: build-stats-${{matrix.category}}-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: .
- name: Extract and import build stats
if: startsWith(matrix.os-name, 'windows')
env:
UPLOAD_TOKEN: ${{ secrets.UPLOAD_COLLECTOR_TOKEN }}
shell: bash
run: |
tar -xf build-stats.tgz
export BUILD_STATS_TAG="$(echo ${{ inputs.build-stats-tag }})"
echo "Tag for stat upload is going to be: '${BUILD_STATS_TAG}'"
DIR=quarkus/ TAG="${BUILD_STATS_TAG}" TOKEN="${UPLOAD_TOKEN}" URL="${COLLECTOR_URL}" bash workflow-mandrel/.github/import_stats.sh
mandrel-integration-tests:
name: Q Mandrel IT
if: ${{ needs.build-vars.outputs.distribution == 'mandrel' }}
needs:
- build-vars
- build-mandrel
- get-jdk
- build-quarkus
- get-test-matrix
runs-on: windows-2022
env:
# leave more space for the actual native compilation and execution
MAVEN_OPTS: -Xmx1g
# Don't perform performance checks since GH runners are not that stable
FAIL_ON_PERF_REGRESSION: false
# USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM: false
timeout-minutes: 40
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
repository: graalvm/mandrel
fetch-depth: 1
path: workflow-mandrel
- uses: actions/checkout@v4
with:
repository: Karm/mandrel-integration-tests
fetch-depth: 1
- name: Download Maven Repo
uses: actions/download-artifact@v4
with:
name: win-maven-repo-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: .
- name: Extract Maven Repo
shell: bash
run: tar -xzvf maven-repo.tgz -C ~
# Use Java 17 for Quarkus as it doesn't work with Java 21 yet
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Download Mandrel or GraalVM
uses: actions/download-artifact@v4
with:
name: win-jdk-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: .
- name: Extract Mandrel or GraalVM
shell: bash
run: |
mkdir -p "${GRAALVM_HOME}"
tar -xzvf jdk.tgz -C graalvm-home --strip-components=1
${GRAALVM_HOME}/bin/java -version
- name: Update Docker Client User Agent
shell: bash
run: |
if [ -f ~/.docker/config.json ]; then
cat <<< $(jq '.HttpHeaders += {"User-Agent": "Mandrel-CI-Docker-Client"}' ~/.docker/config.json) > ~/.docker/config.json.new
mv ~/.docker/config.json.new ~/.docker/config.json
fi
- name: Build with Maven
run: |
cmd.exe /c "call `"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars64.txt"
Get-Content "$Env:temp\vcvars64.txt" | Foreach-Object {
if ($_ -match "^(.*?)=(.*)$") {
Set-Content "Env:\$($matches[1])" $matches[2]
}
}
$Env:PATH="$Env:GRAALVM_HOME\bin;$Env:PATH"
if (Test-Path "$Env:GRAALVM_HOME\bin\native-image.cmd" -PathType leaf) {
& "$Env:GRAALVM_HOME\bin\native-image" --version
} else {
Write-Host "Cannot find native-image tool. Quitting..."
exit 1
}
$QUARKUS_VERSION="${{ needs.get-test-matrix.outputs.quarkus-version }}"
# Don't use SNAPSHOT version for 2.2 and release tags
if ("${{ inputs.quarkus-version }}" -eq "2.2") {
$QUARKUS_VERSION="2.2.999"
} elseif (${{ inputs.quarkus-version }} -match "^[0-9]+\.[0-9]+$") {
$QUARKUS_VERSION="${{ inputs.quarkus-version }}.999-SNAPSHOT"
} elseif (! ($QUARKUS_VERSION -match "^.*\.(Final|CR|Alpha|Beta)[0-9]?$")) {
$QUARKUS_VERSION="999-SNAPSHOT"
}
Write-Host "$QUARKUS_VERSION"
mvn clean verify "-Dquarkus.native.native-image-xmx=5g" "-Dquarkus.version=$QUARKUS_VERSION" -Ptestsuite
- name: Prepare failure archive (if maven failed)
if: failure()
shell: bash
run: tar czvf test-reports-mandrel-it.tgz ./testsuite/target/archived-logs/
- name: Upload failure Archive (if maven failed)
uses: actions/upload-artifact@v4
if: failure()
with:
name: win-test-reports-mandrel-it-${{ needs.get-test-matrix.outputs.artifacts-suffix }}
path: 'test-reports-mandrel-it.tgz'