Skip to content
Draft
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
63 changes: 63 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,69 @@ jobs:
working-directory: apps/${{ env.APP_NAME }}
run: cd tests && bash run-integration.sh features/${{ matrix.scenarios }}.feature

richdocumentscode:
runs-on: ubuntu-latest

needs: changes
if: needs.changes.outputs.src != 'false'

strategy:
fail-fast: false
matrix:
php-versions: ['8.2']
databases: ['sqlite']
server-versions: ['master']
scenarios: ['wopi', 'direct', 'federation', 'api', 'secure-view', 'admin-settings']

name: integration-${{ matrix.scenarios }}-${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}

steps:
- name: Checkout server
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
submodules: true

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

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit:8.5.14
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, gd, zip, apcu
ini-values:
apc.enable_cli=on
coverage: none

- name: Set up PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: composer install --no-dev

- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
echo '<?php $CONFIG=["memcache.local"=>"\OC\Memcache\APCu","hashing_default_password"=>true];' > config/config.php
./occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
./occ app:enable --force --force ${{ env.APP_NAME }}
./occ app:enable --force richdocumentscode
sleep 10

- name: Run ${{ matrix.scenarios }} integration tests
working-directory: apps/${{ env.APP_NAME }}
env:
CODE_PROVIDER: embedded
WOPI_URL: http://localhost/apps/richdocumentscode/proxy.php?req=
run: cd tests && bash run-integration.sh features/${{ matrix.scenarios }}.feature

summary:
permissions:
contents: none
Expand Down
39 changes: 25 additions & 14 deletions tests/run-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ PORT_SERVERA=8080
PORT_SERVERB=8081
PORT_COOL=9980

# Backend mode for the Collabora integration:
# - external: use a standalone CODE/Collabora container (default)
# - embedded: use richdocumentscode proxy.php flow
CODE_PROVIDER=${CODE_PROVIDER:-external}

# Default WOPI endpoint for the external Collabora container.
# For the embedded richdocumentscode path, the workflow should set:
# WOPI_URL=http://localhost/apps/richdocumentscode/proxy.php?req=
WOPI_URL=${WOPI_URL:-http://localhost:$PORT_COOL}

INSTALLED=$($OCC status | grep installed: | cut -d " " -f 5)

if [ "$INSTALLED" == "true" ]; then
Expand All @@ -28,29 +38,30 @@ fi
composer install
composer dump-autoload

if curl --fail http://localhost:$PORT_COOL/hosting/capabilities; then
echo "Collabora server already running at port $PORT_COOL"
if [ "$CODE_PROVIDER" = "embedded" ]; then
echo "Using embedded Collabora (richdocumentscode) via $WOPI_URL"
sleep 20
else
if ! docker info >/dev/null 2>&1; then
echo "Docker does not seem to be running, so start the docker daemon or run a collabora server manually"
exit 1
if curl --fail "$WOPI_URL/hosting/capabilities"; then
echo "Collabora server already running at port $PORT_COOL"
else
if ! docker info >/dev/null 2>&1; then
echo "Docker does not seem to be running, so start the docker daemon or run a collabora server manually"
exit 1
fi
COOL_CONTAINER=$(docker run -t -d -p 9980:9980 -e "domain=localhost" -e "extra_params=--o:ssl.enable=false" collabora/code)
fi
COOL_CONTAINER=$(docker run -t -d -p 9980:9980 -e "domain=localhost" -e "extra_params=--o:ssl.enable=false" collabora/code)
fi;

curl --fail http://localhost:$PORT_COOL/hosting/capabilities

fi

curl --fail "$WOPI_URL/hosting/capabilities"

PHP_CLI_SERVER_WORKERS=10 php -S localhost:$PORT_SERVERA -t $OC_PATH &
PHPPIDA=$!
PHP_CLI_SERVER_WORKERS=10 php -S localhost:$PORT_SERVERB -t $OC_PATH &
PHPPIDB=$!

$OCC richdocuments:setup --wopi-url="$WOPI_URL"

$OCC config:app:set richdocuments wopi_url --value="http://localhost:9980"
$OCC config:app:set richdocuments public_wopi_url --value="http://localhost:9980"
$OCC richdocuments:activate-config
$OCC config:system:set allow_local_remote_servers --value true --type bool
$OCC config:system:set gs.trustedHosts 0 --value="localhost:$PORT_SERVERA"
$OCC config:system:set gs.trustedHosts 1 --value="localhost:$PORT_SERVERB"
Expand All @@ -61,7 +72,7 @@ RESULT=$?
kill $PHPPIDA
kill $PHPPIDB

[[ -v COOL_CONTAINER ]] && docker stop $container_id
[[ -v COOL_CONTAINER ]] && docker stop "$COOL_CONTAINER"

echo "runsh: Exit code: $RESULT"
exit $RESULT
Loading