-
Notifications
You must be signed in to change notification settings - Fork 20
ci: automate upgrade testing #1019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/2.11
Are you sure you want to change the base?
Changes from all commits
2771035
6c470ce
183de4e
c0e782f
3234322
c696b82
be7bdec
df470d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # SPDX-FileCopyrightText: 2026 Jankari Tech Pvt. Ltd. | ||
| # SPDX-License-Identifier: AGPL-3.0-only | ||
|
|
||
| set -e | ||
|
|
||
| # helper functions | ||
| log_error() { | ||
| echo -e "\e[31m$1\e[0m" | ||
| } | ||
|
|
||
| log_info() { | ||
| echo -e "\e[37m$1\e[0m" | ||
| } | ||
|
|
||
| log_success() { | ||
| echo -e "\e[32m$1\e[0m" | ||
| } | ||
|
|
||
| if [[ -z "$APP_VERSION" ]]; then | ||
| log_error "Environment variables APP_VERSION is missing." | ||
| exit 1 | ||
| fi | ||
|
|
||
| APPSTORE_BASE_URL="${APPSTORE_BASE_URL:-http://localhost:8000}" | ||
| # public certificate of the integration app for testing | ||
| CERTIFICATE="-----BEGIN CERTIFICATE-----\r\nMIIEEjCCAvoCAhF6MA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMjEwMzE4MTMwMTExWhcNMzEwNjI0MTMwMTExWjAiMSAwHgYD\r\nVQQDDBdpbnRlZ3JhdGlvbl9vcGVucHJvamVjdDCCAiIwDQYJKoZ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MRtvI2lQ4F7vF++ym0Lw\r\nMIxSI44hNeixh8Yn9rcy\/LqOUgl0niB5hfAiauRwHcOY5wf1hKE=\r\n-----END CERTIFICATE-----" | ||
| APP_ID="integration_openproject" | ||
|
|
||
| registerApps() { | ||
| app_name=$1 | ||
|
|
||
| register_app=$(curl -s -o /dev/null -w "%{http_code}" -X POST -uadmin:admin \ | ||
| ${APPSTORE_BASE_URL}/api/v1/apps \ | ||
| -H "Content-Type: application/json" \ | ||
| -d "{ | ||
| \"certificate\": \"${CERTIFICATE}\", | ||
| \"signature\": \"signature\" | ||
| }") | ||
| if [[ ${register_app} == 201 ]]; then | ||
| log_success "\"${app_name}\" has been registered successfully!" | ||
| elif [[ ${register_app} == 204 ]]; then | ||
| log_info "\"${app_name}\" has been updated!" | ||
| elif [[ ${register_app} == 400 ]]; then | ||
| log_error "\"${app_name}\" contains invalid characters, the signature!" | ||
| exit 1 | ||
| else | ||
| log_error "Failed to register \"${app_name}\"" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| publishApps() { | ||
| app_name=$1 | ||
| app_version=$2 | ||
|
|
||
| register_app=$(curl -s -o /dev/null -w "%{http_code}" -X POST -uadmin:admin \ | ||
| ${APPSTORE_BASE_URL}/api/v1/apps/releases \ | ||
| -H "Content-Type: application/json" \ | ||
| -d "{ | ||
| \"download\":\"https://github.com/nextcloud/$APP_ID/releases/download/v$APP_VERSION/$APP_ID-$APP_VERSION.tar.gz\", | ||
| \"signature\": \"signature\" | ||
| }") | ||
| if [[ ${register_app} == 200 ]]; then | ||
| log_success "\"${app_name} ${app_version}\" has been updated successfully!" | ||
| elif [[ ${register_app} == 201 ]]; then | ||
| log_success "\"${app_name} ${app_version}\" has been published successfully!" | ||
| else | ||
| log_error "Failed to publish \"${app_name} ${app_version}\"" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| registerApps "$APP_ID" | ||
| publishApps "$APP_ID" "$APP_VERSION" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |
|
|
||
| name: REUSE Compliance Check | ||
|
|
||
| on: [pull_request] | ||
| # on: [pull_request] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,206 @@ | ||
| # SPDX-FileCopyrightText: 2026 Jankari Tech Pvt. Ltd. | ||
| # SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
|
||
| name: Upgrade Testing | ||
|
|
||
| on: [pull_request] | ||
|
|
||
| jobs: | ||
| create-matrix: | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 | ||
|
|
||
| - name: Create matrix | ||
| id: create-matrix | ||
| env: | ||
| NEXTCLOUD_VERSIONS: "29 30" | ||
| PHP_VERSIONS: "8.2 8.3" | ||
| run: | | ||
| MATRIX=$(./.github/scripts/generate-matrix.sh) | ||
| echo "matrix={\"include\": [$MATRIX]}" >> $GITHUB_OUTPUT | ||
| outputs: | ||
| matrix: ${{ steps.create-matrix.outputs.matrix }} | ||
|
|
||
| upgrade-test: | ||
| name: Upgrade Testing | ||
| needs: create-matrix | ||
| if: ${{ success() }} | ||
| strategy: | ||
| matrix: ${{ fromJson(needs.create-matrix.outputs.matrix) }} | ||
| runs-on: ubuntu-latest | ||
|
|
||
| env: | ||
| DJANGO_SETTINGS_MODULE: nextcloudappstore.settings.development | ||
| PREVIOUS_APP_VERSION: 2.9.2 | ||
| UPGRADE_APP_VERSION: 2.10.0 | ||
|
Comment on lines
+36
to
+37
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should install the current compatible app version without specifying the version. |
||
| APPSTORE_BASE_URL: http://localhost:8000 | ||
| services: | ||
| 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' | ||
| ports: | ||
| - 3306:3306 | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 | ||
| with: | ||
| path: integration_openproject | ||
| fetch-tags: true | ||
| ref: v${{ env.UPGRADE_APP_VERSION }} | ||
|
Comment on lines
+53
to
+56
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure about it. simply checkout the current source |
||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 | ||
| with: | ||
| repository: nextcloud/activity | ||
| ref: ${{ matrix.nextcloudVersion }} | ||
| path: activity | ||
|
|
||
| - name: Setup NodeJS | ||
| uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 | ||
| with: | ||
| node-version: 20 | ||
|
|
||
| - name: Setup npm | ||
| run: npm i -g npm | ||
|
|
||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d | ||
| with: | ||
| php-version: ${{ format('{0}.{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }} | ||
| extensions: mbstring, intl, mysql, gd | ||
| ini-values: post_max_size=256M, max_execution_time=180 | ||
|
|
||
| - name: Build nextcloud project | ||
| run: | | ||
| export DEBIAN_FRONTEND=noninteractive | ||
|
Comment on lines
+80
to
+82
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we start nextcloud in the service section?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly, but why do you think so? |
||
| echo "###### installing nextcloud" | ||
| mkdir ~/html | ||
| git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b ${{ matrix.nextcloudVersion }} ~/html/nextcloud | ||
| cd ~/html/nextcloud | ||
| git submodule update --init | ||
| mkdir -p data | ||
| php occ maintenance:install \ | ||
| --database mysql \ | ||
| --database-name nextcloud \ | ||
| --database-host 127.0.0.1 \ | ||
| --database-user nextcloud \ | ||
| --database-pass nextcloud \ | ||
| --admin-user admin \ | ||
| --admin-pass admin | ||
| php occ maintenance:mode --off | ||
| sudo php -S localhost:80 -t ~/html/nextcloud & | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it would be better to run NC with a real web-server like apache, but for now this should be fine |
||
|
|
||
| - name: Wait for Nextcloud server to be ready | ||
| run: | | ||
| 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 | ||
|
|
||
|
|
||
| - name: Setup System dependencies for appstore | ||
| run: | | ||
| sudo apt install -y \ | ||
| python3-venv \ | ||
| python3-wheel \ | ||
| libxslt-dev \ | ||
| libxml2-dev \ | ||
| libz-dev \ | ||
| libpq-dev \ | ||
| build-essential \ | ||
| python3-dev \ | ||
| python3-setuptools \ | ||
| gettext \ | ||
| libssl-dev \ | ||
| libffi-dev \ | ||
| nodejs \ | ||
| yarn | ||
|
|
||
| - name: Checkout appstore | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 | ||
| with: | ||
| repository: nextcloud/appstore | ||
| path: appstore | ||
|
|
||
| - name: Install Appstore | ||
| run: | | ||
| cd appstore | ||
| python3 -m venv venv | ||
| source venv/bin/activate | ||
| pip install poetry==1.8.2 | ||
| make dev-setup | ||
| python manage.py runserver & | ||
|
Comment on lines
+113
to
+144
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, maybe we should create custom minimal REST server as appstore
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but can be next improvement |
||
|
|
||
| - name: Check for Appstore | ||
| run: | | ||
| cd appstore | ||
| status=$(curl -o /dev/null -s -w "%{http_code}" "$APPSTORE_BASE_URL") | ||
| if [ "$status" -eq 200 ]; then | ||
| echo "OK" | ||
| else | ||
| echo "FAILED (status: $status)" | ||
| fi | ||
|
|
||
| - name: Register and publish integration_openproject apps | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the previous app version can be installed from the official app store. Just take the latest published stable version |
||
| env: | ||
| APP_VERSION: ${{ env.PREVIOUS_APP_VERSION }} | ||
| run: | | ||
| wget https://raw.githubusercontent.com/nextcloud/integration_openproject/${{github.head_ref}}/.github/scripts/register-and-publish-app-to-self-hosted-appstore.sh | ||
| bash ./register-and-publish-app-to-self-hosted-appstore.sh | ||
|
|
||
| - name: Enable other apps from official app store | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not entirely true, because at least
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Activity app is not available in the App Store. It is a core app of Nextcloud. It is not included when the Nextcloud source is from Git.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then maybe call the step |
||
| run: | | ||
| cp -R activity ~/html/nextcloud/apps | ||
| cd ~/html/nextcloud | ||
| php occ app:enable oidc user_oidc groupfolders activity | ||
|
|
||
| - name: Enable integration_openproject app from self-hosted app store | ||
| run: | | ||
| # making the signature verification always pass for testing | ||
| # by making the $verified variable true in Installer.php | ||
| sed -i.bak 's/$verified = .*/$verified = true;/' /home/runner/html/nextcloud/lib/private/Installer.php || { | ||
| echo "::error::Failed to patch Installer.php with sed" | ||
| exit 1 | ||
| } | ||
| # latest data didn't get fetched properly, so we need to clear the appstore cache | ||
| echo "" > ~/html/nextcloud/data/appdata_*/appstore/apps.json | ||
| cd ~/html/nextcloud | ||
| php occ config:system:set ratelimit.protection.enabled --value false --type bool | ||
| php occ config:system:set appstoreurl --value "$APPSTORE_BASE_URL/api/v1" | ||
| php occ config:system:set allow_local_remote_servers --value true | ||
| php occ app:install integration_openproject | ||
|
|
||
| - name: Register and publish next release of the app | ||
| env: | ||
| APP_VERSION: ${{ env.UPGRADE_APP_VERSION }} | ||
| run: | | ||
| bash ./register-and-publish-app-to-self-hosted-appstore.sh | ||
|
|
||
| - name: upgrade apps | ||
| run: | | ||
| cd ~/html/nextcloud | ||
| # latest data didn't get fetched properly, so we need to clear the appstore cache | ||
| echo "" > ~/html/nextcloud/data/appdata_*/appstore/apps.json | ||
| php occ app:update --allow-unstable integration_openproject | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should check whether the upgrade to the new version really happened |
||
|
|
||
| - name: API Tests | ||
| env: | ||
| NEXTCLOUD_BASE_URL: http://localhost | ||
| run: | | ||
| cd integration_openproject | ||
| # build apps | ||
| make | ||
| # Run API tests | ||
| make api-test | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that version should be found automatically. Just take the last released stable version.
Otherwise, there is one more place to remember to change version numbers.