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
179 changes: 179 additions & 0 deletions .github/workflows/tests-exapp-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: Tests - ExApp Integration

on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: tests-exapp-integration-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
NEXTCLOUD_URL: "http://127.0.0.1:8080"
NEXTCLOUD_USER: "admin"
NEXTCLOUD_PASS: "admin"
APP_ID: "test_appapi"
APP_VERSION: "1.0.0"
APP_PORT: 9009
APP_HOST: "127.0.0.1"
APP_SECRET: "tC6vkwPhcppjMykD1r0n9NlI95uJMBYjs5blpIcA1PAdoPDmc5qoAjaBAkyocZ6E"

jobs:
exapp-integration:
runs-on: ubuntu-22.04
name: ExApp integration (Playwright)

services:
postgres:
image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest # zizmor: ignore[unpinned-images]
ports:
- 4444:5432/tcp
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: rootpassword
POSTGRES_DB: nextcloud
options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5

steps:
- name: Set app env
run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV

- name: Checkout server
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
submodules: true
repository: nextcloud/server
ref: master

- name: Checkout AppAPI
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
path: apps/${{ env.APP_NAME }}

- name: Set up php
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2
with:
php-version: '8.3'
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql
coverage: none
ini-file: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'

- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
id: versions
with:
path: apps/${{ env.APP_NAME }}
fallbackNode: '^24'
fallbackNpm: '^11.3'

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'

- name: Install AppAPI composer deps
working-directory: apps/${{ env.APP_NAME }}
run: composer i

- name: Build AppAPI frontend bundle
working-directory: apps/${{ env.APP_NAME }}
run: |
npm ci
npm run build

- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 \
--database-port=$DB_PORT --database-user=root --database-pass=rootpassword \
--admin-user "$NEXTCLOUD_USER" --admin-pass "$NEXTCLOUD_PASS"
./occ config:system:set ratelimit.protection.enabled --value=false --type=boolean
./occ app:enable --force ${{ env.APP_NAME }}

- name: Run Nextcloud
run: PHP_CLI_SERVER_WORKERS=4 php -S 127.0.0.1:8080 &

- name: Install integration test Python deps
run: python3 -m pip install -r apps/${{ env.APP_NAME }}/tests/exapp_integration/requirements.txt

- name: Install Playwright browser
run: python3 -m playwright install --with-deps chromium

- name: Register manual_daemon
run: php occ app_api:daemon:register manual_daemon "Manual Install" manual-install http "$APP_HOST" "$NEXTCLOUD_URL"

- name: Start test ExApp
run: |
cd apps/${{ env.APP_NAME }}/tests/exapp_integration
nohup python3 _test_app.py > /tmp/test_appapi.log 2>&1 &
echo $! > /tmp/test_appapi.pid
for _ in $(seq 1 30); do
curl -fs "http://$APP_HOST:$APP_PORT/heartbeat" >/dev/null && break
sleep 1
done
curl -fs "http://$APP_HOST:$APP_PORT/heartbeat"

- name: Register test ExApp
run: |
php occ app_api:app:register "$APP_ID" manual_daemon --json-info \
"{\"id\":\"$APP_ID\",\"name\":\"AppAPI Integration Test ExApp\",\"version\":\"$APP_VERSION\",\"secret\":\"$APP_SECRET\",\"port\":$APP_PORT,\"host\":\"$APP_HOST\",\"protocol\":\"http\",\"system_app\":0}" \
Comment thread
oleksandr-nc marked this conversation as resolved.
--wait-finish
php occ app_api:app:list | grep -q "^$APP_ID .* \[enabled\]$"

- name: Run pytest
working-directory: apps/${{ env.APP_NAME }}/tests/exapp_integration
env:
OCC_CMD: "php ${{ github.workspace }}/occ"
run: python3 -m pytest -v

- name: Stop test ExApp
if: always()
run: |
[ -f /tmp/test_appapi.pid ] && kill -15 "$(cat /tmp/test_appapi.pid)" || true

- name: Upload NC logs
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: exapp-integration-nextcloud.log
path: data/nextcloud.log
if-no-files-found: warn

- name: Upload test ExApp log
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: exapp-integration-test_appapi.log
path: /tmp/test_appapi.log
if-no-files-found: warn

tests-exapp-integration-success:
permissions:
contents: none
runs-on: ubuntu-22.04
needs: [exapp-integration]
name: TestsExAppIntegration-OK
steps:
- run: echo "ExApp integration tests passed"
2 changes: 1 addition & 1 deletion js/app_api-adminSettings.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/app_api-adminSettings.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/app_api-filesplugin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/app_api-filesplugin.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

110 changes: 95 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@nextcloud/axios": "^2.5.0",
"@nextcloud/dialogs": "^7.1.0",
"@nextcloud/event-bus": "^3.3.1",
"@nextcloud/files": "^4.0.0-beta.7",
"@nextcloud/files": "^4.0.0",
"@nextcloud/initial-state": "^3.0.0",
"@nextcloud/l10n": "^3.1.0",
"@nextcloud/moment": "^1.3.1",
Expand Down
Loading
Loading