forked from vaadin/flow
-
Notifications
You must be signed in to change notification settings - Fork 0
247 lines (246 loc) · 8.94 KB
/
validation.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
name: Flow Validation
on:
push:
branches: [master, '23.3', '23.2', '23.1', '9.0']
workflow_dispatch:
pull_request_target:
types: [opened, synchronize, reopened]
permissions:
contents: read
jobs:
build:
timeout-minutes: 20
runs-on: ubuntu-latest
outputs:
matrix-unit: ${{ steps.set-matrix.outputs.matrix-unit }}
matrix-it: ${{ steps.set-matrix.outputs.matrix-it }}
steps:
- uses: ZheSun88/check-user-permission@triggering-actor
id: check
with:
require: 'write'
- name: Check Secrets
run: |
[ "${{ steps.check.outputs.require-result }}" != "true" ] \
&& echo "::error::!! NO USER PERMISSIONS FOR RUNNING VALIDATION: Check if the PR is from an external contributor !!" \
&& exit 1 || exit 0
TB_LICENSE="${{secrets.TB_LICENSE}}"
[ -z "$TB_LICENSE" ] \
&& echo "::error::!! ERROR NO TB_LICENSE: Check that this repo has a valid TB_LICENSE secret !!" \
&& exit 1 || exit 0
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v3
with:
node-version: '18.12.1'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set flow version to 999.99-SNAPSHOT
run: |
./scripts/computeMatrix.js set-version --version=999.99-SNAPSHOT
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Generate matrices
id: set-matrix
run: |
echo "matrix-it=$(./scripts/computeMatrix.js it-tests --parallel=13 current module args)" >> $GITHUB_OUTPUT
echo "matrix-unit=$(./scripts/computeMatrix.js unit-tests --parallel=1 current module args)" >> $GITHUB_OUTPUT
- name: Compile and Install Flow
run: |
cmd="mvn install -B -ntp -DskipTests -pl \!flow-plugins/flow-gradle-plugin"
eval $cmd -T 2C -q || eval $cmd
- 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@v3
with:
name: saved-workspace
path: workspace.tar
unit-tests:
needs: build
timeout-minutes: 20
outputs:
failure: ${{steps.set-failure.outputs.failure}}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.build.outputs.matrix-unit)}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set flow version to 999.99-SNAPSHOT
run: |
./scripts/computeMatrix.js set-version --version=999.99-SNAPSHOT
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- uses: actions/download-artifact@v3
with:
name: saved-workspace
- name: Restore Workspace
run: |
set -x
tar xf workspace.tar
tar cf - .m2 | (cd ~ && tar xf -)
- name: Set TB License
run: |
TB_LICENSE=${{secrets.TB_LICENSE}}
mkdir -p ~/.vaadin/
echo '{"username":"'`echo $TB_LICENSE | cut -d / -f1`'","proKey":"'`echo $TB_LICENSE | cut -d / -f2`'"}' > ~/.vaadin/proKey
- name: Unit Test
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}}"
cmd="mvn -B -ntp -T 1C $ARGS"
set -x -e -o pipefail
$cmd verify -Dmaven.javadoc.skip=false | tee mvn-unit-tests-${{matrix.current}}.out
- name: Set build status flag
id: set-failure
if: ${{ failure() || cancelled() }}
run: echo "failure=true" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
if: ${{ failure() || success() }}
with:
name: saved-outputs
path: |
**/target/*-reports/*
mvn-*.out
it-tests:
needs: build
timeout-minutes: 20
outputs:
failure: ${{steps.set-failure.outputs.failure}}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.build.outputs.matrix-it)}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v3
with:
node-version: '18.12.1'
- uses: pnpm/action-setup@v2
with:
version: '5.15.0'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set flow version to 999.99-SNAPSHOT
run: |
./scripts/computeMatrix.js set-version --version=999.99-SNAPSHOT
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- uses: nanasess/setup-chromedriver@master
- uses: actions/download-artifact@v3
with:
name: saved-workspace
- name: Restore Workspace
run: |
tar xf workspace.tar
tar cf - .m2 | (cd ~ && tar xf -)
- name: Set TB License
run: |
TB_LICENSE=${{secrets.TB_LICENSE}}
mkdir -p ~/.vaadin/
echo '{"username":"'`echo $TB_LICENSE | cut -d / -f1`'","proKey":"'`echo $TB_LICENSE | cut -d / -f2`'"}' > ~/.vaadin/proKey
- 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
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
fi
- name: Run ITs
run: |
[ -n "${{matrix.module}}" ] && \
ARGS="-Dfailsafe.forkCount=4 -pl ${{matrix.module}} -Dit.test=${{matrix.args}}" || \
ARGS="-pl ${{matrix.args}}"
cmd="mvn -V -B -ntp -e -fae -Dcom.vaadin.testbench.Parameters.testsInParallel=5 -Dfailsafe.rerunFailingTestsCount=2 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 $ARGS"
set -x -e -o pipefail
$cmd verify | tee -a mvn-it-tests-${{matrix.current}}.out
- name: Set build status flag
id: set-failure
if: ${{ failure() || cancelled() }}
run: echo "failure=true" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
if: ${{ failure() || success() }}
with:
name: saved-outputs
path: |
**/target/*-reports/*
**/error-screenshots/*.png
mvn-*.out
test-results:
permissions:
# for EnricoMi/publish-unit-test-result-action
issues: read
checks: write
pull-requests: write
if: ${{ failure() || success() }}
needs: [unit-tests, it-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/download-artifact@v3
with:
name: saved-outputs
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: "**/target/*-reports/TEST*.xml"
check_run_annotations: all tests, skipped tests
check_run_annotations_branch: master, 9.0
- uses: geekyeggo/delete-artifact@v1
with:
name: |
saved-workspace
saved-outputs
- name: Compute Stats
run: |
./scripts/computeMatrix.js test-results
./scripts/computeMatrix.js clean-success
- uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: test-reports
path: |
**/target/*-reports/*
**/error-screenshots/*.png
mvn-*.out
- name: Check Failure Status
run: |
fail="${{ needs.unit-tests.outputs.failure }}${{ needs.it-tests.outputs.failure }}"
[ -n "$fail" ] && echo "::error::!! THERE ARE TEST MODULES WITH FAILURES !!" && exit 1 || exit 0