Repository navigation
1496 lines (1485 loc) · 73.3 KB
/
Copy pathvalidation.yml
File metadata and controls
1496 lines (1485 loc) · 73.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
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
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Flow Validation
on:
push:
branches: ['25.3', '25.2', '25.1', '25.0', '24.10', '24.9', '24.8', '24.7', '24.6', '24.5', '24.4', '23.7', '23.6']
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]
# Deliberately unfiltered by base branch so that PRs stacked on another
# feature branch are validated too, not only those targeting main.
# PRs against a maintenance branch run that branch's own copy of this file.
merge_group:
permissions:
contents: read
concurrency:
# The merge queue reuses the same branch name (gh-readonly-queue/<base>/pr-<n>-<base sha>)
# for every merge group built from the same PR and base commit, so the group has to be keyed
# on the merge group's own head sha. Otherwise re-running an obsolete merge queue validation
# cancels the run validating the current merge group, which ejects the PR from the queue.
group: ${{ github.workflow }}-${{ github.event.merge_group.head_sha || github.head_ref || github.ref_name }}
cancel-in-progress: true
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
_HEAD_REF: ${{ github.head_ref }}
_REF_NAME: ${{ github.ref_name }}
_MERGE_GROUP_SHA: ${{ github.event.merge_group.head_sha }}
_MERGE_GROUP_BASE_SHA: ${{ github.event.merge_group.base_sha }}
_MERGE_GROUP_BASE_REF: ${{ github.event.merge_group.base_ref }}
_BASE_REF: ${{ github.event.pull_request.base.ref }}
_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
_PR_NUMBER: ${{ github.event.number }}
# Picked up by every mvn this workflow starts, including the ones the plugin
# integration tests fork, which is why it is set here rather than on the
# steps that download the most.
#
# Maven 3.9 resolves over maven-resolver's own HTTP transport, which reads
# aether.connector.* and ignores the maven.wagon.* equivalents the `Run ITs`
# step used to pass, so that step was not retrying anything and no other one
# asked to. Central answers a client it has blocked with 403, and the retry
# handler treats a status outside its retryable list as the final answer:
# that list defaults to 429,503, so a 403 failed the build on the first
# artifact a job asked for. The other 5xx statuses Central returns while it
# is overloaded or behind a failing proxy (500, 502, 504) are just as
# transient. connectionMaxTtl keeps the 25 seconds the wagon property was
# meant to set, against a resolver default of 300.
#
# The global settings file resolves Central through Google's mirror, because
# Central rate-limits the IP ranges GitHub-hosted runners share with every
# other project, and reads the public repository groups on
# repository.jboss.org from that mirror too. JBoss parent poms the
# wildfly-maven-plugin pulls in list that host ahead of Central for some
# BOMs, and when it answers 503 the retries above held the JBoss EAP dev loop
# job for up to 11 minutes before its tests started. See the comment in that
# file. The path is absolute because tests fork mvn from module directories.
MAVEN_ARGS: >-
-gs ${{ github.workspace }}/.github/maven/settings.xml
-Daether.connector.http.retryHandler.count=3
-Daether.connector.http.retryHandler.serviceUnavailable=429,500,502,503,504,403
-Daether.connector.http.connectionMaxTtl=25
jobs:
changes:
name: Detect docs-only changes
# A change that only touches Markdown in the repository root or in
# guidelines/ cannot affect the build or any test, so build is skipped for
# it and every job that needs build is skipped with it. A skipped job
# counts as passed for the required checks, which is why test-results only
# stands down when this job positively reports docs-only: if this job
# fails, build is skipped too and test-results reports the failure.
# Same diff base as the gated test jobs below: a push or a manual run has
# nothing to compare against and always builds.
timeout-minutes: 10
runs-on: ubuntu-26.04
outputs:
docs-only: ${{ steps.decide.outputs.docs-only }}
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
ref: ${{env._HEAD_SHA}}
fetch-depth: 0 # Full history required to diff against the merge base
- name: Decide whether only docs changed
id: decide
run: |
set -euo pipefail
docs_only=false
DIFF_BASE=
case "$GITHUB_EVENT_NAME" in
pull_request)
if git fetch --no-tags origin \
"+refs/heads/$_BASE_REF:refs/remotes/origin/$_BASE_REF"; then
DIFF_BASE=$(git merge-base HEAD "refs/remotes/origin/$_BASE_REF" || true)
fi
;;
merge_group)
DIFF_BASE=$_MERGE_GROUP_BASE_SHA
;;
*)
;;
esac
if [ -z "$DIFF_BASE" ]; then
echo "No base to compare against, running the build."
elif ! CHANGED=$(git diff --name-only --no-renames "$DIFF_BASE" HEAD); then
echo "Could not diff against $DIFF_BASE, running the build."
elif [ -z "$CHANGED" ]; then
echo "No changed files found, running the build."
else
OTHER=$(printf '%s\n' "$CHANGED" | grep -vE '^([^/]+|guidelines/.+)\.md$' || true)
if [ -z "$OTHER" ]; then
echo "Only Markdown docs in the root or guidelines/ changed, skipping build and tests:" \
| tee -a "$GITHUB_STEP_SUMMARY"
printf '%s\n' "$CHANGED" | tee -a "$GITHUB_STEP_SUMMARY"
docs_only=true
else
echo "Changes that need the build:"
printf '%s\n' "$OTHER"
fi
fi
echo "docs-only=$docs_only" >> "$GITHUB_OUTPUT"
build:
needs: changes
if: ${{ needs.changes.outputs.docs-only != 'true' }}
timeout-minutes: 30
runs-on: ubuntu-26.04
outputs:
matrix-unit: ${{ steps.set-matrix.outputs.matrix-unit }}
matrix-it: ${{ steps.set-matrix.outputs.matrix-it }}
matrix-quarkus: ${{ steps.set-matrix.outputs.matrix-quarkus }}
steps:
- run: echo "Concurrency Group = $GITHUB_WORKFLOW-${_MERGE_GROUP_SHA:-${_HEAD_REF:-$_REF_NAME}}"
- name: Check secrets
if: ${{ !github.event.pull_request.head.repo.fork }}
env:
TB_LICENSE: ${{ secrets.TB_LICENSE }}
run: |
[ -z "$TB_LICENSE" ] \
&& echo "🚫 **TB_LICENSE** is not defined, check that **${{github.repository}}** repo has a valid secret" \
| tee -a $GITHUB_STEP_SUMMARY && exit 1 || exit 0
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
ref: ${{env._HEAD_SHA}}
- uses: ./.github/actions/setup-frontend-tools
- name: Set up JDK
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version-file: .tool-versions
distribution: 'temurin'
- name: Set flow version to 999.99-SNAPSHOT
run: |
./scripts/computeMatrix.js set-version --version=999.99-SNAPSHOT
- name: Hash the poms
id: pom-hash
# Once, before anything is built: the build below unpacks a war that
# carries a pom.xml of its own, so hashFiles evaluated after it no
# longer matches the key the entry was restored and saved under.
run: echo "hash=${{ hashFiles('**/pom.xml') }}" >> "$GITHUB_OUTPUT"
- id: maven-cache
# Restore and save are separate steps so that the step resolving the
# integration test dependencies below can tell which entry was
# restored, which actions/cache does not report.
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ steps.pom-hash.outputs.hash }}
restore-keys: ${{ runner.os }}-maven-
- name: Test the slow-tests module list
run: node --test scripts/computeMatrix.test.js
- name: Generate matrices
id: set-matrix
run: |
echo "matrix-it=$(./scripts/computeMatrix.js it-tests --parallel=17 current module args)" >> $GITHUB_OUTPUT
echo "matrix-unit=$(./scripts/computeMatrix.js unit-tests --parallel=4 current module args)" >> $GITHUB_OUTPUT
echo "matrix-quarkus=$(./scripts/computeMatrix.js quarkus-tests)" >> $GITHUB_OUTPUT
- name: Set TB License
# Building test-prod-bundle validates the license on the maintenance
# branches that check it.
env:
TB_LICENSE: ${{ secrets.TB_LICENSE }}
run: |
mkdir -p ~/.vaadin/
echo '{"username":"'$(echo $TB_LICENSE | cut -d / -f1)'","proKey":"'$(echo $TB_LICENSE | cut -d / -f2)'"}' > ~/.vaadin/proKey
- name: Compile and Install Flow
# -Pcoverage only so that the JaCoCo plugin the unit-tests jobs run
# enters the cache this job saves: those jobs restore it with an exact
# hit, so actions/cache skips their save, and all of them would
# otherwise download the plugin from Maven Central at once, which
# answers that burst with HTTP 429. With the tests skipped the plugin
# only sets a property and skips its report.
run: |
cmd="mvn install -B -ntp -DskipTests -Pcoverage -pl \!flow-plugins/flow-gradle-plugin"
eval $cmd -T 2C -q || eval $cmd
- name: Resolve what only the integration test modules pull
# The it-tests jobs restore the cache this job saves, and cannot add to
# it: their primary key is an exact hit, so actions/cache skips their
# save. So the dependencies and plugins only flow-tests declares have to
# enter the entry here. Otherwise a pom change, such as a dependency
# bump, has every it-tests job download the same new artifacts from
# Maven Central at once, and Central answers that burst with HTTP 429.
# The Quarkus suite, which is not part of the flow-tests reactor, is
# resolved here too. What plugins fetch only while they run, and the
# reactor of the CDI job, are not covered.
#
# Skipped when what was restored already holds it: an exact hit, or
# the entry warm-caches.yml saved for main with these same poms, which
# resolves the same graph. A run's own primary key almost never hits,
# since only a re-run or a later push to the same pull request can
# read it, so the warmed entry is the common case.
#
# dependency:resolve rather than a build, which would cost this job the
# time the it-tests jobs spend on it anyway; see the script for how it
# handles the test modules that are not packaged here.
if: ${{ steps.maven-cache.outputs.cache-hit != 'true' && steps.maven-cache.outputs.cache-matched-key != format('{0}-maven-warm-v3-{1}', runner.os, steps.pom-hash.outputs.hash) }}
run: ./scripts/resolveItDependencies.sh
- uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
if: ${{ steps.maven-cache.outputs.cache-hit != 'true' }}
with:
path: ~/.m2/repository
key: ${{ steps.maven-cache.outputs.cache-primary-key }}
- name: Save workspace
run: |
tar cf workspace.tar -C ~/ $(cd ~/ && echo .m2/repository/com/vaadin/*/999.99-SNAPSHOT)
tar rf workspace.tar $(find . -d -name target)
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: saved-workspace
path: workspace.tar
unit-tests:
needs: build
if: ${{ !github.event.pull_request.head.repo.fork }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix: ${{fromJson(needs.build.outputs.matrix-unit)}}
runs-on: ubuntu-26.04
steps:
# Keep in sync with the job's timeout-minutes: a retry of a Maven build
# must end before the job timeout cancels it and hides the transfer
# error that caused it. The minute left over is for the report, upload
# and cache-save steps that run after the build.
- name: Set retry deadline
run: echo "MAVEN_RETRY_DEADLINE=$(( $(date +%s) + 29 * 60 ))" >> "$GITHUB_ENV"
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
ref: ${{env._HEAD_SHA}}
- name: Set up JDK
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version-file: .tool-versions
distribution: 'temurin'
- name: Set flow version to 999.99-SNAPSHOT
run: |
./scripts/computeMatrix.js set-version --version=999.99-SNAPSHOT
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
if: ${{ github.run_attempt == 1 }}
with:
name: saved-workspace
- name: Restore Workspace
if: ${{ github.run_attempt == 1 }}
run: |
set -x
tar xf workspace.tar
tar cf - .m2 | (cd ~ && tar xf -)
- name: Set TB License
# Written before the fallback compile below, so a re-run does
# not build the reactor without a license.
env:
TB_LICENSE: ${{ secrets.TB_LICENSE }}
run: |
mkdir -p ~/.vaadin/
echo '{"username":"'$(echo $TB_LICENSE | cut -d / -f1)'","proKey":"'$(echo $TB_LICENSE | cut -d / -f2)'"}' > ~/.vaadin/proKey
- name: Compile and Install Flow
if: ${{ github.run_attempt > 1 }}
run: |
./scripts/computeMatrix.js set-version --version=999.99-SNAPSHOT
cmd="mvn install -B -ntp -DskipTests -pl \!flow-plugins/flow-gradle-plugin"
eval $cmd -T 2C -q || eval $cmd
- name: Route Gradle through the Central mirror
# The matrix job that includes flow-gradle-plugin builds it through
# exec-maven-plugin, which runs Gradle without --init-script and with
# an empty Gradle home, so the plugin resolution goes to Central via
# the Plugin Portal and fails with 429. A script in ~/.gradle/init.d
# reaches that Gradle run as well.
run: |
mkdir -p ~/.gradle/init.d
cp .github/gradle/central-mirror.init.gradle ~/.gradle/init.d/
- name: Unit Test
# A full run's expected length, generously above the longest seen, for
# runMavenWithRetry.sh to size a retry by: a transfer error usually
# stops the build within a minute.
env:
MAVEN_RETRY_DURATION: 600
run: |
echo Running TESTS: ${{ strategy.job-index }} ${{matrix.module}} ${{ matrix.args }}
[ -n "${{matrix.module}}" ] && \
ARGS="-pl ${{matrix.module}} -Dtest=${{matrix.args}}" || \
ARGS="-pl ${{matrix.args}}"
args="-B -ntp -T 1C -Pcoverage $ARGS"
set -x -e
scripts/runMavenWithRetry.sh mvn-unit-tests-${{matrix.current}}.out \
$args verify -Dmaven.javadoc.skip=false
- name: Package coverage reports
# Some modules (see moduleSplits in computeMatrix.js) run their tests
# split over several matrix jobs, each producing a partial
# target/site/jacoco/jacoco.xml for the same module. Rename the
# reports with the matrix index so the Sonar job can extract all
# archives without them overwriting each other; Sonar merges the
# partial reports.
run: |
find . -path '*/target/site/jacoco/jacoco.xml' | while read -r f; do
mv "$f" "${f%/jacoco.xml}/jacoco-unit-${{matrix.current}}.xml"
done
find . -path '*/target/site/jacoco/jacoco-unit-*.xml' \
| tar -czf coverage-unit-${{matrix.current}}.tgz -T -
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-unit-${{ matrix.current }}
path: coverage-unit-*.tgz
- name: Convert Javadoc errors to JUnit XML
if: ${{ failure() }}
run: |
LOG=mvn-unit-tests-${{matrix.current}}.out
if [ -f "$LOG" ]; then
python3 ./scripts/javadocErrorsToJUnit.py \
"$LOG" \
"flow-server/target/surefire-reports/TEST-Javadoc-${{matrix.current}}.xml"
fi
- name: Kill leftover Java processes
if: ${{ always() }}
run: |
pkill -TERM java || true
sleep 2
pkill -KILL java || true
- name: Package test-report files
if: ${{ failure() || success() }}
run: find . -name surefire-reports -o -name failsafe-reports -o -name error-screenshots -o -name "mvn-*.out" | tar -czf tests-report-unit-${{matrix.current}}.tgz -T -
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ failure() || success() }}
with:
name: tests-output-unit-${{ matrix.current }}
path: tests-report-*.tgz
it-tests:
needs: build
if: ${{ !github.event.pull_request.head.repo.fork }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix: ${{fromJson(needs.build.outputs.matrix-it)}}
runs-on: ubuntu-26.04
steps:
# Keep in sync with the job's timeout-minutes: a retry of a Maven build
# must end before the job timeout cancels it and hides the transfer
# error that caused it. The minute left over is for the report, upload
# and cache-save steps that run after the build.
- name: Set retry deadline
run: echo "MAVEN_RETRY_DEADLINE=$(( $(date +%s) + 29 * 60 ))" >> "$GITHUB_ENV"
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
ref: ${{env._HEAD_SHA}}
- uses: ./.github/actions/setup-frontend-tools
with:
pnpm: true
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 'latest'
- name: Set up JDK
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version-file: .tool-versions
distribution: 'temurin'
- name: Set flow version to 999.99-SNAPSHOT
run: |
./scripts/computeMatrix.js set-version --version=999.99-SNAPSHOT
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
if: ${{ github.run_attempt == 1 }}
with:
name: saved-workspace
- name: Restore Workspace
if: ${{ github.run_attempt == 1 }}
run: |
tar xf workspace.tar
tar cf - .m2 | (cd ~ && tar xf -)
- name: Set TB License
# Written before the fallback compile below, so a re-run does
# not build the reactor without a license.
env:
TB_LICENSE: ${{ secrets.TB_LICENSE }}
run: |
mkdir -p ~/.vaadin/
echo '{"username":"'$(echo $TB_LICENSE | cut -d / -f1)'","proKey":"'$(echo $TB_LICENSE | cut -d / -f2)'"}' > ~/.vaadin/proKey
- name: Compile and Install Flow
if: ${{ github.run_attempt > 1 }}
run: |
./scripts/computeMatrix.js set-version --version=999.99-SNAPSHOT
cmd="mvn install -B -ntp -DskipTests -pl \!flow-plugins/flow-gradle-plugin"
eval $cmd -T 2C -q || eval $cmd
- name: Compile Shared modules
run: |
if [ ${{matrix.current}} -eq 2 -o ${{matrix.current}} -eq 3 ]; then
cmd="mvn install -B -ntp -DskipTests -Pit-shared-modules -amd -pl flow-tests"
$cmd -T 1C || $cmd
fi
if [ ${{matrix.current}} -eq 4 -o ${{matrix.current}} -eq 5 -o ${{matrix.current}} -eq 6 ]; then
cmd="mvn install -B -ntp -DskipTests -Pit-shared-spring-modules -amd -pl flow-tests"
$cmd -T 1C || $cmd
fi
if [ ${{matrix.current}} -eq 7 ]; then
cmd="mvn install -B -ntp -DskipTests -f flow-tests/test-devloop/pom.xml -pl test-devloop-spring/devloop-shared,test-devloop-jetty/devloop-shared -am"
$cmd || $cmd
fi
- name: Run ITs
timeout-minutes: 22
# A full run's expected length, generously above the longest seen, for
# runMavenWithRetry.sh to size a retry by: a transfer error usually
# stops the build within a minute.
env:
MAVEN_RETRY_DURATION: 1080
run: |
[ -n "${{matrix.module}}" ] && \
ARGS="-Dfailsafe.forkCount=4 -pl ${{matrix.module}} -Dit.test=${{matrix.args}}" || \
ARGS="-pl ${{matrix.args}}"
args="-V -B -ntp -e -fae -Dcom.vaadin.testbench.Parameters.testsInParallel=5 -Dfailsafe.rerunFailingTestsCount=2 -Dbun $ARGS"
set -x -e
# Detaches mvn's stdio from this shell so an orphan child JVM (e.g. a
# Spring Boot fork that spring-boot:stop failed to kill) can't pin
# the step open by holding the pipe to tee, and retries a build that
# failed to download from a repository.
# Keep in sync with this step's timeout-minutes: a retry must end
# before the step timeout too, when that comes before the job's.
step_deadline=$(( $(date +%s) + 21 * 60 ))
[ "$step_deadline" -lt "$MAVEN_RETRY_DEADLINE" ] && MAVEN_RETRY_DEADLINE=$step_deadline
scripts/runMavenWithRetry.sh mvn-it-tests-${{matrix.current}}.out $args verify
- name: Kill leftover Java processes
if: ${{ always() }}
run: |
pkill -TERM java || true
sleep 2
pkill -KILL java || true
- name: Package test-report files
if: ${{ always() }}
run: find . -name surefire-reports -o -name failsafe-reports -o -name error-screenshots -o -name "mvn-*.out" -o -name "jetty-start.out" -o -path "*/target/devloop/*.log" | tar -czf tests-report-it-${{matrix.current}}.tgz -T -
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ always() }}
with:
name: tests-output-it-${{ matrix.current }}
path: tests-report-*.tgz
cdi-tests:
name: CDI Tests (${{ matrix.profile }})
# The CDI integration tests deploy to a real application server, which the
# generic it-tests matrix cannot express, so computeMatrix.js excludes the
# module and it runs here instead. Every change runs the tomee profile as
# a smoke test; the other four containers only run when the CDI sources
# themselves change, since that is when a container specific regression
# gets introduced. Needs the TestBench licence, so not for forks.
needs: build
if: ${{ !github.event.pull_request.head.repo.fork }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
profile: [tomee, wildfly, payara, liberty, tomcat-weld]
runs-on: ubuntu-26.04
steps:
# Keep in sync with the job's timeout-minutes: a retry of a Maven build
# must end before the job timeout cancels it and hides the transfer
# error that caused it. The minute left over is for the report, upload
# and cache-save steps that run after the build.
- name: Set retry deadline
run: echo "MAVEN_RETRY_DEADLINE=$(( $(date +%s) + 44 * 60 ))" >> "$GITHUB_ENV"
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
ref: ${{env._HEAD_SHA}}
# Full history only where the step below actually diffs. tomee is
# ungated, so cloning the whole repository for it buys nothing.
fetch-depth: ${{ matrix.profile == 'tomee' && 1 || 0 }}
- name: Decide whether to run
# Same gating as gradle-tests below: a push or a manual run has nothing
# to compare against, and a gate that cannot tell what changed has to
# run the job rather than report green.
#
# The root pom counts as a CDI source: it manages weld.version, which
# the tomcat-weld profile resolves weld-servlet-shaded from, so a bump
# there is exactly the kind of change only the gated containers see.
id: decide
run: |
set -euo pipefail
run=true
if [ "${{ matrix.profile }}" != "tomee" ]; then
DIFF_BASE=
case "$GITHUB_EVENT_NAME" in
pull_request)
if git fetch --no-tags origin \
"+refs/heads/$_BASE_REF:refs/remotes/origin/$_BASE_REF"; then
DIFF_BASE=$(git merge-base HEAD "refs/remotes/origin/$_BASE_REF" || true)
fi
;;
merge_group)
DIFF_BASE=$_MERGE_GROUP_BASE_SHA
;;
*)
;;
esac
if [ -z "$DIFF_BASE" ]; then
echo "No base to compare against, running every container."
elif ! CHANGED=$(git diff --name-only "$DIFF_BASE" HEAD); then
echo "Could not diff against $DIFF_BASE, running every container."
else
RELEVANT=$(printf '%s\n' "$CHANGED" | grep -E \
'^(vaadin-cdi/|flow-tests/vaadin-cdi-tests/|pom\.xml$|\.github/workflows/validation\.yml$)' || true)
if [ -z "$RELEVANT" ]; then
echo "No changes to the CDI modules, tomee alone covers this."
run=false
else
echo "Changes to the CDI modules:"
printf '%s\n' "$RELEVANT"
fi
fi
fi
echo "run=$run" >> "$GITHUB_OUTPUT"
- uses: ./.github/actions/setup-frontend-tools
if: ${{ steps.decide.outputs.run == 'true' }}
with:
pnpm: true
- name: Set up JDK
if: ${{ steps.decide.outputs.run == 'true' }}
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version-file: .tool-versions
distribution: 'temurin'
- name: Set flow version to 999.99-SNAPSHOT
if: ${{ steps.decide.outputs.run == 'true' }}
run: |
./scripts/computeMatrix.js set-version --version=999.99-SNAPSHOT
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
if: ${{ steps.decide.outputs.run == 'true' }}
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
if: ${{ steps.decide.outputs.run == 'true' && github.run_attempt == 1 }}
with:
name: saved-workspace
- name: Restore Workspace
if: ${{ steps.decide.outputs.run == 'true' && github.run_attempt == 1 }}
run: |
tar xf workspace.tar
tar cf - .m2 | (cd ~ && tar xf -)
- name: Set TB License
# Written before the fallback compile below, so a re-run does
# not build the reactor without a license.
if: ${{ steps.decide.outputs.run == 'true' }}
env:
TB_LICENSE: ${{ secrets.TB_LICENSE }}
run: |
mkdir -p ~/.vaadin/
echo '{"username":"'$(echo $TB_LICENSE | cut -d / -f1)'","proKey":"'$(echo $TB_LICENSE | cut -d / -f2)'"}' > ~/.vaadin/proKey
- name: Compile and Install Flow
if: ${{ steps.decide.outputs.run == 'true' && github.run_attempt > 1 }}
run: |
./scripts/computeMatrix.js set-version --version=999.99-SNAPSHOT
cmd="mvn install -B -ntp -DskipTests -pl \!flow-plugins/flow-gradle-plugin"
eval $cmd -T 2C -q || eval $cmd
- name: Verify the no-container build skips its tests
# cdi.container.tests.skip only takes effect when no container profile
# is active, which no other job exercises: the module lives in the
# it-test-modules profile, so `mvn install -DskipTests` leaves it out,
# and every leg below passes -P<container>. Assert it here, once, so a
# regression surfaces in CI rather than in someone's `mvn verify` over
# flow-tests.
if: ${{ steps.decide.outputs.run == 'true' && matrix.profile == 'tomee' }}
run: |
set -e
LOG=mvn-cdi-no-profile.out
mvn -B -ntp -e -pl flow-tests/vaadin-cdi-tests verify >"$LOG" 2>&1 || {
cat "$LOG"; exit 1; }
cat "$LOG"
if grep -qE '^\[INFO\] Tests run:' "$LOG"; then
echo "::error::CDI container tests ran without a container profile"
exit 1
fi
grep -q 'Tests are skipped' "$LOG" || {
echo "::error::surefire did not report the tests as skipped"; exit 1; }
- name: Run CDI ITs
if: ${{ steps.decide.outputs.run == 'true' }}
timeout-minutes: 35
# A full run's expected length, as in the Unit Test step.
env:
MAVEN_RETRY_DURATION: 300
run: |
# enforcer:enforce has to be named explicitly: the Flow parent keeps
# the dependencyConvergence rule in the default-cli execution, so no
# lifecycle phase evaluates it. Each container profile brings its own
# Arquillian adapter, so this is where a divergence would appear.
args="-V -B -ntp -e -pl flow-tests/vaadin-cdi-tests -P${{ matrix.profile }} -Dcom.vaadin.testbench.Parameters.maxAttempts=2"
set -x -e
# Detached the same way the it-tests job detaches its Maven, and for
# the same reason twice over: these tests fork application server
# JVMs that can outlive Maven and pin the step open by holding a pipe
# to tee, and piping would also make the step exit with tee's status
# instead of Maven's, so a failing container would report success.
# Keep in sync with this step's timeout-minutes: a retry must end
# before the step timeout too, when that comes before the job's.
step_deadline=$(( $(date +%s) + 34 * 60 ))
[ "$step_deadline" -lt "$MAVEN_RETRY_DEADLINE" ] && MAVEN_RETRY_DEADLINE=$step_deadline
scripts/runMavenWithRetry.sh mvn-cdi-tests-${{ matrix.profile }}.out $args enforcer:enforce verify
- name: Kill leftover Java processes
if: ${{ always() && steps.decide.outputs.run == 'true' }}
run: |
pkill -TERM java || true
sleep 2
pkill -KILL java || true
- name: Package test-report files
if: ${{ always() && steps.decide.outputs.run == 'true' }}
# The container's own log is collected too: a deployment error says
# "please see server.log for more details", and without it the reason
# the container refused an archive, or failed to answer a request, is
# gone once the runner is recycled. Payara, WildFly and Liberty keep
# it under logs/ or log/, Tomcat and TomEE add catalina.out.
run: |
find . -name surefire-reports -o -name failsafe-reports \
-o -name error-screenshots -o -name "mvn-*.out" \
-o -path "*/logs/*.log" -o -path "*/log/*.log" \
-o -name "catalina.out" \
| tar -czf tests-report-cdi-${{ matrix.profile }}.tgz -T -
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ always() && steps.decide.outputs.run == 'true' }}
with:
name: tests-output-cdi-${{ matrix.profile }}
path: tests-report-*.tgz
quarkus-tests:
name: Quarkus Tests (${{ matrix.name }})
# Every module here boots a Quarkus application of its own instead of
# deploying to a servlet container, which the generic it-tests matrix
# cannot express, so the suite is not part of that matrix and runs here.
# Which modules run, and whether for every change or only when the
# Quarkus sources change, is declared by each module's validation.run
# property: embedded-plugin, production and codestarts run always, as a
# smoke test, the rest only when a mode specific regression could have
# been introduced. The native image build is not here at all - it needs
# GraalVM and takes about half an hour, so it runs nightly from
# quarkus-native.yml. Needs the TestBench licence, so not for forks.
needs: build
if: ${{ !github.event.pull_request.head.repo.fork }}
timeout-minutes: 40
strategy:
fail-fast: false
# One job per module of the suite that declares validation.run in its
# POM; see flow-tests/vaadin-quarkus-tests/pom.xml.
matrix: ${{ fromJson(needs.build.outputs.matrix-quarkus) }}
runs-on: ubuntu-26.04
steps:
# Keep in sync with the job's timeout-minutes: a retry of a Maven build
# must end before the job timeout cancels it and hides the transfer
# error that caused it. The minute left over is for the report, upload
# and cache-save steps that run after the build.
- name: Set retry deadline
run: echo "MAVEN_RETRY_DEADLINE=$(( $(date +%s) + 39 * 60 ))" >> "$GITHUB_ENV"
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
ref: ${{env._HEAD_SHA}}
# Full history only where the step below actually diffs.
fetch-depth: ${{ matrix.ungated && 1 || 0 }}
- name: Decide whether to run
# Same gating as cdi-tests: a push or a manual run has nothing to
# compare against, and a gate that cannot tell what changed has to run
# the job rather than report green.
#
# The root pom counts as a Quarkus source: it manages quarkus.version,
# which every module here resolves the extension and the BOM from.
id: decide
run: |
set -euo pipefail
run=true
if [ "${{ matrix.ungated || false }}" != "true" ]; then
DIFF_BASE=
case "$GITHUB_EVENT_NAME" in
pull_request)
if git fetch --no-tags origin \
"+refs/heads/$_BASE_REF:refs/remotes/origin/$_BASE_REF"; then
DIFF_BASE=$(git merge-base HEAD "refs/remotes/origin/$_BASE_REF" || true)
fi
;;
merge_group)
DIFF_BASE=$_MERGE_GROUP_BASE_SHA
;;
*)
;;
esac
if [ -z "$DIFF_BASE" ]; then
echo "No base to compare against, running every module."
elif ! CHANGED=$(git diff --name-only "$DIFF_BASE" HEAD); then
echo "Could not diff against $DIFF_BASE, running every module."
else
RELEVANT=$(printf '%s\n' "$CHANGED" | grep -E \
'^(vaadin-quarkus/|flow-tests/vaadin-quarkus-tests/|pom\.xml$|\.github/workflows/validation\.yml$)' || true)
if [ -z "$RELEVANT" ]; then
echo "No changes to the Quarkus modules, the modules declared validation.run=always cover this."
run=false
else
echo "Changes to the Quarkus modules:"
printf '%s\n' "$RELEVANT"
fi
fi
fi
echo "run=$run" >> "$GITHUB_OUTPUT"
- uses: ./.github/actions/setup-frontend-tools
if: ${{ steps.decide.outputs.run == 'true' }}
with:
pnpm: true
- name: Set up JDK
if: ${{ steps.decide.outputs.run == 'true' }}
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version-file: .tool-versions
distribution: 'temurin'
- name: Set flow version to 999.99-SNAPSHOT
if: ${{ steps.decide.outputs.run == 'true' }}
run: |
./scripts/computeMatrix.js set-version --version=999.99-SNAPSHOT
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
if: ${{ steps.decide.outputs.run == 'true' }}
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
if: ${{ steps.decide.outputs.run == 'true' && github.run_attempt == 1 }}
with:
name: saved-workspace
- name: Restore Workspace
if: ${{ steps.decide.outputs.run == 'true' && github.run_attempt == 1 }}
run: |
tar xf workspace.tar
tar cf - .m2 | (cd ~ && tar xf -)
- name: Compile and Install Flow
if: ${{ steps.decide.outputs.run == 'true' && github.run_attempt > 1 }}
run: |
./scripts/computeMatrix.js set-version --version=999.99-SNAPSHOT
cmd="mvn install -B -ntp -DskipTests -DskipITs -pl \!flow-plugins/flow-gradle-plugin"
eval $cmd -T 2C -q || eval $cmd
- name: Set TB License
if: ${{ steps.decide.outputs.run == 'true' }}
env:
TB_LICENSE: ${{ secrets.TB_LICENSE }}
run: |
mkdir -p ~/.vaadin/
echo '{"username":"'$(echo $TB_LICENSE | cut -d / -f1)'","proKey":"'$(echo $TB_LICENSE | cut -d / -f2)'"}' > ~/.vaadin/proKey
- name: Run Quarkus ITs
if: ${{ steps.decide.outputs.run == 'true' }}
timeout-minutes: 35
# A full run's expected length, as in the Unit Test step.
env:
MAVEN_RETRY_DURATION: 240
run: |
# -am, and the reactor rooted at the suite rather than at the
# repository: the build job installs with -DskipTests, which
# deactivates the it-test-modules profile, so the fixture modules
# this one depends on are not in the local repository yet. Rooting
# the reactor here keeps -am from rebuilding the whole framework.
#
# No -Dcom.vaadin.testbench.Parameters.testsInParallel: unlike the
# Flow suites these tests share a single Quarkus application per
# module and have never been run in parallel. Flaky runs are retried
# instead.
args="-V -B -ntp -e -f flow-tests/vaadin-quarkus-tests/pom.xml \
-pl ${{ matrix.module }} -am \
-Dcom.vaadin.testbench.Parameters.maxAttempts=2 \
-Dfailsafe.rerunFailingTestsCount=2"
set -x -e
# Detached the same way the it-tests job detaches its Maven: these
# tests fork Quarkus JVMs that can outlive Maven and pin the step
# open by holding a pipe to tee, and piping would also make the step
# exit with tee's status instead of Maven's.
# Keep in sync with this step's timeout-minutes: a retry must end
# before the step timeout too, when that comes before the job's.
step_deadline=$(( $(date +%s) + 34 * 60 ))
[ "$step_deadline" -lt "$MAVEN_RETRY_DEADLINE" ] && MAVEN_RETRY_DEADLINE=$step_deadline
scripts/runMavenWithRetry.sh mvn-quarkus-tests-${{ matrix.name }}.out $args verify
- name: Kill leftover Java processes
if: ${{ always() && steps.decide.outputs.run == 'true' }}
run: |
pkill -TERM java || true
sleep 2
pkill -KILL java || true
- name: Package test-report files
if: ${{ always() && steps.decide.outputs.run == 'true' }}
run: find . -name surefire-reports -o -name failsafe-reports -o -name error-screenshots -o -name "mvn-*.out" | tar -czf tests-report-quarkus-${{ matrix.name }}.tgz -T -
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ always() && steps.decide.outputs.run == 'true' }}
with:
name: tests-output-quarkus-${{ matrix.name }}
path: tests-report-*.tgz
gradle-tests:
name: Gradle Tests
# Ports the TeamCity 'Gradle Tests' build. Always runs so it can be marked
# as a required check, but the expensive steps are gated on whether
# anything the Gradle plugin builds on actually changed, so unrelated PRs
# pass immediately. Some maintenance branches validate the license in the
# production mode builds the functional tests run, so the job writes the
# TestBench license and, like the other test jobs, is skipped for pull
# requests from forks.
permissions:
contents: read
checks: write
needs: build
if: ${{ !github.event.pull_request.head.repo.fork }}
timeout-minutes: 120
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
ref: ${{env._HEAD_SHA}}
fetch-depth: 0 # Full history required to diff against the merge base
- name: Decide whether to run
# An ignore list rather than an allow list. The job runs `gradlew
# build`, and check dependsOn functionalTest, so it also builds the
# sample applications under src/functionalTest - and those declare
# com.vaadin:flow, the aggregate that pulls in flow-client,
# flow-html-components, flow-data, flow-dnd and flow-push, plus
# vaadin-spring. Enumerating everything that can break the job is
# error prone and goes stale as modules are added, so anything that is
# not known to be irrelevant runs it: what is left out is the
# integration tests, documentation and the unrelated workflows. The
# init scripts under .github/gradle are passed to the build, so they
# count.
# Merge groups carry a base_sha, so they are filtered the same way; a
# push or a manual run has nothing to compare against and always
# builds. run stays true whenever the comparison cannot be made: a gate
# that does not know what changed has to run the job, not report green.
id: decide
run: |
set -euo pipefail
run=true
DIFF_BASE=
case "$GITHUB_EVENT_NAME" in
pull_request)
# The checkout is by sha, which leaves no remote-tracking branch
# for the base, so fetch one explicitly rather than relying on
# whatever refs happen to be present.
if git fetch --no-tags origin \
"+refs/heads/$_BASE_REF:refs/remotes/origin/$_BASE_REF"; then
DIFF_BASE=$(git merge-base HEAD "refs/remotes/origin/$_BASE_REF" || true)
fi
;;
merge_group)
# The merge group branch is built on top of base_sha, so it is
# already in the history checked out here.
DIFF_BASE=$_MERGE_GROUP_BASE_SHA
;;
*)
;;
esac
if [ -z "$DIFF_BASE" ]; then
echo "No base to compare against, running the job."
elif ! CHANGED=$(git diff --name-only "$DIFF_BASE" HEAD); then
echo "Could not diff against $DIFF_BASE, running the job."
else
RELEVANT=$(printf '%s\n' "$CHANGED" | awk '
$0 == ".github/workflows/validation.yml" { print; next }
/^\.github\/gradle\// { print; next }
/^flow-tests\// { next }
/^\.github\// { next }
/\.md$/ { next }
{ print }')
if [ -z "$RELEVANT" ]; then
echo "No changes affecting the Gradle plugin, skipping."
run=false
else
echo "Changes affecting the Gradle plugin:"
printf '%s\n' "$RELEVANT"
fi
fi
echo "run=$run" >> "$GITHUB_OUTPUT"
- uses: ./.github/actions/setup-frontend-tools
if: ${{ steps.decide.outputs.run == 'true' }}
- name: Set up JDK
if: ${{ steps.decide.outputs.run == 'true' }}
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version-file: .tool-versions
distribution: 'temurin'
- name: Set flow version to 999.99-SNAPSHOT
# The Gradle build takes its version from the root pom, so the poms have
# to match the saved workspace for the plugin to resolve
# flow-plugin-base from the local repository.
if: ${{ steps.decide.outputs.run == 'true' }}
run: |
./scripts/computeMatrix.js set-version --version=999.99-SNAPSHOT
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
if: ${{ steps.decide.outputs.run == 'true' }}
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
# Caching the Gradle home by hand meant every pull request saved its own
# copy of it. Those copies alone held 7 of the 10 GB the repository is
# allowed, so entries evicted each other within hours and even a second
# run of the same pull request started cold. What keeps them down now is
# the key: a pull request that edits none of the files it hashes restores
# the entry main warmed on the primary key, and the provider skips its
# save on an exact hit, so only the ones that change a build script write
# at all. The gating below is not what does it, it was already there
# while those copies accumulated.
- uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
if: ${{ steps.decide.outputs.run == 'true' }}
with:
# The default 'enhanced' provider is a proprietary component that the
# MIT licence of the action does not cover, and it is free only as a
# preview. 'basic' is the MIT implementation. It saves one entry over
# ~/.gradle/caches and ~/.gradle/wrapper, the same tree the hand
# written step cached, and deliberately passes no restore keys, so a
# change to anything the key covers starts from an empty Gradle home
# rather than a near match. gradle-home-cache-includes and its
# siblings are read only by the enhanced provider and do nothing here.
#
# Its key is not the one the replaced step computed either. It hashes
# **/*.gradle*, **/gradle-wrapper.properties, gradle/*.versions.toml,
# **/versions.properties and a couple of buildSrc paths, across the
# whole repository. So flow-gradle-plugin/gradle.properties no longer
# takes part, a basename needs a literal .gradle in it, and the two
# settings.gradle fixtures under vaadin-dev-server/src/test/resources
# now do: editing one of those invalidates the Gradle home.
cache-provider: basic
# The action would otherwise write only on the default branch, which
# this workflow no longer builds.
#
# Everything but the merge queue writes. Read only would be cheaper,
# but the provider has no restore keys, so a pull request that edits a
# build script computes a key that exists in no scope and could not
# save one either: it would download the whole Kotlin, Dokka and
# plugin-publish set again on every push to that branch. Those are
# exactly the pull requests this job runs for, and the hand written
# step it replaced degraded to a prefix match instead. A merge queue
# branch is single use, so what it saves is read by nothing.
cache-read-only: ${{ github.event_name == 'merge_group' }}
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
if: ${{ steps.decide.outputs.run == 'true' && github.run_attempt == 1 }}
with:
name: saved-workspace
- name: Restore Workspace
# Reuse the Flow artifacts installed by the build job instead of
# building Flow a second time.
if: ${{ steps.decide.outputs.run == 'true' && github.run_attempt == 1 }}
run: |
tar xf workspace.tar
tar cf - .m2 | (cd ~ && tar xf -)
- name: Set TB License
if: ${{ steps.decide.outputs.run == 'true' }}
env:
TB_LICENSE: ${{ secrets.TB_LICENSE }}
run: |
mkdir -p ~/.vaadin/
echo '{"username":"'$(echo $TB_LICENSE | cut -d / -f1)'","proKey":"'$(echo $TB_LICENSE | cut -d / -f2)'"}' > ~/.vaadin/proKey
- name: Compile and Install Flow
# On re-runs the saved-workspace artifact has already been deleted,
# so compile from scratch like the test jobs do.
if: ${{ steps.decide.outputs.run == 'true' && github.run_attempt > 1 }}
run: |
cmd="mvn install -B -ntp -DskipTests -pl \!flow-plugins/flow-gradle-plugin"
eval $cmd -T 2C -q || eval $cmd
- name: Run Gradle build and functionalTests
if: ${{ steps.decide.outputs.run == 'true' }}
working-directory: flow-plugins/flow-gradle-plugin
# The sample applications the functional tests build resolve
# com.vaadin:flow from the version of the Gradle build, which the poms
# set to 999.99-SNAPSHOT above, so they exercise the workspace restored
# here rather than a published snapshot. The functionalTest task passes
# it on; AbstractGradleTest fails the build if it ever stops arriving.
#
# Gradle does not read the Maven settings file in MAVEN_ARGS, so the
# init script gives it the same Central mirror; functionalTest passes
# it on to the nested builds.
run: |
./gradlew build --stacktrace --init-script "$GITHUB_WORKSPACE/.github/gradle/central-mirror.init.gradle"
- name: Package test-report files
if: ${{ always() && steps.decide.outputs.run == 'true' }}
run: |
# -type f, so the matching directories are not listed alongside the
# files they contain and archived a second time.
find flow-plugins/flow-gradle-plugin -type f \
\( -path '*/build/reports/tests/*' -o -path '*/build/test-results/*' \) \
> gradle-reports.txt
# tar refuses to create an empty archive, so only pack a report if the
# Gradle build got far enough to write one.
if [ -s gradle-reports.txt ]; then
tar -czf gradle-tests-report.tgz -T gradle-reports.txt
fi
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ always() && steps.decide.outputs.run == 'true' }}
with:
# Deliberately not named tests-output-*: the test-results job merges
# that pattern and only understands surefire/failsafe reports.
name: gradle-tests-report