Skip to content

fix: use file picker component directly #584

fix: use file picker component directly

fix: use file picker component directly #584

Workflow file for this run

# SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: Cypress
on:
pull_request:
push:
branches:
- main
- stable*
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
env:
APP_NAME: richdocuments
CYPRESS_baseUrl: http://172.17.0.1:8081/index.php
CYPRESS_collaboraUrl: http://172.17.0.1:9980
jobs:
cypress:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
code-image: [ 'release', 'nightly' ]
node-version: [16.x]
containers: [1, 2, 3]
php-versions: [ '8.1' ]
databases: [ 'sqlite' ]
server-versions: [ 'master' ]
name: runner ${{ matrix.code-image}}-${{ matrix.containers }}
services:
collabora:
image: ${{ matrix.code-image == 'release' && 'collabora/code:latest' || 'juliushaertl/nc-code-nightly:latest' }}
env:
extra_params: '--o:ssl.enable=false --o:home_mode.enable=true'
aliasgroup1: 'http://172.17.0.1'
ports:
- "9980:9980"
steps:
- name: Checkout server
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Checkout viewer
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: nextcloud/viewer
ref: ${{ matrix.server-versions }}
path: apps/viewer
- name: Checkout files_pdfviewer
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: nextcloud/files_pdfviewer
ref: ${{ matrix.server-versions }}
path: apps/files_pdfviewer
- name: Checkout ${{ env.APP_NAME }}
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: apps/${{ env.APP_NAME }}
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
id: versions
with:
fallbackNode: "^20"
fallbackNpm: "^10"
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
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: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, zip, gd, apcu
ini-values:
apc.enable_cli=on
coverage: none
- name: Set up Nextcloud
env:
DB_PORT: 4444
PHP_CLI_SERVER_WORKERS: 10
run: |
mkdir data
echo '<?php $CONFIG=["memcache.local"=>"\OC\Memcache\APCu","hashing_default_password"=>true];' > config/config.php
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
php occ config:system:set memcache.local --value="\\OC\\Memcache\\APCu"
php -f index.php
PHP_CLI_SERVER_WORKERS=20 php -S 0.0.0.0:8081 &
export OC_PASS=1234561
php occ user:add --password-from-env user1
php occ user:add --password-from-env user2
php occ config:system:set force_language --value en
php occ app:enable --force testing
php occ app:enable --force viewer
php occ app:enable --force files_pdfviewer
php occ app:enable --force richdocuments
php occ app:list
php occ config:system:set trusted_domains 1 --value="172.17.0.1"
php occ config:app:set richdocuments wopi_url --value="http://localhost:9980"
php occ config:app:set richdocuments public_wopi_url --value="http://localhost:9980"
php occ config:system:set allow_local_remote_servers --value true --type bool
php occ richdocuments:activate-config
curl http://admin:admin@localhost:8081/ocs/v1.php/cloud/capabilities\?format\=json -H 'OCS-APIRequest: true'
curl -v http://localhost:9980/ --output -
curl -v http://localhost:9980/hosting/discovery --output -
curl -v http://localhost:9980/hosting/capabilities --output -
cat data/nextcloud.log
- name: Cache node modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: npm install, build richdocuments in testing mode
working-directory: apps/richdocuments
run: |
npm ci
npm run dev
- name: Register index for cypress-split
env:
container: "${{ matrix.containers }}"
run: |
echo "container_index: $(($container - 1))"
echo "container_index=$(($container - 1))" >> $GITHUB_ENV
- name: Cypress run
uses: cypress-io/github-action@496e7dc0edc421a9de8a36a31c793340e00c61bf # v6.7.5
with:
record: true
parallel: false
wait-on: '${{ env.CYPRESS_baseUrl }}'
working-directory: 'apps/${{ env.APP_NAME }}'
config: defaultCommandTimeout=10000,video=false
tag: ${{ false && github.event_name }}
env:
# https://github.com/cypress-io/github-action/issues/524
npm_package_name: ${{ env.APP_NAME }}
# https://github.com/cypress-io/github-action/issues/124
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
SPLIT: 3
SPLIT_INDEX: ${{ env.container_index }}
CODE_RELEASE: ${{ matrix.code-image }}
- name: Upload test failure screenshots
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: failure()
with:
name: Upload screenshots
path: apps/${{ env.APP_NAME }}/cypress/screenshots/
retention-days: 5
- name: Upload nextcloud logs
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: failure()
with:
name: Upload nextcloud log
path: data/nextcloud.log
retention-days: 5
summary:
runs-on: ubuntu-latest
needs: [ cypress ]
if: always()
name: cypress-summary
steps:
- name: Summary status
run: if ${{ ( needs.cypress.result != 'success' && needs.cypress.result != 'skipped' ) }}; then exit 1; fi