-
Notifications
You must be signed in to change notification settings - Fork 17
343 lines (343 loc) · 12.7 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
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
name: vertx-vaadin validation
on:
push:
branches: [development, vaadin-24.4, vaadin-23]
workflow_dispatch:
pull_request_target:
types: [opened, synchronize, reopened, edited]
permissions:
contents: read
concurrency:
group: ${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
env:
JAVA_VERSION: 17
jobs:
check-permissions:
name: Check User Permissions
runs-on: ubuntu-latest
steps:
- run: echo "Concurrency Group = ${{ github.head_ref || github.ref_name }}"
- uses: actions-cool/check-user-permission@main
id: checkUser
with:
username: ${{github.triggering_actor}}
require: 'write'
- name: Fail on workflow triggered by external contributor
if: ${{ steps.checkUser.outputs.require-result != 'true' && github.actor != 'dependabot[bot]' && github.actor != 'vertx-vaadin-bot[bot]' }}
run: |
echo "🚫 **${{ github.actor }}** is an external contributor, a **${{ github.repository }}** team member has to review this changes and re-run this build" \
| tee -a $GITHUB_STEP_SUMMARY && exit 1
changes:
name: Compute changes
needs: [check-permissions]
runs-on: ubuntu-latest
outputs:
validation-required: ${{ steps.filter.outputs.validate }}
deploy-required: ${{ steps.filter.outputs.deploy }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
validate:
- '!(README.md|LICENSE|.gitignore|tools/**)'
deploy:
- 'pom.xml'
- 'vertx-vaadin-flow/pom.xml'
- 'vertx-vaadin-flow/src/**'
- 'vaadin-flow-sockjs/pom.xml'
- 'vaadin-flow-sockjs/src/**'
- 'vertx-vaadin-flow-jandex/pom.xml'
- 'vertx-vaadin-quarkus-extension/pom.xml'
- 'vertx-vaadin-quarkus-extension/runtime/pom.xml'
- 'vertx-vaadin-quarkus-extension/runtime/src/**'
- 'vertx-vaadin-quarkus-extension/deployment/pom.xml'
- 'vertx-vaadin-quarkus-extension/deployment/src/**'
build:
name: Build
needs: [changes]
if: ${{ needs.changes.outputs.validation-required == 'true' }}
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
cache: maven
- uses: browser-actions/setup-chrome@latest
id: setup-chrome
if: ${{ !vars.QH_DISABLE_CHROME_INSTALL }}
with:
chrome-version: stable
- name: Build
env:
VAADIN_PRO_KEY: ${{ secrets.VAADIN_PRO_KEY }}
run: |
set -x -e -o pipefail
VERTX_VAADIN_VERSION=$(mvn -N -ntp -q help:evaluate -Dexpression=project.version -DforceStdout)
echo "VERTX_VAADIN_VERSION=${VERTX_VAADIN_VERSION}" >> "$GITHUB_ENV"
mvn -V -e -B -ntp -DskipTests -DskipVertxRun=true install -Pflow-ui-tests
- name: Save workspace
run: |
tar cf workspace.tar -C ~/ $(cd ~/ && echo .m2/repository/com/github/mcollovati/vertx/**/$VERTX_VAADIN_VERSION)
tar rf workspace.tar $(find . -d -name target)
- uses: actions/upload-artifact@v4
with:
name: saved-workspace
path: workspace.tar
tests:
name: Tests
needs: [build]
if: ${{needs.changes.outputs.validation-required == 'true'}}
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
cache: maven
- uses: browser-actions/setup-chrome@latest
id: setup-chrome
if: ${{ !vars.QH_DISABLE_CHROME_INSTALL }}
with:
chrome-version: stable
- uses: actions/download-artifact@v4
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: Build
if: ${{ github.run_attempt > 1 }}
env:
VAADIN_PRO_KEY: ${{ secrets.VAADIN_PRO_KEY }}
run: |
set -x -e -o pipefail
mvn -V -e -B -ntp -DskipTests -DskipVertxRun=true -Dmaven.javadoc.skip=false install -Pflow-ui-tests
- name: Test
env:
VAADIN_PRO_KEY: ${{ secrets.VAADIN_PRO_KEY }}
run: |
set -x -e -o pipefail
mvn -V -e -B -ntp verify -Dmaven.javadoc.skip=false -DtrimStackTrace=false
- name: Package test output files
if: ${{ failure() || success() }}
run: find . -name surefire-reports -o -name failsafe-reports | tar -czf tests-report-main.tgz -T -
- uses: actions/upload-artifact@v4
if: ${{ failure() || success() }}
with:
name: tests-output-ut-1
path: tests-report-*.tgz
it-tests-1:
name: UI tests 1
needs: [build]
if: ${{needs.changes.outputs.validation-required == 'true'}}
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
cache: maven
- uses: browser-actions/setup-chrome@latest
id: setup-chrome
if: ${{ !vars.QH_DISABLE_CHROME_INSTALL }}
with:
chrome-version: stable
- name: Set Chrome Version
run: |
CHROME_VERSION=$(google-chrome --version | sed 's/^Google Chrome //' | cut -d. -f1)
echo "CHROME_VERSION=${CHROME_VERSION}" >> "$GITHUB_ENV"
- uses: actions/download-artifact@v4
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: Build
if: ${{ github.run_attempt > 1 }}
env:
VAADIN_PRO_KEY: ${{ secrets.VAADIN_PRO_KEY }}
run: |
set -x -e -o pipefail
mvn -V -e -B -ntp -DskipTests -DskipVertxRun=true -Dmaven.javadoc.skip=false install -Pflow-ui-tests
- name: UI Test
env:
VAADIN_PRO_KEY: ${{ secrets.VAADIN_PRO_KEY }}
run: |
set -x -e -o pipefail
cd vertx-vaadin-tests
rm -rf frontend/generated
mvn -V -e -B -ntp verify -Dmaven.javadoc.skip=false -pl=:vertx-vaadin-test-root-context -DtrimStackTrace=false \
-Dwebdriver.chrome.driver=$(which chromedriver) \
-Duitest.chrome-version=$CHROME_VERSION
- name: Package test output files
if: ${{ failure() || success() }}
run: find . -name surefire-reports -o -name failsafe-reports -o -name error-screenshots -o -name verticle.log | tar -czf tests-report-it-1.tgz -T -
- uses: actions/upload-artifact@v4
if: ${{ failure() || success() }}
with:
name: tests-output-it-1
path: tests-report-*.tgz
it-tests-2:
name: UI tests 2
needs: [build]
if: ${{needs.changes.outputs.validation-required == 'true' }}
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
cache: maven
- uses: browser-actions/setup-chrome@latest
id: setup-chrome
if: ${{ !vars.QH_DISABLE_CHROME_INSTALL }}
with:
chrome-version: stable
- uses: actions/download-artifact@v4
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: Build
if: ${{ github.run_attempt > 1 }}
run: |
set -x -e -o pipefail
mvn -V -e -B -ntp -DskipTests -Dmaven.javadoc.skip=false install -Pflow-ui-tests
- name: UI Test
env:
VAADIN_PRO_KEY: ${{ secrets.VAADIN_PRO_KEY }}
run: |
set -x -e -o pipefail
cd vertx-vaadin-tests/
mvn -V -e -B -ntp verify -DtrimStackTrace=false -pl=-:vertx-vaadin-test-root-context -Dwebdriver.chrome.driver=$(which chromedriver)
- name: Package test output files
if: ${{ failure() || success() }}
run: find . -name surefire-reports -o -name failsafe-reports -o -name error-screenshots -o -name verticle.log | tar -czf tests-report-it-2.tgz -T -
- uses: actions/upload-artifact@v4
if: ${{ failure() || success() }}
with:
name: tests-output-it-2
path: tests-report-*.tgz
test-results:
permissions:
issues: read
checks: write
pull-requests: write
if: ${{ always() }}
needs: [changes, tests, it-tests-1, it-tests-2]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/download-artifact@v4
if: ${{ always() && needs.changes.outputs.validation-required == 'true' }}
with:
pattern: tests-output-*
merge-multiple: true
- name: Extract downloaded files
if: ${{ always() && needs.changes.outputs.validation-required == 'true' }}
run: for i in *.tgz; do tar xvf $i; done
- name: Publish Unit Test Results
if: ${{ always() && needs.changes.outputs.validation-required == 'true' }}
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: "**/target/*-reports/TEST*.xml"
- name: Set Failure Status
if: ${{ always() && needs.changes.outputs.validation-required == 'true' && (needs.tests.result != 'success' || needs.it-tests-1.result != 'success' || needs.it-tests-2.result != 'success') }}
run: |
echo "🚫 THERE ARE TEST MODULES WITH FAILURES or BEEN CANCELLED" | tee -a $GITHUB_STEP_SUMMARY
exit 1
- name: Set validation skipped status
if: ${{ always() && needs.changes.outputs.validation-required == 'false' }}
run: |
echo "✅ Pull request only contains changes on files ignored by validation workflow" | tee -a $GITHUB_STEP_SUMMARY && exit 0
deploy-snapshots:
runs-on: ubuntu-latest
needs: [test-results]
permissions:
contents: read
packages: write
if: ${{ success() && github.event_name == 'push' && github.ref_protected && needs.changes.outputs.deploy-required == 'true'}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ env.JAVA_VERSION }}
server-id: repsy-vertx-vaadin-snapshots
server-username: REPSY_USERNAME
server-password: REPSY_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- uses: actions/download-artifact@v4
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: Build
if: ${{ github.run_attempt > 1 }}
run: |
set -x -e -o pipefail
mvn -V -e -B -ntp -DskipTests install
- name: Deploy artifacts
run: |
mvn -V -e -B -ntp -DskipVertxRun=true -DskipTests -Dvertx-vaadin.release=snapshot -Dvertx-vaadin.release.gpg deploy
env:
VAADIN_PRO_KEY: ${{ secrets.VAADIN_PRO_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPSY_USERNAME: ${{ secrets.REPSY_USERNAME }}
REPSY_PASSWORD: ${{ secrets.REPSY_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}