-
Notifications
You must be signed in to change notification settings - Fork 117
210 lines (178 loc) Β· 7.65 KB
/
cypress-e2e.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# 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: [ 'stable30' ]
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: false
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