-
Notifications
You must be signed in to change notification settings - Fork 21
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
Open
nabim777
wants to merge
17
commits into
release/2.11
Choose a base branch
from
upgrade-testing-local-setup
base: release/2.11
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
6ef33e1
ci: automate upgrade testing
nabim777 5d00f33
ci: use the specific branch
nabim777 9ef6691
ci: enabling other apps from officail appstore
nabim777 17fe939
ci: add matrix
nabim777 3f97164
ci: use env
nabim777 aac1bd7
ci: remove some env
nabim777 21d3fb3
ci: renaming the workflows
nabim777 b723b48
ci: review addresses
nabim777 30a20e8
ci: use appstore alternatives
nabim777 65fe5d6
ci: enable activity apps in seperate steps
nabim777 f06ceeb
ci: make new tag dynamic
nabim777 ae05d4d
ci: rename bash script file
nabim777 d989751
ci: remove success as not needed
nabim777 3d5293a
ci: add comment in bash script
nabim777 812fba0
ci: remove npm install step
nabim777 89022b1
ci: updated the action full commit sha with latest one
nabim777 1479aa0
ci: use nextcloud as container
nabim777 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| # SPDX-FileCopyrightText: 2026 Jankari Tech Pvt. Ltd. | ||
| # SPDX-License-Identifier: AGPL-3.0-only | ||
| #!/usr/bin/env bash | ||
|
|
||
| # This script is used to build the integration_openproject app for upgrade testing. It performs the following steps: | ||
| # 1. Build the app. | ||
| # 2. Copy necessary app files to a separate folder named publish. | ||
| # 3. Get the current version of the app and update it to a new version by incrementing the major version number. | ||
| # 4. Sign the app using openssl and occ integrity:sign-app command. | ||
| # 5. Archive the app into a tar.gz file. | ||
| # 6. Sign the archive using openssl dgst command. | ||
| # Note: Before running this script, ensure that the nextcloud instance is running and integration_openproject apps need to be build. | ||
|
|
||
| # Required environment variables: | ||
| # 1. NEXTCLOUD_PATH (Absolute path to nextcloud where occ command is available, e.g. /var/www/html/build-app-shared) | ||
| # 2. INTEGRATION_OPENPROJECT_DIR (Absolute path to the directory containing the integration_openproject repository, e.g. /home/user) | ||
|
|
||
| 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 "$NEXTCLOUD_PATH" ]] || [[ -z "$INTEGRATION_OPENPROJECT_DIR" ]]; then | ||
| log_error "Environment variables NEXTCLOUD_PATH or INTEGRATION_OPENPROJECT_DIR are missing." | ||
| exit 1 | ||
| fi | ||
|
|
||
| APP_ID=integration_openproject | ||
| cd "$INTEGRATION_OPENPROJECT_DIR" | ||
|
|
||
| if [[ ! -d "$INTEGRATION_OPENPROJECT_DIR/$APP_ID" ]]; then | ||
| log_error "$APP_ID directory not found on path $INTEGRATION_OPENPROJECT_DIR" | ||
| exit 1 | ||
| fi | ||
|
|
||
| mkdir -p publish | ||
|
|
||
| # copy app files to a separate folder | ||
| log_info "Copying necessary app files to publish directory..." | ||
| rsync -a \ | ||
| --exclude=server \ | ||
| --exclude=dev \ | ||
| --exclude=.git \ | ||
| --exclude=appinfo/signature.json \ | ||
| --exclude='*.swp' \ | ||
| --exclude=build \ | ||
| --exclude=.gitignore \ | ||
| --exclude=.travis.yml \ | ||
| --exclude=.scrutinizer.yml \ | ||
| --exclude=CONTRIBUTING.md \ | ||
| --exclude=composer.phar \ | ||
| --exclude=js/node_modules \ | ||
| --exclude=node_modules \ | ||
| --exclude=src \ | ||
| --exclude=translationfiles \ | ||
| --exclude='webpack.*' \ | ||
| --exclude=stylelint.config.js \ | ||
| --exclude=.eslintrc.js \ | ||
| --exclude=.github \ | ||
| --exclude=.gitlab-ci.yml \ | ||
| --exclude=crowdin.yml \ | ||
| --exclude=tools \ | ||
| --exclude=.tx \ | ||
| --exclude=.l10nignore \ | ||
| --exclude=l10n/.tx \ | ||
| --exclude=l10n/l10n.pl \ | ||
| --exclude=l10n/templates \ | ||
| --exclude='l10n/*.sh' \ | ||
| --exclude='l10n/[a-z][a-z]' \ | ||
| --exclude='l10n/[a-z][a-z]_[A-Z][A-Z]' \ | ||
| --exclude=l10n/no-php \ | ||
| --exclude=makefile \ | ||
| --exclude=screenshots \ | ||
| --exclude='phpunit*xml' \ | ||
| --exclude=tests \ | ||
| --exclude=ci \ | ||
| --exclude=vendor/bin \ | ||
|
nabim777 marked this conversation as resolved.
|
||
| integration_openproject publish/ | ||
|
|
||
| cd publish | ||
|
|
||
| # get current version of integration_openproject and update to new version | ||
| current_version=$(php ${NEXTCLOUD_PATH}/occ app:list --output=json | jq -r '.enabled.integration_openproject') || { log_error "Failed to get current version of integration_openproject app."; exit 1; } | ||
| IFS=. read -r a b c <<< "$current_version" | ||
| NEW_TAG="$((a+1)).$b.$c" | ||
|
|
||
| # Save the new tag to a file for later use in the workflow | ||
| echo "$NEW_TAG" > integration_openproject_new_tag.txt | ||
|
|
||
| # update version in info.xml | ||
| sed -i "s|<version>.*</version>|<version>$NEW_TAG</version>|" "integration_openproject/appinfo/info.xml" | ||
|
|
||
| ##################### | ||
| # Signing the app # | ||
| ##################### | ||
| # https://nextcloudappstore.readthedocs.io/en/latest/developer.html#obtaining-a-certificate | ||
| log_info "Generating app.key and app.crt..." | ||
|
nabim777 marked this conversation as resolved.
|
||
| openssl req -x509 -newkey rsa:4096 -sha256 -nodes \ | ||
| -keyout app.key \ | ||
| -out app.crt \ | ||
| -days 3650 \ | ||
| -subj "/CN=$APP_ID" \ | ||
| -addext "basicConstraints=CA:FALSE" \ | ||
| -addext "keyUsage=digitalSignature" \ | ||
| -addext "extendedKeyUsage=codeSigning" | ||
|
|
||
| if [[ ! -s app.key || ! -s app.crt ]]; then | ||
| log_error "Failed to generate app signing certificate and key. app.key or app.crt not found." | ||
| exit 1 | ||
| fi | ||
|
|
||
| log_info "Adding the generated certificate to nextcloud's root.crt..." | ||
| nextcloud_root_crt="${NEXTCLOUD_PATH}/resources/codesigning/root.crt" | ||
| if [[ -f ${nextcloud_root_crt} ]]; then | ||
| echo "" >> ${nextcloud_root_crt} | ||
| cat app.crt >> ${nextcloud_root_crt} | ||
| else | ||
| log_error "Nextcloud's root.crt not found at ${nextcloud_root_crt}." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # fix permissions for signing | ||
| chown www-data app.key | ||
| chown www-data app.crt | ||
| chown -R www-data integration_openproject | ||
|
|
||
| # Sign the app | ||
| # need full path for signing | ||
| log_info "Signing the app using occ integrity:sign-app command..." | ||
| php ${NEXTCLOUD_PATH}/occ integrity:sign-app \ | ||
| --privateKey=${INTEGRATION_OPENPROJECT_DIR}/publish/app.key \ | ||
| --certificate=${INTEGRATION_OPENPROJECT_DIR}/publish/app.crt \ | ||
| --path=${INTEGRATION_OPENPROJECT_DIR}/publish/$APP_ID || { log_error "Failed to sign app."; exit 1; } | ||
|
|
||
| # Archive the app | ||
| tar -czf $APP_ID-$NEW_TAG.tar.gz $APP_ID | ||
| if [[ ! -f $APP_ID-$NEW_TAG.tar.gz ]]; then | ||
| log_error "Failed to archive the app. Archive file $APP_ID-$NEW_TAG.tar.gz not found." | ||
| exit 1 | ||
| fi | ||
| log_success "Archived the app into $APP_ID-$NEW_TAG.tar.gz." | ||
|
|
||
| ##################### | ||
| # Sign the archive # | ||
| ##################### | ||
| # Check if openssl exists, otherwise install it | ||
| if ! command -v openssl >/dev/null 2>&1; then | ||
| echo "OpenSSL not found. Installing..." | ||
| apt update && apt install -y openssl || { | ||
| echo "Failed to install OpenSSL." | ||
| exit 1 | ||
| } | ||
| fi | ||
|
|
||
| # Sign the archive using openssl dgst command | ||
| log_info "Signing the archive using openssl dgst command..." | ||
| openssl dgst -sha512 -sign app.key $APP_ID-$NEW_TAG.tar.gz \ | ||
| | openssl base64 \ | ||
| | tee ${INTEGRATION_OPENPROJECT_DIR}/publish/sign.txt | ||
|
|
||
| if [[ ! -s ${INTEGRATION_OPENPROJECT_DIR}/publish/sign.txt ]]; then | ||
| log_error "Failed to sign the archive. Signature file sign.txt is empty or not found." | ||
| exit 1 | ||
| else | ||
| log_success "Signed the app archive successfully." | ||
| fi | ||
|
|
||
| log_success "App build and release process has been completed successfully." | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.