diff --git a/.github/scripts/notify-to-element.sh b/.github/scripts/notify-to-element.sh index 25e8cc650..d24ea2b72 100755 --- a/.github/scripts/notify-to-element.sh +++ b/.github/scripts/notify-to-element.sh @@ -2,6 +2,8 @@ # SPDX-FileCopyrightText: 2023-2024 Jankari Tech Pvt. Ltd. # SPDX-License-Identifier: AGPL-3.0-or-later +set -e + # helper functions log_error() { echo -e "\e[31m$1\e[0m" @@ -15,42 +17,65 @@ log_success() { echo -e "\e[32m$1\e[0m" } -log_info "Fetching all workflow jobs....." +required_vars=( + ELEMENT_CHAT_URL + ELEMENT_ROOM_ID + NIGHTLY_CI_USER_TOKEN + GITHUB_REPOSITORY + GITHUB_RUN_ID + BRANCH_NAME + NEEDS_JSON +) -response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ - "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/actions/runs/$RUN_ID/jobs?per_page=50") +for var in "${required_vars[@]}"; do + if [[ -z "${!var}" ]]; then + log_error "❌ Missing required environment variable: $var" + log_info "" + log_info "Required environment variables:" + log_info "- ELEMENT_CHAT_URL : URL of the Element chat (e.g. https://matrix.element.io)" + log_info "- ELEMENT_ROOM_ID : Matrix room ID (e.g. abcdefg:matrix.element.io)" + log_info "- NIGHTLY_CI_USER_TOKEN : Access token for sending messages (e.g. "sometoken")" + log_info "- GITHUB_REPOSITORY : GitHub repository (e.g. user/repo) set by GitHub Actions environment variable" + log_info "- GITHUB_RUN_ID : GitHub run ID (e.g. 123456789) set by GitHub Actions environment variable" + log_info "- BRANCH_NAME : Branch name (e.g. master)" + log_info "- NEEDS_JSON : JSON string containing job results" + log_info "" + exit 1 + fi +done -log_info "Fetching jobs informations succeeded! -" -if [[ "$response" != *"jobs"* ]]; then - log_error "No jobs found in the below response!" - log_info "$response" +jobs=$(echo "$NEEDS_JSON" | jq -r 'keys[]' 2>/dev/null) +if [[ -z "$jobs" ]]; then + log_error "❌ No jobs found in below JSON:" + log_info "$NEEDS_JSON" exit 1 fi -jobs_informations=$(echo "$response" | jq '.jobs[:-1]') -jobs_conclusions=$(echo "$jobs_informations" | jq -r '.[].conclusion') +results=$(echo "$NEEDS_JSON" | jq -r '.[].result' 2>/dev/null) -workflow_status="Success" -if [[ " ${jobs_conclusions[*]} " == *"failure"* ]]; then - workflow_status="Failure" -elif [[ " ${jobs_conclusions[*]} " == *"cancelled"* ]]; then - workflow_status="Cancelled" -elif [[ " ${jobs_conclusions[*]} " == *"skipped"* ]]; then - workflow_status="Skipped" +workflow_status="✅ Success" +if [[ "${results[*]}" == *"failure"* ]]; then + workflow_status="❌ Failure" +elif [[ "${results[*]}" == *"cancelled"* ]]; then + workflow_status="⚠️ Cancelled" +elif [[ "${results[*]}" == *"skipped"* ]]; then + workflow_status="⚠️ Skipped" fi log_info "Sending report to the element chat...." +payload=$(cat <NC-Nightly-${BRANCH_NAME}

Status: ${workflow_status}" +} +EOF +) + send_message_to_room_response=$(curl -s -XPOST "$ELEMENT_CHAT_URL/_matrix/client/r0/rooms/%21$ELEMENT_ROOM_ID/send/m.room.message?access_token=$NIGHTLY_CI_USER_TOKEN" \ - -d ' - { - "msgtype": "m.text", - "body": "", - "format": "org.matrix.custom.html", - "formatted_body": "NC-Nightly-'$BRANCH_NAME'

