-
Notifications
You must be signed in to change notification settings - Fork 293
316 lines (303 loc) · 11 KB
/
test.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
name: Test
on:
pull_request:
paths-ignore:
- 'README.md'
- 'CODE_OF_CONDUCT.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'SECURITY.md'
- 'docs/**'
- '.github/**'
- '!.github/workflows/test.yml'
push:
branches:
- develop
- main
- release/*
tags: '[0-9]+.[0-9]+.[0-9]+'
paths-ignore:
- 'README.md'
- 'CODE_OF_CONDUCT.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'SECURITY.md'
- 'docs/**'
- '.github/**'
- '!.github/workflows/test.yml'
release:
types:
- created
# Limit the number of concurrent runs to one per PR
# If a run is already in progress, cancel it
# If the run is not for a PR, then this limit does not apply
concurrency:
group: test-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
# Keep in sync with codeql-analysis.yml and build.yml
env:
CI: true
node: 20
java: 21
jobs:
server-tests:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
# Install Java 17 to run programming templates
java-version: |
17
${{ env.java }}
cache: 'gradle'
- name: Java Tests
run: set -o pipefail && ./gradlew --console=plain test jacocoTestReport -x webapp jacocoTestCoverageVerification | tee tests.log
- name: Print failed tests
if: failure()
run: grep "Test >.* FAILED\$" tests.log || echo "No failed tests."
- name: "Codacy: Report coverage"
uses: codacy/codacy-coverage-reporter-action@master
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: build/reports/jacoco/test/jacocoTestReport.xml
if: (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) && (success() || failure()) && github.event.pull_request.user.login != 'dependabot[bot]'
- name: Annotate Server Test Results
uses: ashley-taylor/junit-report-annotations-action@f9c1a5cbe28479439f82b80a5402a6d3aa1990ac
if: always() && github.event.pull_request.user.login != 'dependabot[bot]'
with:
access-token: ${{ secrets.GITHUB_TOKEN }}
path: build/test-results/test/*.xml
numFailures: 99
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: H2 Tests
path: build/test-results/test/*.xml
reporter: java-junit
- name: Number of Server Starts
if: success() || failure()
run: bash supporting_scripts/extract_number_of_server_starts.sh
- name: Upload Server Test Coverage Report
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: Coverage Report Server Tests
path: build/reports/jacoco/test/html/
server-tests-mysql:
needs: [ server-tests ]
runs-on: ubuntu-latest
timeout-minutes: 120
# Limit the number of concurrent mysql tests to one in total
concurrency:
group: server-tests-mysql
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
# Install Java 17 to run programming templates
java-version: |
17
${{ env.java }}
cache: 'gradle'
- name: Java Tests
id: tests
run: set -o pipefail && SPRING_PROFILES_INCLUDE=mysql ./gradlew --console=plain test jacocoTestReport -x webapp jacocoTestCoverageVerification | tee tests.log
- name: Print failed tests
if: failure()
run: grep "Test >.* FAILED\$" tests.log || echo "No failed tests."
- name: Count failed tests
id: failedTestCounter
if: failure()
run: echo "FAILED_TESTS_COUNT=$(grep -c "Test >.* FAILED\$" tests.log)" >> $GITHUB_OUTPUT
- name: Report action failure
if: failure()
uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'Test Run - MySQL'
description: '❌ ${{ steps.failedTestCounter.outputs.FAILED_TESTS_COUNT }} failed test(s)'
state: 'failure'
sha: ${{github.event.pull_request.head.sha || github.sha}}
- name: Report action success
if: success()
uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'Test Run - MySQL'
description: '✅ Test succeeded'
state: 'success'
sha: ${{github.event.pull_request.head.sha || github.sha}}
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: MySQL Tests
path: build/test-results/test/*.xml
reporter: java-junit
- name: Number of Server Starts
if: success() || failure()
run: bash supporting_scripts/extract_number_of_server_starts.sh
server-tests-postgres:
needs: [ server-tests ]
runs-on: ubuntu-latest
timeout-minutes: 150
# Limit the number of concurrent postgres tests to one in total
concurrency:
group: server-tests-postgres
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
# Install Java 17 to run programming templates
java-version: |
17
${{ env.java }}
cache: 'gradle'
- name: Java Tests
id: tests
run: set -o pipefail && SPRING_PROFILES_INCLUDE=postgres ./gradlew --console=plain test jacocoTestReport -x webapp jacocoTestCoverageVerification | tee tests.log
- name: Print failed tests
if: failure()
run: grep "Test >.* FAILED\$" tests.log || echo "No failed tests."
- name: Count failed tests
id: failedTestCounter
if: failure()
run: echo "FAILED_TESTS_COUNT=$(grep -c "Test >.* FAILED\$" tests.log)" >> $GITHUB_OUTPUT
- name: Report action failure
if: failure()
uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'Test Run - PostgreSQL'
description: '❌ ${{ steps.failedTestCounter.outputs.FAILED_TESTS_COUNT }} failed test(s)'
state: 'failure'
sha: ${{github.event.pull_request.head.sha || github.sha}}
- name: Report action success
if: success()
uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'Test Run - PostgreSQL'
description: '✅ Test succeeded'
state: 'success'
sha: ${{github.event.pull_request.head.sha || github.sha}}
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: PostgreSQL Tests
path: build/test-results/test/*.xml
reporter: java-junit
- name: Number of Server Starts
if: success() || failure()
run: bash supporting_scripts/extract_number_of_server_starts.sh
server-style:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '${{ env.java }}'
cache: 'gradle'
- name: Java Code Style
run: ./gradlew spotlessCheck
- name: Java Documentation
run: ./gradlew checkstyleMain -x webapp
if: success() || failure()
- name: Java Architecture Tests
run: ./gradlew test -DincludeTags='ArchitectureTest' -x webapp
if: success() || failure()
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: Java Architecture Tests
path: build/test-results/test/*.xml
reporter: java-junit
client-tests:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
# It seems like there is some memory issue with these tests with the project-wide default node option
# `--max-old-space-size` set in the .npmrc, therefore we delete it for this test as a workaround
- name: remove project-wide node options set in .npmrc just for this test
run: rm .npmrc || true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ env.node }}'
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Compile TypeScript Test Files With Typechecking
run: npm run compile:ts:tests
- name: TypeScript Test Without Typechecking
run: npm run test:ci
- name: Upload Client Test Coverage Report
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: Coverage Report Client Tests
path: build/test-results/lcov-report/
client-tests-selected:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ env.node }}'
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Compile TypeScript Test Files With Typechecking
run: npm run compile:ts:tests
- name: TypeScript Test (Selection) Without Typechecking
run: npm run test-diff:ci
client-style:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ env.node }}'
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: TypeScript Formatting
run: npm run prettier:check
- name: TypeScript Code Style
run: npm run lint
if: success() || failure()
client-compilation:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ env.node }}'
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Compile TypeScript Files With Typechecking
run: npm run compile:ts