Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 51 additions & 26 deletions .github/scripts/notify-to-element.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 <<EOF
{
"msgtype": "m.text",
"body": "",
"format": "org.matrix.custom.html",
"formatted_body": "<a href=\"https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}\">NC-Nightly-${BRANCH_NAME}</a><br></br><b>Status: ${workflow_status}</b>"
}
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": "<a href=\"https://github.com/'$REPO_OWNER'/'$REPO_NAME'/actions/runs/'$RUN_ID'\">NC-Nightly-'$BRANCH_NAME'</a><br></br><b><i>Status: '$workflow_status'</i></b>"
}
'
-d "$payload"
)

if [[ "$send_message_to_room_response" != *"event_id"* ]]; then
Expand All @@ -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)"
15 changes: 10 additions & 5 deletions .github/workflows/app-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,28 @@ 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:
runs-on: ubuntu-latest
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
Expand Down Expand Up @@ -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'
Expand All @@ -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
Expand Down Expand Up @@ -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
24 changes: 24 additions & 0 deletions .github/workflows/nighlty-ci-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
43 changes: 43 additions & 0 deletions .github/workflows/nighlty-ci-release-2-branch.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 0 additions & 18 deletions .github/workflows/nighlty-ci-release-branch.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/nighty-ci-release-3-branch.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .github/workflows/notify-app-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading
Loading