1+ # This workflow is provided via the organization template repository
2+ #
3+ # https://github.com/nextcloud/.github
4+ # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+ # SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. <https://fsfe.org>
7+ #
8+ # SPDX-License-Identifier: CC0-1.0
9+
10+ name : Upgrade Testing
11+
12+ on : [pull_request]
13+
14+ jobs :
15+ build :
16+ runs-on : ubuntu-latest
17+ env :
18+ DJANGO_SETTINGS_MODULE : nextcloudappstore.settings.development
19+ services :
20+
21+ database-mysql :
22+ image : ghcr.io/nextcloud/continuous-integration-mariadb-10.5:latest
23+ env :
24+ MYSQL_ROOT_PASSWORD : ' nextcloud'
25+ MYSQL_PASSWORD : ' nextcloud'
26+ MYSQL_USER : ' nextcloud'
27+ MYSQL_DATABASE : ' nextcloud'
28+ ports :
29+ - 3306:3306
30+
31+ steps :
32+ - name : Checkout
33+ uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
34+ with :
35+ path : integration_openproject
36+
37+ - name : Setup NodeJS
38+ uses : actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238
39+ with :
40+ node-version : 20
41+
42+ - name : Setup npm
43+ run : npm i -g npm
44+
45+ - name : Setup PHP
46+ uses : shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d
47+ with :
48+ php-version : ' 8.2'
49+ extensions : mbstring, intl, mysql, gd
50+ ini-values : post_max_size=256M, max_execution_time=180
51+ coverage : xdebug
52+ tools : php-cs-fixer, phpunit
53+
54+ - name : Build nextcloud project
55+ # if: ${{ startsWith( steps.tag.outputs.currenttag , 'v' ) }}
56+ # id: build_release
57+ run : |
58+ export DEBIAN_FRONTEND=noninteractive
59+ echo "###### installing nextcloud"
60+ mkdir ~/html
61+ git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b stable29 ~/html/nextcloud
62+ cd ~/html/nextcloud
63+ git submodule update --init
64+ mkdir -p data
65+ # chown -R www-data:www-data config data apps
66+ php occ maintenance:install \
67+ --database mysql \
68+ --database-name nextcloud \
69+ --database-host 127.0.0.1 \
70+ --database-user nextcloud \
71+ --database-pass nextcloud \
72+ --admin-user admin \
73+ --admin-pass admin
74+ php occ maintenance:mode --off
75+ sudo php -S localhost:80 -t ~/html/nextcloud &
76+
77+ - name : Wait for Nextcloud server to be ready
78+ run : |
79+ if ! timeout 5m bash -c '
80+ until curl -s -f http://localhost/status.php | grep '"'"'"installed":true'"'"'; do
81+ echo "[INFO] Waiting for server to be ready..."
82+ sleep 10
83+ done
84+ '; then
85+ echo "[ERROR] Server not ready within 5 minutes."
86+ exit 1
87+ fi
88+
89+
90+ - name : Setup System dependencies for appstore
91+ run : |
92+ sudo apt install -y \
93+ python3-venv \
94+ python3-wheel \
95+ libxslt-dev \
96+ libxml2-dev \
97+ libz-dev \
98+ libpq-dev \
99+ build-essential \
100+ python3-dev \
101+ python3-setuptools \
102+ gettext \
103+ libssl-dev \
104+ libffi-dev \
105+ nodejs \
106+ yarn
107+
108+ - name : Checkout appstore
109+ uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
110+ with :
111+ repository : nextcloud/appstore
112+ path : appstore
113+
114+ - name : Install Appstore
115+ run : |
116+ cd appstore
117+ python3 -m venv venv
118+ source venv/bin/activate
119+ pip install poetry==1.8.2
120+ make dev-setup
121+ python manage.py runserver &
122+
123+ - name : Check for Appstore
124+ run : |
125+ cd appstore
126+ status=$(curl -o /dev/null -s -w "%{http_code}" http://localhost:8000)
127+ if [ "$status" -eq 200 ]; then
128+ echo "OK"
129+ else
130+ echo "FAILED (status: $status)"
131+ fi
132+
133+ - name : Register and publish apps
134+ env :
135+ APP_ID : integration_openproject
136+ APP_VERSION : 2.9.2
137+ run : |
138+ cd integration_openproject
139+ bash ./.github/scripts/self-hosted-app-store.sh
140+
141+ - name : Configure Nextcloud for testing
142+ run : |
143+ # making the signature verification always pass for testing
144+ # by making the $verified variable true in Installer.php
145+ sed -i.bak 's/$verified = .*/$verified = true;/' /home/runner/html/nextcloud/lib/private/Installer.php || {
146+ echo "::error::Failed to patch Installer.php with sed"
147+ exit 1
148+ }
149+ cd ~/html/nextcloud
150+ php occ config:system:set appstoreurl --value http://localhost:8000/api/v1
151+ php occ config:system:set allow_local_remote_servers --value true
152+ php occ app:install integration_openproject
153+
154+ - name : Register and publish next release of the app
155+ env :
156+ APP_ID : integration_openproject
157+ APP_VERSION : 2.10.0
158+ run : |
159+ cd integration_openproject
160+ bash ./.github/scripts/self-hosted-app-store.sh
161+
162+ - name : upgrade apps
163+ run : |
164+ cd ~/html/nextcloud
165+ # latest data didn't get fetched properly, so we need to clear the appstore cache
166+ echo "" > ~/html/nextcloud/data/appdata_*/appstore/apps.json
167+ php occ app:update --allow-unstable integration_openproject
168+
169+ - name : API Tests
170+ env :
171+ NEXTCLOUD_BASE_URL : http://localhost
172+ run : |
173+ cd integration_openproject
174+ # build apps
175+ make
176+ # Run API tests
177+ make api-test
178+
179+ # - name: Setup Debug Session
180+ # uses: csexton/debugger-action@master
181+
182+ # - name: Configure Nextcloud for testing
183+ # run: |
184+ # ls -l
185+
186+ # cd ~/html/nextcloud
187+ # ls -l
188+ # php occ app:install integration_openproject
0 commit comments