-
Notifications
You must be signed in to change notification settings - Fork 57
225 lines (215 loc) · 6.52 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
name: Validation
on:
push:
branches: [ main, '1.5' ]
paths-ignore:
- 'hilla-logo.svg'
- 'README.md'
- '.github/ISSUE_TEMPLATE/*'
- 'packages/**/README.md'
pull_request_target:
paths-ignore:
- 'hilla-logo.svg'
- 'README.md'
- '.github/ISSUE_TEMPLATE/*'
- 'packages/**/README.md'
jobs:
init:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 15
env:
NX_SKIP_NX_CACHE: true
steps:
- name: Check Secrets
run: |
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
- name: Checkout Project Code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
- name: Validate Java Format
run: mvn -B formatter:validate
- name: Build TypeScript
run: npm run build
- name: Lint TypeScript
run: npm run check
- name: Build Java
run: mvn install -B -ntp -DskipTests
- name: Save Workspace
run: |
tar cf workspace.tar -C ~/ $( \
mvn -q -DskipTests \
-Dexec.executable='echo' \
-Dexec.args='${project.groupId}:${project.artifactId}' \
-Dexec.skip='${maven.deploy.skip}' \
exec:exec \
| tr '.:' '/' \
| sed -e 's/^/.m2\/repository\//' \
)
tar rf workspace.tar $(find packages/java -d -name target)
tar rf workspace.tar $(find packages/ts -name node_modules -prune -o -print | git check-ignore --stdin)
- uses: actions/upload-artifact@v3
with:
name: saved-workspace
path: workspace.tar
retention-days: 1
if-no-files-found: error
test-java:
needs: init
name: Test Java
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
steps:
- name: Checkout Project Code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
- 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: Test
run: mvn -B -am -P\!it-modules verify
- name: Collect Coverage
run: |
COVFILES=$(find packages/java -wholename 'target/site/jacoco/jacoco.xml' | tr '\n' ',' | sed '$s/,$//')
echo "COVFILES=$COVFILES" >> $GITHUB_ENV
- name: Send Coverage to Codecov
if: ${{ env.COVFILES != '' }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ env.COVFILES }}
flags: unittests
fail_ci_if_error: true
root_dir: ${{ github.workspace }}
test-typescript:
needs: init
name: Test TypeScript
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
steps:
- name: Install Chrome
uses: browser-actions/setup-chrome@v1
- name: Checkout Project Code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
- 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: Test
run: npm run test:coverage
env:
CI: true
- name: Collect Coverage
run: |
COVFILES=$(find packages/ts -wholename '*/.coverage/lcov.info' | tr '\n' ',' | sed '$s/,$//')
echo "COVFILES=$COVFILES" >> $GITHUB_ENV
- name: Send Coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ env.COVFILES }}
flags: unittests
fail_ci_if_error: true
root_dir: ${{ github.workspace }}
test-it:
needs:
- init
- test-java
- test-typescript
name: ITs
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
hillaEngine: [false, true]
package:
- tests
java-version:
- 11
include:
- package: tests/spring/endpoints-latest-java
java-version: 17
hilla-engine: false
steps:
- name: Checkout Project Code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
with:
java-version: ${{ matrix.java-version }}
- 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: Verify
run: |
(
cd packages/java/${{ matrix.package }} && \
mvn -B -am -ntp -fae \
-Dfailsafe.forkCount=4 \
-Dcom.vaadin.testbench.Parameters.testsInParallel=5 \
-Dfailsafe.rerunFailingTestsCount=2 \
-Dmaven.wagon.httpconnectionManager.ttlSeconds=25 \
-Dmaven.wagon.http.retryHandler.count=3 \
-Dvaadin.hillaEngine=${{ matrix.hillaEngine }} \
verify
)
- uses: actions/upload-artifact@v3
if: ${{ failure() || success() }}
with:
name: saved-outputs
path: |
packages/java/tests/**/target/*-reports/*
packages/java/tests/**/error-screenshots/*.png
test-all:
name: Tests Summary
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- test-it
steps:
- name: Fail if test jobs did not succeed
if: ${{ needs.test-it.result != 'success' }}
run: exit 1