-
Notifications
You must be signed in to change notification settings - Fork 303
327 lines (317 loc) Β· 13.5 KB
/
test.yml
File metadata and controls
327 lines (317 loc) Β· 13.5 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
# SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: Test
on: pull_request
permissions:
contents: read
env:
E2E_NODE_VERSION: "20" # TODO: Extract automatically using another action
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.5']
nextcloud-versions: ['master']
include:
- php-versions: '8.4'
nextcloud-versions: 'master'
coverage: true
- php-versions: '8.1'
nextcloud-versions: 'stable32'
- php-versions: '8.2'
nextcloud-versions: 'stable33'
- php-versions: '8.3'
nextcloud-versions: 'master'
name: Nextcloud ${{ matrix.nextcloud-versions }} php${{ matrix.php-versions }} unit tests ${{ matrix.coverage && '(coverage)' || ''}}
steps:
- name: Set up Nextcloud env
uses: ChristophWurst/setup-nextcloud@6e38a6146b15a4c4c932ce72ed8daf75eb903d18 # v0.4.1
with:
nextcloud-version: ${{ matrix.nextcloud-versions }}
php-version: ${{ matrix.php-versions }}
php-coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
patch-php-version-check: ${{ matrix.php-versions == '8.6' }}
node-version: 'false'
install: true
- name: Checkout Mail
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
path: nextcloud/apps/mail
fetch-depth: 2
- name: Install dependencies
working-directory: nextcloud/apps/mail
run: composer install
- name: Run tests
working-directory: nextcloud/apps/mail
run: composer run test:unit
env:
XDEBUG_MODE: ${{ matrix.coverage && 'coverage' || 'off' }}
- name: Report coverage
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
if: ${{ !cancelled() && matrix.coverage }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
working-directory: nextcloud/apps/mail
files: tests/clover.unit.xml
flags: unittests
fail_ci_if_error: ${{ !github.event.pull_request.head.repo.fork }}
verbose: true
integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.4']
nextcloud-versions: ['master']
db: ['sqlite', 'mysql', 'pgsql']
cache: ['nocache']
include:
- php-versions: 8.4
nextcloud-versions: 'master'
db: 'mysql'
cache: 'nocache'
coverage: true
- php-versions: 8.1
nextcloud-versions: 'stable32'
db: 'sqlite'
cache: 'redis'
- php-versions: 8.2
nextcloud-versions: 'stable32'
db: 'pgsql'
cache: 'redis'
- php-versions: 8.4
nextcloud-versions: 'stable33'
db: 'mysql'
cache: 'redis'
coverage: true
- php-versions: 8.5
nextcloud-versions: 'master'
db: 'mysql'
cache: 'redis'
name: ${{ matrix.nextcloud-versions }} w/ php${{ matrix.php-versions }}-${{ matrix.db }}-${{ matrix.cache }} integration tests ${{ matrix.coverage && '(coverage)' || ''}}
services:
mail-service:
image: ghcr.io/christophwurst/docker-imap-devel:latest
env:
MAILNAME: mail.domain.tld
MAIL_ADDRESS: user@domain.tld
MAIL_PASS: mypassword
ports:
- 25:25
- 143:143
- 993:993
- 4190:4190
mariadb-service:
image: ghcr.io/nextcloud/continuous-integration-mariadb-11.4:latest
env:
MARIADB_ROOT_PASSWORD: my-secret-pw
MARIADB_DATABASE: nextcloud
MARIADB_USER: nextcloud
MARIADB_PASSWORD: nextcloud
ports:
- 3306:3306/tcp
options: >-
--health-cmd="mariadb-admin ping"
--health-interval=5s
--health-timeout=2s
--health-retries=5
postgres-service:
image: ghcr.io/nextcloud/continuous-integration-postgres-15:latest
env:
POSTGRES_USER: nextcloud
POSTGRES_DB: nextcloud
POSTGRES_PASSWORD: nextcloud
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: ghcr.io/nextcloud/continuous-integration-redis:latest
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Set up Nextcloud env
uses: ChristophWurst/setup-nextcloud@6e38a6146b15a4c4c932ce72ed8daf75eb903d18 # v0.4.1
with:
nextcloud-version: ${{ matrix.nextcloud-versions }}
php-version: ${{ matrix.php-versions }}
php-coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
patch-php-version-check: ${{ matrix.php-versions == '8.5' }}
install: true
database: ${{ matrix.db }}
node-version: 'false'
- name: Configure caching
if: ${{ matrix.cache == 'redis' }}
run: |
php -f nextcloud/occ config:system:set memcache.local --value='\OC\Memcache\Redis'
php -f nextcloud/occ config:system:set memcache.distributed --value='\OC\Memcache\Redis'
- name: Checkout Mail
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
path: nextcloud/apps/mail
fetch-depth: 2
- name: Install dependencies
working-directory: nextcloud/apps/mail
run: composer install
- name: Patch version check for nightly PHP
if: ${{ matrix.php-versions == '8.6' }}
run: sed -i 's/max-version="8.5"/max-version="8.6"/' nextcloud/apps/mail/appinfo/info.xml
- name: Install Mail
run: php -f nextcloud/occ app:enable mail
- name: Configure Nextcloud for testing
run: |
php -f nextcloud/occ config:system:set app.mail.debug --type bool --value true
php -f nextcloud/occ config:system:set app.mail.verify-tls-peer --type bool --value false
- name: Enable slow mysql query logs
if: ${{ matrix.db == 'mysql' }}
run: |
echo "SET GLOBAL log_queries_not_using_indexes = 1;" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
echo "SET GLOBAL slow_query_log=1;" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
echo "SET GLOBAL log_output = 'table';" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
- name: Run tests
working-directory: nextcloud/apps/mail
run: composer run test:integration
env:
XDEBUG_MODE: ${{ matrix.coverage && 'coverage' || 'off' }}
- name: Read slow queries
if: ${{ always() }}
run: echo "SELECT * FROM mysql.slow_log WHERE sql_text LIKE '%oc_mail%' AND sql_text NOT LIKE '%information_schema%'" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
- name: Print debug logs
if: ${{ always() }}
run: cat nextcloud/data/mail-*-*-imap.log
- name: Report coverage
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
if: ${{ !cancelled() && matrix.coverage }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
working-directory: nextcloud/apps/mail
files: tests/clover.integration.xml
flags: integrationtests
fail_ci_if_error: ${{ !github.event.pull_request.head.repo.fork }}
verbose: true
frontend-unit-test:
runs-on: ubuntu-latest
name: Front-end unit tests
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
id: versions
with:
fallbackNode: '^14'
fallbackNpm: '^7'
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
- name: npm install
run: npm install
- name: run tests
run: npm run test:unit
env:
CI: true
matrix:
runs-on: ubuntu-latest-low
outputs:
php-min: ${{ steps.versions.outputs.php-min }}
branches-min: ${{ steps.versions.outputs.branches-min }}
steps:
- name: Checkout app
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Get version matrix
id: versions
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
frontend-e2e-tests:
runs-on: ubuntu-latest
name: Front-end E2E tests
needs: matrix
steps:
- name: Set up Nextcloud env
uses: ChristophWurst/setup-nextcloud@6e38a6146b15a4c4c932ce72ed8daf75eb903d18 # v0.4.1
with:
nextcloud-version: ${{ needs.matrix.outputs.branches-min }}
php-version: ${{ needs.matrix.outputs.php-min }}
node-version: ${{ env.E2E_NODE_VERSION }}
install: true
- name: Configure Nextcloud for testing
run: |
php -f nextcloud/occ config:system:set debug --type=bool --value=true
php -f nextcloud/occ config:system:set overwriteprotocol --value=https
php -f nextcloud/occ config:system:set overwritehost --value=localhost
php -f nextcloud/occ config:system:set overwrite.cli.url --value=https://localhost
php -f nextcloud/occ config:system:set app.mail.debug --type=bool --value=true
php -f nextcloud/occ config:system:set app.mail.verify-tls-peer --type=bool --value=false
- name: Check out the app
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
path: nextcloud/apps/mail
- name: Install php dependencies
working-directory: nextcloud/apps/mail
run: composer install
- name: Install the app
run: php -f nextcloud/occ app:enable mail
- name: Set up node ${{ env.E2E_NODE_VERSION }}
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: ${{ env.E2E_NODE_VERSION }}
- name: Install npm dependencies
working-directory: nextcloud/apps/mail
run: npm ci
- name: Build frontend
working-directory: nextcloud/apps/mail
run: npm run build
- name: Install stunnel (tiny https proxy)
run: sudo apt-get install -y stunnel
- name: Start php server and https proxy
working-directory: nextcloud
run: |
openssl req -new -x509 -days 365 -nodes -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=localhost" -out stunnel.pem -keyout stunnel.pem
php -S 127.0.0.1:8080 &
sudo stunnel3 -p stunnel.pem -d 443 -r 8080
- name: Test https access
run: curl --insecure -Li https://localhost
- name: Install Playwright browsers
working-directory: nextcloud/apps/mail
run: npx playwright install --with-deps chromium
- name: Run Playwright tests
working-directory: nextcloud/apps/mail
run: DEBUG=pw:api npx playwright test
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
if: always()
with:
name: playwright-report-${{ github.event.number }}-nc${{ needs.matrix.outputs.branches-min }}-php${{ needs.matrix.outputs.php-min }}-node${{ env.E2E_NODE_VERSION }}
path: nextcloud/apps/mail/playwright-report/
retention-days: 14
- name: Print server logs
if: always()
run: cat nextcloud/data/nextcloud.log*
env:
CI: true
summary:
runs-on: ubuntu-latest-low
needs:
- unit-tests
- integration-tests
- frontend-unit-test
- frontend-e2e-tests
if: always()
name: test-summary
steps:
- name: Unit test status
run: if ${{ needs.unit-tests.result != 'success' && needs.unit-tests.result != 'skipped' }}; then exit 1; fi
- name: Integration test status
run: if ${{ needs.integration-tests.result != 'success' && needs.integration-tests.result != 'skipped' }}; then exit 1; fi
- name: Frontend unit test status
run: if ${{ needs.frontend-unit-test.result != 'success' && needs.frontend-unit-test.result != 'skipped' }}; then exit 1; fi
- name: Frontend E2E test status
run: if ${{ needs.frontend-e2e-tests.result != 'success' && needs.frontend-e2e-tests.result != 'skipped' }}; then exit 1; fi