Skip to content

Commit 91d9cef

Browse files
committed
ci: add upgrade testing
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
1 parent a966559 commit 91d9cef

2 files changed

Lines changed: 147 additions & 126 deletions

File tree

.github/workflows/shared_workflow.yml

Lines changed: 146 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -19,61 +19,61 @@ on:
1919
name: CI
2020

2121
jobs:
22-
js-lint-unit:
23-
name: js lint and unit tests
24-
runs-on: ubuntu-22.04
25-
steps:
26-
- name: Checkout
27-
if: github.event_name != 'schedule'
28-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
29-
30-
- name: Checkout (Nightly)
31-
if: github.event_name == 'schedule'
32-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
33-
with:
34-
ref: ${{ inputs.branch }}
35-
36-
- name: Read package.json node and npm engines version
37-
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4
38-
id: versions
39-
with:
40-
fallbackNode: '^20'
41-
fallbackNpm: '^10'
42-
43-
- name: Setup NodeJS ${{ steps.versions.outputs.nodeVersion }}
44-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238
45-
with:
46-
node-version: ${{ steps.versions.outputs.nodeVersion }}
47-
cache: 'npm'
48-
49-
- name: Setup NPM ${{ steps.versions.outputs.npmVersion }}
50-
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
51-
52-
- name: Install NPM Dependencies
53-
run: npm install
54-
55-
- name: JS Lint
56-
run: make lint-js || ( echo 'Please run `make lint-js-fix` to format your code' && exit 1 )
57-
58-
- name: Vue Unit tests
59-
run: |
60-
make jsunit
61-
62-
- name: JS Code Coverage Summary Report
63-
if: ${{ github.event_name == 'pull_request' }}
64-
uses: romeovs/lcov-reporter-action@dda1c9b1fa1622b225e9acd87a248751dbcc6ada
65-
with:
66-
github-token: ${{ secrets.GITHUB_TOKEN }}
67-
lcov-file: ./coverage/jest/lcov.info
68-
delete-old-comments: true
69-
title: "JS Code Coverage"
70-
71-
- name: JS coverage check
72-
if: ${{ github.event_name == 'pull_request' }}
73-
uses: VeryGoodOpenSource/very_good_coverage@3b475421464c564c0714d92ce02742bd81fa9eda
74-
with:
75-
min_coverage: '59'
76-
path: './coverage/jest/lcov.info'
22+
# js-lint-unit:
23+
# name: js lint and unit tests
24+
# runs-on: ubuntu-22.04
25+
# steps:
26+
# - name: Checkout
27+
# if: github.event_name != 'schedule'
28+
# uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
29+
30+
# - name: Checkout (Nightly)
31+
# if: github.event_name == 'schedule'
32+
# uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
33+
# with:
34+
# ref: ${{ inputs.branch }}
35+
36+
# - name: Read package.json node and npm engines version
37+
# uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4
38+
# id: versions
39+
# with:
40+
# fallbackNode: '^20'
41+
# fallbackNpm: '^10'
42+
43+
# - name: Setup NodeJS ${{ steps.versions.outputs.nodeVersion }}
44+
# uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238
45+
# with:
46+
# node-version: ${{ steps.versions.outputs.nodeVersion }}
47+
# cache: 'npm'
48+
49+
# - name: Setup NPM ${{ steps.versions.outputs.npmVersion }}
50+
# run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
51+
52+
# - name: Install NPM Dependencies
53+
# run: npm install
54+
55+
# - name: JS Lint
56+
# run: make lint-js || ( echo 'Please run `make lint-js-fix` to format your code' && exit 1 )
57+
58+
# - name: Vue Unit tests
59+
# run: |
60+
# make jsunit
61+
62+
# - name: JS Code Coverage Summary Report
63+
# if: ${{ github.event_name == 'pull_request' }}
64+
# uses: romeovs/lcov-reporter-action@dda1c9b1fa1622b225e9acd87a248751dbcc6ada
65+
# with:
66+
# github-token: ${{ secrets.GITHUB_TOKEN }}
67+
# lcov-file: ./coverage/jest/lcov.info
68+
# delete-old-comments: true
69+
# title: "JS Code Coverage"
70+
71+
# - name: JS coverage check
72+
# if: ${{ github.event_name == 'pull_request' }}
73+
# uses: VeryGoodOpenSource/very_good_coverage@3b475421464c564c0714d92ce02742bd81fa9eda
74+
# with:
75+
# min_coverage: '59'
76+
# path: './coverage/jest/lcov.info'
7777

