-
Notifications
You must be signed in to change notification settings - Fork 21
343 lines (309 loc) · 13.5 KB
/
shared_workflow.yml
File metadata and controls
343 lines (309 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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# SPDX-FileCopyrightText: 2023-2025 Jankari Tech Pvt. Ltd.
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
on:
workflow_call:
inputs:
branch:
required: true
type: string
nextcloud_versions:
required: false
type: string
default: "32 master"
php_versions:
required: false
type: string
default: "8.3"
name: CI
jobs:
# js-lint-unit:
# name: js lint and unit tests
# runs-on: ubuntu-22.04
# steps:
# - name: Checkout for nightly CI
# if: github.event_name == 'schedule'
# uses: actions/checkout@v3
# with:
# ref: ${{ inputs.branch }}
#
# - name: Checkout
# if: github.event_name != 'schedule'
# uses: actions/checkout@v3
#
# - name: Read package.json node and npm engines version
# uses: skjnldsv/read-package-engines-version-actions@v2
# id: versions
# with:
# fallbackNode: '^14'
# fallbackNpm: '^7'
#
# - name: Setup NodeJS ${{ steps.versions.outputs.nodeVersion }}
# uses: actions/setup-node@v3
# with:
# node-version: ${{ steps.versions.outputs.nodeVersion }}
# cache: 'npm'
#
# - name: Setup NPM ${{ steps.versions.outputs.npmVersion }}
# run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
#
# - name: Install NPM Dependencies
# run: npm install
#
# - name: JS Lint
# run: make lint-js || ( echo 'Please run `make lint-js-fix` to format your code' && exit 1 )
#
# - name: Vue Unit tests
# run: |
# make jsunit
#
# - name: JS Code Coverage Summary Report
# if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable29' && matrix.phpVersion == '8.1' }}
# uses: romeovs/lcov-reporter-action@v0.3.1
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# lcov-file: ./coverage/jest/lcov.info
# delete-old-comments: true
# title: "JS Code Coverage"
#
# - name: JS coverage check
# if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable29' && matrix.phpVersion == '8.1' }}
# uses: VeryGoodOpenSource/very_good_coverage@v2
# with:
# min_coverage: '59'
# path: './server/apps/integration_openproject/coverage/jest/lcov.info'
create-matrix:
runs-on: ubuntu-22.04
steps:
- name: Checkout for nightly CI
if: github.event_name == 'schedule'
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: Checkout
if: github.event_name != 'schedule'
uses: actions/checkout@v3
- name: Create matrix
id: create-matrix
env:
NEXTCLOUD_VERSIONS: ${{ inputs.nextcloud_versions }}
PHP_VERSIONS: ${{ inputs.php_versions }}
DEFAULT_PHP_VERSION: "8.2"
DEFAULT_DATABASE: "mysql"
EXTRA_DATABASES: "pgsql"
run: |
MATRIX=$(./.github/scripts/generate-matrix.sh)
echo "matrix={\"include\": [$MATRIX]}" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.create-matrix.outputs.matrix }}
api-phpunit-tests:
name: PHP Unit & API tests
needs: create-matrix
if: ${{ success() }}
strategy:
matrix: ${{ fromJson(needs.create-matrix.outputs.matrix) }}
runs-on: ubuntu-22.04
defaults:
run:
working-directory: integration_openproject
services:
nextcloud:
image: ghcr.io/juliusknorr/nextcloud-dev-php${{ format('{0}{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }}:20231202-1
env:
SQL: ${{ matrix.database }}
SERVER_BRANCH: ${{ matrix.nextcloudVersion }}
NEXTCLOUD_AUTOINSTALL: "Yes"
NEXTCLOUD_AUTOINSTALL_APPS: "viewer activity groupfolders integration_openproject"
NEXTCLOUD_TRUSTED_DOMAINS: nextcloud
VIRTUAL_HOST: "nextcloud"
WITH_REDIS: "YES"
NEXTCLOUD_AUTOINSTALL_APPS_WAIT_TIME: 120
ports:
- 80:80
options: --name=nextcloud
volumes:
- ${{ github.workspace }}:/var/www/html/apps-shared
database-postgres:
image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: nextcloud
database-mysql:
image: ghcr.io/nextcloud/continuous-integration-mariadb-10.5:latest
env:
MYSQL_ROOT_PASSWORD: 'nextcloud'
MYSQL_PASSWORD: 'nextcloud'
MYSQL_USER: 'nextcloud'
MYSQL_DATABASE: 'nextcloud'
redis:
image: ghcr.io/nextcloud/continuous-integration-redis:latest
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout for nightly CI
if: github.event_name == 'schedule'
uses: actions/checkout@v3
with:
path: integration_openproject
ref: ${{ inputs.branch }}
- name: Checkout
if: github.event_name != 'schedule'
uses: actions/checkout@v3
with:
path: integration_openproject
- name: Checkout activity app
uses: actions/checkout@v3
with:
repository: nextcloud/activity
path: activity
ref: ${{ matrix.nextcloudVersion }}
- name: Checkout groupfolders app
uses: actions/checkout@v3
with:
repository: nextcloud/groupfolders
path: groupfolders
ref: ${{ matrix.nextcloudVersion }}
- name: Checkout user_oidc app
uses: actions/checkout@v3
with:
repository: nextcloud/user_oidc
ref: v7.2.0
fetch-tags: true
path: user_oidc
- name: Checkout oidc app
uses: actions/checkout@v3
with:
repository: h2CK/oidc
ref: 1.6.0
fetch-tags: true
path: oidc
- name: Checkout server (for phpunit and psalm)
uses: actions/checkout@v3
with:
submodules: true
repository: nextcloud/server
path: integration_openproject/server
ref: ${{ matrix.nextcloudVersion }}
- name: Setup PHP ${{ format('{0}.{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ format('{0}.{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }}
tools: composer, phpunit
coverage: xdebug
extensions: intl, gd, sqlite3
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache PHP dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('./composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Setup server and apps
run: |
# integration_openproject app
composer install --no-progress --prefer-dist --optimize-autoloader
# user_oidc app
composer install --no-interaction --prefer-dist --optimize-autoloader --working-dir=../user_oidc
cd server && ./occ maintenance:install --admin-pass=admin
# - name: PHP code analysis and linting
# run: |
# make psalm
# make phpcs || ( echo 'Please run `make phpcs-fix` to format your code' && exit 1 )
- name: Enable apps
run: |
mkdir -p server/apps/integration_openproject
cp -r `ls -A | grep -v 'server'` server/apps/integration_openproject/
cp -r ../groupfolders ../activity server/apps
cd server
./occ a:e groupfolders integration_openproject activity
if [ "${{matrix.nextcloudVersion}}" != "stable27" ]; then
cp -r ../../user_oidc ../../oidc apps
./occ a:e -f user_oidc
# enable app even if it is not compatible with the current server version
./occ a:e -f oidc
fi
# - name: PHP Unit Tests
# run: |
# cd server/apps/integration_openproject
# make phpunit || (echo "A few of the unit tests were unsuccessful. Rerunning the unit test once again......" && make phpunit)
- name: Setup .NET Core # this is required to execute Convert PHP cobertura coverage to lcov step
if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable29' && matrix.phpVersion == '8.1' }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.101
dotnet-quality: 'ga'
- name: Convert PHP cobertura coverage to lcov
if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable29' && matrix.phpVersion == '8.1' }}
uses: danielpalme/ReportGenerator-GitHub-Action@5.1.23
with:
reports: 'integration_openproject/server/apps/integration_openproject/coverage/php/cobertura.xml' # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported.
targetdir: 'integration_openproject/server/apps/integration_openproject/coverage/php' # REQUIRED # The directory where the generated report should be saved.
reporttypes: 'lcov' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MarkdownSummary, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary
sourcedirs: '' # Optional directories which contain the corresponding source code (separated by semicolon). The source directories are used if coverage report contains classes without path information.
historydir: '' # Optional directory for storing persistent coverage information. Can be used in future reports to show coverage evolution.
plugins: '' # Optional plugin files for custom reports or custom history storage (separated by semicolon).
assemblyfilters: '+*' # Optional list of assemblies that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.
classfilters: '+*' # Optional list of classes that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.
filefilters: '+*' # Optional list of files that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.
verbosity: 'Verbose' # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off
title: '' # Optional title.
tag: '${{ github.run_number }}_${{ github.run_id }}' # Optional tag or build version.
customSettings: '' # Optional custom settings (separated by semicolon). See: https://github.com/danielpalme/ReportGenerator/wiki/Settings.
toolpath: 'reportgeneratortool' # Default directory for installing the dotnet tool.
- name: PHP Code Coverage Summary Report
if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable29' && matrix.phpVersion == '8.1' }}
uses: romeovs/lcov-reporter-action@v0.3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lcov-file: 'integration_openproject/server/apps/integration_openproject/coverage/php/lcov.info'
delete-old-comments: true
title: "PHP Code Coverage"
- name: PHP coverage check
if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable29' && matrix.phpVersion == '8.1' }}
uses: VeryGoodOpenSource/very_good_coverage@v2
with:
min_coverage: '56'
path: 'integration_openproject/server/apps/integration_openproject/coverage/php/lcov.info'
- name: Configure Nextcloud server
run: |
# Disable share rate limit protection
docker exec nextcloud /bin/bash -c 'occ config:system:set ratelimit.protection.enabled --value false --type bool'
- name: Check output
run: |
curl -k -s http://localhost/status.php
- name: API Tests
env:
NEXTCLOUD_BASE_URL: http://localhost
run: |
composer install --no-progress --prefer-dist --optimize-autoloader
# if ! timeout 5m bash -c '
# until curl -s -f http://localhost/status.php | grep '"'"'"installed":true'"'"'; do
# echo "[INFO] Waiting for server to be ready..."
# sleep 10
# done
# '; then
# echo "[ERROR] Server not ready within 5 minutes."
# exit 1
# fi
make api-test
notify-nightly-report:
needs:
# - js-lint-unit
- api-phpunit-tests
if: ${{ always() && github.event_name == 'schedule' }}
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v2
- name: Notify nightly report to element
env:
ELEMENT_CHAT_URL: ${{ secrets.ELEMENT_CHAT_URL }}
ELEMENT_ROOM_ID: ${{ secrets.ELEMENT_ROOM_ID }}
NIGHTLY_CI_USER_TOKEN: ${{ secrets.NIGHTLY_CI_USER_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_OWNER: nextcloud
REPO_NAME: integration_openproject
RUN_ID: ${{ github.run_id }}
BRANCH_NAME: ${{ inputs.branch }}
run: ./.github/scripts/notify-to-element.sh