mirror of
https://github.com/nextcloud/richdocuments.git
synced 2025-12-18 05:20:43 +01:00
213 lines
7.7 KiB
YAML
213 lines
7.7 KiB
YAML
# 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-latest, self-hosted]
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
code-image: [ 'release' ]
|
|
node-version: [16.x]
|
|
containers: [1]
|
|
php-versions: [ '8.2' ]
|
|
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: Register main git reference
|
|
run: |
|
|
main_app_ref="$(if [ "${{ matrix.server-versions }}" = "master" ]; then echo -n "main"; else echo -n "${{ matrix.server-versions }}"; fi)"
|
|
echo "main_app_ref=$main_app_ref" >> $GITHUB_ENV
|
|
|
|
- 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: Install composer dependencies
|
|
working-directory: apps/richdocuments
|
|
run: |
|
|
composer install --no-dev
|
|
|
|
- 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
|
|
|
|
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:enable --force spreed
|
|
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
|
|
|
|
|
|
- name: Cache node modules
|
|
uses: actions/cache@v4
|
|
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: 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: false
|
|
parallel: false
|
|
wait-on: '${{ env.CYPRESS_baseUrl }}'
|
|
working-directory: 'apps/${{ env.APP_NAME }}'
|
|
config: defaultCommandTimeout=10000,video=false,requestTimeout=15000
|
|
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: Debug
|
|
if: always()
|
|
run: sleep 9000
|
|
|
|
- name: Upload test failure screenshots
|
|
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
|
|
if: failure()
|
|
with:
|
|
name: screenshots-${{ matrix.code-image }}-${{ matrix.containers }}
|
|
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: nextcloud-log-${{ matrix.code-image }}-${{ matrix.containers }}
|
|
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
|