7878
create-matrix:
7979
runs-on: ubuntu-22.04
@@ -108,11 +108,11 @@ jobs:
108108
if: ${{ success() }}
109109
strategy:
110110
matrix: ${{ fromJson(needs.create-matrix.outputs.matrix) }}
111-
runs-on: ubuntu-22.04
111+
runs-on: ubuntu-latest
112112

113-
defaults:
114-
run:
115-
working-directory: integration_openproject
113+
# defaults:
114+
# run:
115+
# working-directory: integration_openproject
116116

117117
services:
118118
nextcloud:
@@ -148,55 +148,49 @@ jobs:
148148
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
149149

150150
steps:
151-
- name: Checkout
152-
if: github.event_name != 'schedule'
151+
- name: Checkout server (for phpunit and psalm)
153152
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
154153
with:
155-
path: integration_openproject
154+
submodules: true
155+
repository: nextcloud/server
156+
path: server
157+
ref: ${{ matrix.nextcloudVersion }}
156158

157-
- name: Checkout (Nightly)
159+
- name: Checkout integration_openproject (Nightly)
158160
if: github.event_name == 'schedule'
159161
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
160162
with:
161-
path: integration_openproject
163+
path: server/apps/integration_openproject
162164
ref: ${{ inputs.branch }}
163165

164-
- name: Checkout server (for phpunit and psalm)
165-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
166-
with:
167-
submodules: true
168-
repository: nextcloud/server
169-
path: integration_openproject/server
170-
ref: ${{ matrix.nextcloudVersion }}
171-
172166
# activity app cannot be installed using occ command
173167
- name: Checkout (activity)
174168
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
175169
with:
176170
repository: nextcloud/activity
177171
ref: ${{ matrix.nextcloudVersion }}
178-
path: activity
172+
path: server/apps/activity
179173

180174
- name: Checkout (groupfolders)
181175
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
182176
if: ${{ matrix.nextcloudVersion == 'master' }}
183177
with:
184178
repository: nextcloud/groupfolders
185-
path: groupfolders
179+
path: server/apps/groupfolders
186180

187181
- name: Checkout (user_oidc)
188182
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
189183
if: ${{ matrix.nextcloudVersion == 'master' }}
190184
with:
191185
repository: nextcloud/user_oidc
192-
path: user_oidc
186+
path: server/apps/user_oidc
193187

194188
- name: Checkout (oidc)
195189
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
196190
if: ${{ matrix.nextcloudVersion == 'master' }}
197191
with:
198192
repository: h2CK/oidc
199-
path: oidc
193+
path: server/apps/oidc
200194

