-
Notifications
You must be signed in to change notification settings - Fork 0
330 lines (285 loc) · 9.8 KB
/
Copy pathanalysis-coverage.yml
File metadata and controls
330 lines (285 loc) · 9.8 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
328
329
330
name: Analysis & Coverage
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
concurrency:
group: ana_cov-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
NEXTCLOUD_URL: "http://localhost:8080"
APP_ID: "nc_py_app"
APP_VERSION: "1.0.0"
APP_SECRET: "tC6vkwPhcppjMykD1r0n9NlI95uJMBYjs5blpIcA1PAdoPDmc5qoAjaBAkyocZ6E"
APP_PORT: 9009
NC_AUTH_USER: "admin"
NC_AUTH_PASS: "adminpassword"
jobs:
analysis:
runs-on: macos-14
name: Analysis
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install from source
run: python3 -m pip install ".[dev]"
- name: Run Analysis
run: python3 -m pylint "nc_py_app/"
tests-maria:
needs: [analysis]
runs-on: ubuntu-22.04
name: ${{ matrix.nextcloud }} • 🐍${{ matrix.python }} • Maria
strategy:
fail-fast: false
matrix:
include:
- nextcloud: 'stable32'
python: '3.10'
- nextcloud: 'stable33'
python: '3.11'
timeout-minutes: 60
services:
mariadb:
image: mariadb:11.8
env:
MARIADB_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: nextcloud
options: >-
--health-cmd mysqladmin ping
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 3306:3306
steps:
- name: Set up php
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd, curl
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
- name: Checkout server
uses: actions/checkout@v6
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.nextcloud }}
- name: Checkout Notifications
uses: actions/checkout@v6
with:
repository: nextcloud/notifications
ref: ${{ matrix.nextcloud }}
path: apps/notifications
- name: Set up & run Nextcloud
run: |
mkdir data
./occ maintenance:install --verbose --database=mysql --database-name=nextcloud \
--database-host=127.0.0.1 --database-user=root --database-pass=rootpassword \
--admin-user admin --admin-pass ${{ env.NC_AUTH_PASS }}
./occ config:system:set loglevel --value=0 --type=integer
./occ config:system:set debug --value=true --type=boolean
./occ config:system:set ratelimit.protection.enabled --value=false --type=boolean
./occ config:system:set overwrite.cli.url --value="http://localhost:8080"
./occ app:enable notifications
PHP_CLI_SERVER_WORKERS=2 php -S localhost:8080 &
- name: Checkout nc_py_app
uses: actions/checkout@v6
with:
path: nc_py_app
- name: Install nc_py_app
working-directory: nc_py_app
run: python3 -m pip -v install ".[dev]"
- name: Checkout AppAPI
uses: actions/checkout@v6
with:
path: apps/app_api
repository: nextcloud/app_api
ref: ${{ matrix.nextcloud }}
- name: Install AppAPI & register ExApp
run: |
php occ app:enable app_api
cd nc_py_app
coverage run --data-file=.coverage.ci_install tests/_install.py &
echo $! > /tmp/_install.pid
python3 tests/_install_wait.py http://127.0.0.1:$APP_PORT/heartbeat "\"status\":\"ok\"" 15 0.5
python3 tests/_app_security_checks.py http://127.0.0.1:$APP_PORT
cd ..
sh nc_py_app/scripts/ci_register.sh "$APP_ID" "$APP_VERSION" "$APP_SECRET" "localhost" "$APP_PORT"
kill -15 $(cat /tmp/_install.pid)
timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null
- name: Checkout Talk
uses: actions/checkout@v6
with:
path: apps/spreed
repository: nextcloud/spreed
ref: ${{ matrix.nextcloud }}
- name: Install Talk
working-directory: apps/spreed
run: make dev-setup
- name: Enable Talk
run: php occ app:enable spreed
- name: Run tests
working-directory: nc_py_app
run: |
coverage run --data-file=.coverage.ci -m pytest
coverage combine && coverage xml -o coverage_maria_${{ matrix.nextcloud }}.xml
- name: Upload Codecov to artifacts
uses: actions/upload-artifact@v7
with:
name: coverage_maria_${{ matrix.nextcloud }}.xml
path: nc_py_app/coverage_maria_${{ matrix.nextcloud }}.xml
if-no-files-found: error
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v7
with:
name: nc_log_maria_${{ matrix.nextcloud }}
path: data/nextcloud.log
if-no-files-found: warn
tests-pgsql:
needs: [analysis]
runs-on: ubuntu-22.04
name: ${{ matrix.nextcloud }} • 🐍3.12 • PgSQL
strategy:
fail-fast: false
matrix:
nextcloud: [ 'stable31', 'stable32' ]
env:
NC_dbname: nextcloud_abz
timeout-minutes: 60
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: rootpassword
POSTGRES_DB: ${{ env.NC_dbname }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Set up php
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Checkout server
uses: actions/checkout@v6
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.nextcloud }}
- name: Checkout Notifications
uses: actions/checkout@v6
with:
repository: nextcloud/notifications
ref: ${{ matrix.nextcloud }}
path: apps/notifications
- name: Set up & run Nextcloud
run: |
mkdir data
./occ maintenance:install --verbose --database=pgsql --database-name=${{ env.NC_dbname }} \
--database-host=127.0.0.1 --database-user=root --database-pass=rootpassword \
--admin-user admin --admin-pass ${{ env.NC_AUTH_PASS }}
./occ config:system:set loglevel --value=0 --type=integer
./occ config:system:set debug --value=true --type=boolean
./occ config:system:set ratelimit.protection.enabled --value=false --type=boolean
./occ config:system:set overwrite.cli.url --value="http://localhost:8080"
./occ app:enable notifications
PHP_CLI_SERVER_WORKERS=2 php -S localhost:8080 &
- name: Checkout nc_py_app
uses: actions/checkout@v6
with:
path: nc_py_app
- name: Install nc_py_app
working-directory: nc_py_app
run: python3 -m pip -v install ".[dev]"
- name: Checkout AppAPI
uses: actions/checkout@v6
with:
path: apps/app_api
repository: nextcloud/app_api
ref: ${{ matrix.nextcloud }}
- name: Install AppAPI & register ExApp
run: |
php occ app:enable app_api
cd nc_py_app
coverage run --data-file=.coverage.ci_install tests/_install.py &
echo $! > /tmp/_install.pid
python3 tests/_install_wait.py http://127.0.0.1:$APP_PORT/heartbeat "\"status\":\"ok\"" 15 0.5
python3 tests/_app_security_checks.py http://127.0.0.1:$APP_PORT
cd ..
sh nc_py_app/scripts/ci_register.sh "$APP_ID" "$APP_VERSION" "$APP_SECRET" "localhost" "$APP_PORT"
kill -15 $(cat /tmp/_install.pid)
timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null
- name: Checkout Talk
uses: actions/checkout@v6
with:
path: apps/spreed
repository: nextcloud/spreed
ref: ${{ matrix.nextcloud }}
- name: Install Talk
working-directory: apps/spreed
run: make dev-setup
- name: Enable Talk
run: php occ app:enable spreed
- name: Run tests
working-directory: nc_py_app
run: |
coverage run --data-file=.coverage.ci -m pytest
coverage combine && coverage xml -o coverage_pgsql_${{ matrix.nextcloud }}.xml
- name: Upload Codecov to artifacts
uses: actions/upload-artifact@v7
with:
name: coverage_pgsql_${{ matrix.nextcloud }}.xml
path: nc_py_app/coverage_pgsql_${{ matrix.nextcloud }}.xml
if-no-files-found: error
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v7
with:
name: nc_log_pgsql_${{ matrix.nextcloud }}
path: data/nextcloud.log
if-no-files-found: warn
tests-upload-coverage:
needs: [tests-maria, tests-pgsql]
permissions:
contents: none
runs-on: ubuntu-22.04
name: Upload Coverage
steps:
- uses: actions/checkout@v6
- name: Download Coverage Artifacts
uses: actions/download-artifact@v8
with:
path: coverage
pattern: coverage_*
merge-multiple: true
- name: Upload report to Codecov
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: coverage
fail_ci_if_error: true
verbose: true
tests-success:
permissions:
contents: none
runs-on: ubuntu-22.04
needs: [tests-upload-coverage]
name: Tests-OK
steps:
- run: echo "Tests passed successfully"