Status: '$workflow_status'" - } - ' + -d "$payload" ) if [[ "$send_message_to_room_response" != *"event_id"* ]]; then @@ -59,4 +84,4 @@ if [[ "$send_message_to_room_response" != *"event_id"* ]]; then exit 1 fi -log_success "Notification of the nightly build has been sent to Element chat (OpenProject + Nextcloud)" +log_success "Notification of the nightly build has been sent to Element chat (OpenProject + Nextcloud)" \ No newline at end of file diff --git a/.github/workflows/app-upgrade.yml b/.github/workflows/app-upgrade.yml index 4c36cb65e..0f35166bf 100644 --- a/.github/workflows/app-upgrade.yml +++ b/.github/workflows/app-upgrade.yml @@ -12,11 +12,11 @@ on: nextcloud_versions: required: false type: string - default: "31 32" + default: 'master' php_versions: required: false type: string - default: "8.3" + default: '8.4' jobs: create-matrix: @@ -24,14 +24,16 @@ jobs: steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + ref: ${{ inputs.branch }} - name: Create matrix id: create-matrix env: NEXTCLOUD_VERSIONS: ${{ inputs.nextcloud_versions }} PHP_VERSIONS: ${{ inputs.php_versions }} - DEFAULT_PHP_VERSION: "8.3" - DEFAULT_DATABASE: "mysql" + DEFAULT_PHP_VERSION: '8.4' + DEFAULT_DATABASE: 'mysql' run: | MATRIX=$(./.github/scripts/generate-matrix.sh) echo "matrix={\"include\": [$MATRIX]}" >> $GITHUB_OUTPUT @@ -63,7 +65,7 @@ jobs: - ${{ github.workspace }}/build-app:/var/www/html/build-app-shared database-mysql: - image: ghcr.io/nextcloud/continuous-integration-mariadb-10.5:latest + image: ghcr.io/nextcloud/continuous-integration-mariadb-11.8:latest env: MYSQL_ROOT_PASSWORD: 'nextcloud' MYSQL_PASSWORD: 'nextcloud' @@ -79,6 +81,7 @@ jobs: uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: path: integration_openproject + ref: ${{ inputs.branch }} - name: Setup PHP ${{ format('{0}.{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }} uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d @@ -171,5 +174,7 @@ jobs: working-directory: integration_openproject env: NEXTCLOUD_BASE_URL: http://localhost + NEXTCLOUD_VERSION: ${{ matrix.nextcloudVersion }} + BEHAT_FILTER_TAGS: '~@skip' run: | make api-test \ No newline at end of file diff --git a/.github/workflows/nighlty-ci-master.yml b/.github/workflows/nighlty-ci-master.yml index b2a691155..2d0ab0d56 100644 --- a/.github/workflows/nighlty-ci-master.yml +++ b/.github/workflows/nighlty-ci-master.yml @@ -15,3 +15,27 @@ jobs: secrets: inherit with: branch: master + + app-upgrade-test: + uses: ./.github/workflows/app-upgrade.yml + with: + branch: master + nextcloud_versions: '33' + + notify-nightly-report: + needs: [builds, app-upgrade-test] + if: ${{ always() }} + runs-on: ubuntu-22.04 + steps: + - name: checkout + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 + + - name: Notify Element (nightly builds) + env: + ELEMENT_CHAT_URL: ${{ secrets.ELEMENT_CHAT_URL }} + ELEMENT_ROOM_ID: ${{ secrets.ELEMENT_ROOM_ID }} + NIGHTLY_CI_USER_TOKEN: ${{ secrets.NIGHTLY_CI_USER_TOKEN }} + BRANCH_NAME: master + NEEDS_JSON: ${{ toJson(needs) }} + run: | + ./.github/scripts/notify-to-element.sh \ No newline at end of file diff --git a/.github/workflows/nighlty-ci-release-2-branch.yml b/.github/workflows/nighlty-ci-release-2-branch.yml new file mode 100644 index 000000000..f13e3d1c2 --- /dev/null +++ b/.github/workflows/nighlty-ci-release-2-branch.yml @@ -0,0 +1,43 @@ +# SPDX-FileCopyrightText: 2023-2025 Jankari Tech Pvt. Ltd. +# SPDX-License-Identifier: AGPL-3.0-or-later +name: Nightly CI (Release 2.11 branch) + +# workflow can be scheduled ONLY from DEFAULT branch +# > This event will only trigger a workflow run if the workflow file is on the default branch. +# See: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule +on: + schedule: + - cron: '0 23 * * *' # run at 11 PM UTC + +jobs: + builds: + uses: ./.github/workflows/shared_workflow.yml + secrets: inherit + with: + branch: release/2.11 + nextcloud_versions: '31 32' + php_versions: '8.2 8.3 8.4' + + app-upgrade-test: + uses: ./.github/workflows/app-upgrade.yml + with: + branch: release/2.11 + nextcloud_versions: '31 32' + + notify-nightly-report: + needs: [builds, app-upgrade-test] + if: ${{ always() }} + runs-on: ubuntu-22.04 + steps: + - name: checkout + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 + + - name: Notify Element (nightly builds) + env: + ELEMENT_CHAT_URL: ${{ secrets.ELEMENT_CHAT_URL }} + ELEMENT_ROOM_ID: ${{ secrets.ELEMENT_ROOM_ID }} + NIGHTLY_CI_USER_TOKEN: ${{ secrets.NIGHTLY_CI_USER_TOKEN }} + BRANCH_NAME: release/2.11 + NEEDS_JSON: ${{ toJson(needs) }} + run: | + ./.github/scripts/notify-to-element.sh diff --git a/.github/workflows/nighlty-ci-release-branch.yml b/.github/workflows/nighlty-ci-release-branch.yml deleted file mode 100644 index 6ab3b0aaa..000000000 --- a/.github/workflows/nighlty-ci-release-branch.yml +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-FileCopyrightText: 2023-2025 Jankari Tech Pvt. Ltd. -# SPDX-License-Identifier: AGPL-3.0-or-later -name: Nightly CI (Release branch) - -# workflow can be scheduled ONLY from DEFAULT branch -# > This event will only trigger a workflow run if the workflow file is on the default branch. -# See: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule -on: - schedule: - - cron: '0 23 * * *' # run at 11 PM UTC - -jobs: - builds: - uses: ./.github/workflows/shared_workflow.yml - secrets: inherit - with: - branch: release/2.11 - nextcloud_versions: "31 32" diff --git a/.github/workflows/nighty-ci-release-3-branch.yml b/.github/workflows/nighty-ci-release-3-branch.yml new file mode 100644 index 000000000..e5599d55f --- /dev/null +++ b/.github/workflows/nighty-ci-release-3-branch.yml @@ -0,0 +1,42 @@ +# SPDX-FileCopyrightText: 2023-2025 Jankari Tech Pvt. Ltd. +# SPDX-License-Identifier: AGPL-3.0-or-later +name: Nightly CI (Release 3.1 branch) + +# workflow can be scheduled ONLY from DEFAULT branch +# > This event will only trigger a workflow run if the workflow file is on the default branch. +# See: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule +on: + schedule: + - cron: '0 23 * * *' # run at 11 PM UTC + +jobs: + builds: + uses: ./.github/workflows/shared_workflow.yml + secrets: inherit + with: + branch: release/3.1 + nextcloud_versions: "33 34" + + app-upgrade-test: + uses: ./.github/workflows/app-upgrade.yml + with: + branch: release/3.1 + nextcloud_versions: "34" + + notify-nightly-report: + needs: [builds, app-upgrade-test] + if: ${{ always() }} + runs-on: ubuntu-22.04 + steps: + - name: checkout + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 + + - name: Notify Element (nightly builds) + env: + ELEMENT_CHAT_URL: ${{ secrets.ELEMENT_CHAT_URL }} + ELEMENT_ROOM_ID: ${{ secrets.ELEMENT_ROOM_ID }} + NIGHTLY_CI_USER_TOKEN: ${{ secrets.NIGHTLY_CI_USER_TOKEN }} + BRANCH_NAME: release/3.1 + NEEDS_JSON: ${{ toJson(needs) }} + run: | + ./.github/scripts/notify-to-element.sh diff --git a/.github/workflows/notify-app-release.yml b/.github/workflows/notify-app-release.yml index 5399f88e8..99bfbe30c 100644 --- a/.github/workflows/notify-app-release.yml +++ b/.github/workflows/notify-app-release.yml @@ -22,5 +22,5 @@ jobs: ELEMENT_ROOM_ID: ${{ secrets.ELEMENT_ROOM_ID }} NIGHTLY_CI_USER_TOKEN: ${{ secrets.NIGHTLY_CI_USER_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO_NAMES: "server groupfolders oidc user_oidc terms_of_service" + REPO_NAMES: 'server groupfolders oidc user_oidc terms_of_service' run: ./.github/scripts/notify-nc-and-apps-releases.sh diff --git a/.github/workflows/shared_workflow.yml b/.github/workflows/shared_workflow.yml index 9397a8f48..570d268f7 100644 --- a/.github/workflows/shared_workflow.yml +++ b/.github/workflows/shared_workflow.yml @@ -99,8 +99,10 @@ jobs: run: | MATRIX=$(./.github/scripts/generate-matrix.sh) echo "matrix={\"include\": [$MATRIX]}" >> $GITHUB_OUTPUT + echo "default_php_version=${DEFAULT_PHP_VERSION}" >> $GITHUB_OUTPUT outputs: matrix: ${{ steps.create-matrix.outputs.matrix }} + default_php_version: ${{ steps.create-matrix.outputs.default_php_version }} api-phpunit-tests: name: PHP Unit & API tests @@ -129,14 +131,14 @@ jobs: - ${{ github.workspace }}:/var/www/html/apps-shared database-pgsql: - image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest + image: ghcr.io/nextcloud/continuous-integration-postgres-18:latest env: POSTGRES_PASSWORD: postgres POSTGRES_USER: postgres POSTGRES_DB: nextcloud database-mysql: - image: ghcr.io/nextcloud/continuous-integration-mariadb-10.5:latest + image: ghcr.io/nextcloud/continuous-integration-mariadb-11.8:latest env: MYSQL_ROOT_PASSWORD: 'nextcloud' MYSQL_PASSWORD: 'nextcloud' @@ -217,7 +219,12 @@ jobs: key: ${{ runner.os }}-composer-${{ hashFiles('./composer.lock') }} restore-keys: ${{ runner.os }}-composer- - - name: Install PHP dependencies + - name: Composer update + if: ${{ matrix.phpVersion == '8.5' }} + run: composer update + + - name: Composer install + if: ${{ matrix.phpVersion != '8.5' }} run: composer install --no-progress --prefer-dist --optimize-autoloader - name: Prepare Nextcloud server (for phpunit and psalm) @@ -258,14 +265,14 @@ jobs: 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 == 'stable32' && matrix.phpVersion == '8.2' }} + if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable32' && matrix.phpVersion == needs.create-matrix.outputs.default_php_version && matrix.database == 'mysql' }} uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 with: dotnet-version: 6.0.101 dotnet-quality: 'ga' - name: Convert PHP cobertura coverage to lcov - if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable32' && matrix.phpVersion == '8.2' }} + if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable32' && matrix.phpVersion == needs.create-matrix.outputs.default_php_version && matrix.database == 'mysql' }} uses: danielpalme/ReportGenerator-GitHub-Action@abaac9fef72e4116bfc69905d51062790bda0335 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. @@ -284,7 +291,7 @@ jobs: toolpath: 'reportgeneratortool' # Default directory for installing the dotnet tool. - name: PHP Code Coverage Summary Report - if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable32' && matrix.phpVersion == '8.2' }} + if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable32' && matrix.phpVersion == needs.create-matrix.outputs.default_php_version && matrix.database == 'mysql' }} uses: romeovs/lcov-reporter-action@dda1c9b1fa1622b225e9acd87a248751dbcc6ada with: github-token: ${{ secrets.GITHUB_TOKEN }} @@ -293,7 +300,7 @@ jobs: title: 'PHP Code Coverage' - name: PHP coverage check - if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable32' && matrix.phpVersion == '8.2' }} + if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable32' && matrix.phpVersion == needs.create-matrix.outputs.default_php_version && matrix.database == 'mysql' }} uses: VeryGoodOpenSource/very_good_coverage@3b475421464c564c0714d92ce02742bd81fa9eda with: min_coverage: '56' @@ -329,25 +336,3 @@ jobs: NEXTCLOUD_VERSION: ${{ matrix.nextcloudVersion }} BEHAT_FILTER_TAGS: '~@skip' run: 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 - - - 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 diff --git a/tests/acceptance/features/api/directUpload.feature b/tests/acceptance/features/api/directUpload.feature index 4dd82a0aa..0b2cda1f3 100644 --- a/tests/acceptance/features/api/directUpload.feature +++ b/tests/acceptance/features/api/directUpload.feature @@ -892,7 +892,7 @@ Feature: API endpoint for direct upload """ And the content of file at "/.hidden" for user "Carol" should be "hidden file" - @skipOnStable25 + Scenario: check version of uploaded file inside a normal folder Given user "Carol" has created folder "/forOP" And user "Carol" got a direct-upload token for "/forOP" @@ -902,7 +902,7 @@ Feature: API endpoint for direct upload Then the HTTP status code should be "201" And the version folder of file "/forOP/file.txt" for user "Carol" should contain "1" element - @skipOnStable25 + Scenario: check version of uploaded file after an update inside a normal folder Given user "Carol" has created folder "/forOP" And user "Carol" has uploaded file with content "1234567890" to "/forOP/file.txt" diff --git a/tests/acceptance/features/bootstrap/FeatureContext.php b/tests/acceptance/features/bootstrap/FeatureContext.php index 79e221692..7e33ff384 100644 --- a/tests/acceptance/features/bootstrap/FeatureContext.php +++ b/tests/acceptance/features/bootstrap/FeatureContext.php @@ -351,6 +351,11 @@ private function deleteUserDataFromDocker(string $user): void { echo "Docker container 'nextcloud' not found. Skipping user data deletion.\n"; return; } + // Skip if Nextcloud Docker container does not exist + exec("docker ps --format \"{{.Names}}\"", $containers); + if (!in_array('nextcloud', $containers)) { + return; + } $firstChar = substr($user, 0, 1); $restChars = substr($user, 1);