diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 0d8a7528dd..761acc944f 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -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 '"\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 diff --git a/tests/run-integration.sh b/tests/run-integration.sh index d04e46bc75..741af5ec68 100755 --- a/tests/run-integration.sh +++ b/tests/run-integration.sh @@ -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 @@ -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" @@ -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