201195
- name: Setup PHP ${{ format('{0}.{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }}
202196
uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d
@@ -208,7 +202,8 @@ jobs:
208202

209203
- name: Get composer cache directory
210204
id: composer-cache
211-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
205+
run: |
206+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
212207
213208
- name: Cache PHP dependencies
214209
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
@@ -217,45 +212,75 @@ jobs:
217212
key: ${{ runner.os }}-composer-${{ hashFiles('./composer.lock') }}
218213
restore-keys: ${{ runner.os }}-composer-
219214

220-
- name: Install PHP dependencies
221-
run: composer install --no-progress --prefer-dist --optimize-autoloader
222-
223215
- name: Prepare Nextcloud server (for phpunit and psalm)
224216
run: server/occ maintenance:install --admin-pass=admin
225217

218+
- name: Enable integration_openproject (initial)
219+
if: github.event_name != 'schedule'
220+
run: |
221+
cd server/apps
222+
## clone the integration_openproject repository of specified branch and build the app
223+
git clone https://github.com/nextcloud/integration_openproject.git -b ${{ github.event.pull_request.base.ref }}
224+
cd integration_openproject
225+
# echo "${{ github.event.pull_request.head.ref }}" # output upgrade-test-on-release3.0
226+
# git checkout ${{ github.event.pull_request.head.ref }}
227+
## enable the app in the server
228+
if [ "${{matrix.nextcloudVersion}}" == "master" ]; then
229+
# enable app even if it is not compatible with the master branch
230+
../../occ a:e -f integration_openproject
231+
else
232+
../../occ a:e integration_openproject
233+
fi
234+
235+
- name: Upgrade integration_openproject app
236+
if: github.event_name != 'schedule'
237+
run: |
238+
cd server/apps/integration_openproject
239+
git checkout ${{ github.event.pull_request.head.ref }}
240+
../../occ upgrade
241+
../../occ maintenance:mode --off
242+
243+
- name: Install PHP dependencies
244+
run: |
245+
cd server/apps/integration_openproject
246+
composer install --no-progress --prefer-dist --optimize-autoloader
247+
226248
- name: PHP code analysis and linting
227249
run: |
250+
cd server/apps/integration_openproject
251+
pwd
252+
ls -l
253+
composer install --no-progress --prefer-dist --optimize-autoloader
228254
make psalm
229255
make phpcs || ( echo 'Please run `make phpcs-fix` to format your code' && exit 1 )
230256
231257
- name: Setup dependent apps
232258
run: |
233-
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader --working-dir=../activity
234-
cp -r ../activity server/apps
259+
cd server/apps
260+
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader --working-dir=./activity
235261
if [ "${{matrix.nextcloudVersion}}" == "master" ]; then
236-
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader --working-dir=../user_oidc
237-
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader --working-dir=../oidc
238-
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader --working-dir=../groupfolders
239-
cp -r ../oidc ../user_oidc ../groupfolders server/apps
262+
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader --working-dir=./user_oidc
263+
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader --working-dir=./oidc
264+
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader --working-dir=./groupfolders
240265
fi
241266
242-
- name: Enable apps (for phpunit)
267+
- name: Enable other apps (for phpunit)
243268
run: |
244-
mkdir -p server/apps/integration_openproject
245-
cp -r `ls -A | grep -v 'server'` server/apps/integration_openproject/
246269
cd server
247270
if [ "${{matrix.nextcloudVersion}}" == "master" ]; then
248271
# enable app even if it is not compatible with the master branch
249-
./occ a:e -f activity oidc user_oidc groupfolders integration_openproject
272+
./occ a:e -f activity oidc user_oidc groupfolders
250273
else
251-
./occ a:e activity oidc user_oidc groupfolders integration_openproject
252-
cp -r apps/oidc apps/user_oidc apps/groupfolders ${{ github.workspace }}
274+
./occ a:e activity oidc user_oidc groupfolders
275+
cp -r apps/oidc apps/user_oidc apps/groupfolders apps/integration_openproject apps/activity ${{ github.workspace }}
253276
fi
254277
255278
- name: PHP Unit Tests
256279
run: |
257280
cd server/apps/integration_openproject
258281
make phpunit || (echo "A few of the unit tests were unsuccessful. Rerunning the unit test once again......" && make phpunit)
282+
pwd
283+
ls -l
259284
260285
- name: Setup .NET Core # this is required to execute Convert PHP cobertura coverage to lcov step
261286
if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable33'&& matrix.phpVersion == '8.2' }}
@@ -268,8 +293,8 @@ jobs:
268293
if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable33'&& matrix.phpVersion == '8.2' }}
269294
uses: danielpalme/ReportGenerator-GitHub-Action@abaac9fef72e4116bfc69905d51062790bda0335
270295
with:
271-
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.
272-
targetdir: 'integration_openproject/server/apps/integration_openproject/coverage/php' # REQUIRED # The directory where the generated report should be saved.
296+
reports: 'server/apps/integration_openproject/coverage/php/cobertura.xml' # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported.
297+
targetdir: 'server/apps/integration_openproject/coverage/php' # REQUIRED # The directory where the generated report should be saved.
273298
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
274299
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.
275300
historydir: '' # Optional directory for storing persistent coverage information. Can be used in future reports to show coverage evolution.
@@ -288,7 +313,7 @@ jobs:
288313
uses: romeovs/lcov-reporter-action@dda1c9b1fa1622b225e9acd87a248751dbcc6ada
289314
with:
290315
github-token: ${{ secrets.GITHUB_TOKEN }}
291-
lcov-file: 'integration_openproject/server/apps/integration_openproject/coverage/php/lcov.info'
316+
lcov-file: 'server/apps/integration_openproject/coverage/php/lcov.info'
292317
delete-old-comments: true
293318
title: "PHP Code Coverage"
294319

@@ -297,7 +322,7 @@ jobs:
297322
uses: VeryGoodOpenSource/very_good_coverage@3b475421464c564c0714d92ce02742bd81fa9eda
298323
with:
299324
min_coverage: '56'
300-
path: 'integration_openproject/server/apps/integration_openproject/coverage/php/lcov.info'
325+
path: 'server/apps/integration_openproject/coverage/php/lcov.info'
301326

302327
- name: Configure Nextcloud server
303328
run: |
@@ -326,26 +351,28 @@ jobs:
326351
- name: API Tests
327352
env:
328353
NEXTCLOUD_BASE_URL: http://localhost
329-
run: make api-test
330-
331-
notify-nightly-report:
332-
needs:
333-
- js-lint-unit
334-
- api-phpunit-tests
335-
if: ${{ always() && github.event_name == 'schedule' }}
336-
runs-on: ubuntu-22.04
337-
steps:
338-
- name: checkout
339-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
340-
341-
- name: Notify nightly report to element
342-
env:
343-
ELEMENT_CHAT_URL: ${{ secrets.ELEMENT_CHAT_URL }}
344-
ELEMENT_ROOM_ID: ${{ secrets.ELEMENT_ROOM_ID }}
345-
NIGHTLY_CI_USER_TOKEN: ${{ secrets.NIGHTLY_CI_USER_TOKEN }}
346-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
347-
REPO_OWNER: nextcloud
348-
REPO_NAME: integration_openproject
349-
RUN_ID: ${{ github.run_id }}
350-
BRANCH_NAME: ${{ inputs.branch }}
351-
run: ./.github/scripts/notify-to-element.sh
354+
run: |
355+
cd server/apps/integration_openproject
356+
make api-test
357+
358+
# notify-nightly-report:
359+
# needs:
360+
# # - js-lint-unit
361+
# - api-phpunit-tests
362+
# if: ${{ always() && github.event_name == 'schedule' }}
363+
# runs-on: ubuntu-22.04
364+
# steps:
365+
# - name: checkout
366+
# uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
367+
368+
# - name: Notify nightly report to element
369+
# env:
370+
# ELEMENT_CHAT_URL: ${{ secrets.ELEMENT_CHAT_URL }}
371+
# ELEMENT_ROOM_ID: ${{ secrets.ELEMENT_ROOM_ID }}
372+
# NIGHTLY_CI_USER_TOKEN: ${{ secrets.NIGHTLY_CI_USER_TOKEN }}
373+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
374+
# REPO_OWNER: nextcloud
375+
# REPO_NAME: integration_openproject
376+
# RUN_ID: ${{ github.run_id }}
377+
# BRANCH_NAME: ${{ inputs.branch }}
378+
# run: ./.github/scripts/notify-to-element.sh

0 commit comments

Comments
 (0)