Skip to content

Commit 032f182

Browse files
committed
Use nextcloudci/server
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
1 parent 2720c44 commit 032f182

4 files changed

Lines changed: 51 additions & 35 deletions

File tree

.github/workflows/cypress.yml

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ on:
99

1010
env:
1111
APP_NAME: viewer
12-
CYPRESS_baseUrl: http://127.0.0.1:8080/index.php
12+
BRANCH: ${{ github.base_ref }}
13+
CYPRESS_baseUrl: http://127.0.0.1:8081/index.php
1314

1415
jobs:
1516
cypress:
@@ -24,63 +25,52 @@ jobs:
2425
php-versions: ['7.4']
2526

2627
name: Runner ${{ matrix.containers }}
28+
2729
steps:
28-
- name: Checkout server
30+
- name: Checkout app
2931
uses: actions/checkout@v2
30-
with:
31-
repository: nextcloud/server
32-
ref: ${{ github.base_ref }}
3332

34-
- name: Checkout submodules
35-
shell: bash
33+
- name: Pulling server
3634
run: |
37-
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
38-
git submodule sync --recursive
39-
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
35+
cd cypress
36+
docker-compose pull
4037
41-
- name: Checkout app
42-
uses: actions/checkout@v2
43-
with:
44-
path: apps/${{ env.APP_NAME }}
38+
- name: Caching server
39+
uses: satackey/action-docker-layer-caching@v0.0.8
40+
# Ignore the failure of a step and avoid terminating the job.
41+
continue-on-error: true
42+
43+
- name: Setup server
44+
run: |
45+
cd cypress
46+
docker-compose up -d
4547
4648
- name: Set up node ${{ matrix.node-version }}
4749
uses: actions/setup-node@v1
4850
with:
4951
node-version: ${{ matrix.node-version }}
5052

5153
- name: Install dependencies & build app
52-
working-directory: apps/${{ env.APP_NAME }}
5354
run: |
5455
npm ci
5556
TESTING=true npm run build --if-present
5657
57-
- name: Set up php ${{ matrix.php-versions }}
58-
uses: shivammathur/setup-php@v1
59-
with:
60-
php-version: ${{ matrix.php-versions }}
61-
tools: phpunit
62-
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite
63-
coverage: none
64-
65-
- name: Set up Nextcloud
66-
run: |
67-
mkdir data
68-
./occ maintenance:install --verbose --database sqlite --admin-user admin --admin-pass admin
69-
./occ app:enable $APP_NAME
70-
php -S 0.0.0.0:8080 &
71-
7258
- name: Wait for server
7359
run: |
7460
npm install -g wait-on
7561
wait-on -i 500 -t 240000 $CYPRESS_baseUrl
62+
63+
- name: Enable app & configure server
64+
run: |
65+
cd cypress
66+
docker-compose exec -T nextcloud --env APP_NAME=${{ env.APP_NAME }} bash /initserver.sh
7667
7768
- name: Cypress run
7869
uses: cypress-io/github-action@v1
7970
with:
8071
record: true
8172
parallel: true
8273
# cypress env
83-
working-directory: apps/${{ env.APP_NAME }}
8474
ci-build-id: ${{ github.sha }}-${{ github.run_number }}
8575
tag: ${{ github.event_name }}
8676
env:

cypress/docker-compose.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: '3'
2+
3+
services:
4+
nextcloud:
5+
image: nextcloudci/server
6+
7+
ports:
8+
- 8081:80
9+
10+
environment:
11+
CYPRESS_baseUrl: "http://127.0.0.1:8081/index.php"
12+
BRANCH: master
13+
14+
volumes:
15+
- ../:/var/www/html/apps/viewer
16+
- ./initserver.sh:/initserver.sh

cypress/initserver.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
echo "APP_NAME: $APP_NAME"
4+
chown -R www-data:www-data /var/www/html/data
5+
6+
su www-data -c "
7+
php occ config:system:set force_language --value en
8+
php occ app:enable $APP_NAME
9+
php occ app:list
10+
"

cypress/support/commands.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ Cypress.Commands.add('nextcloudCreateUser', (user, password) => {
5656
form: true,
5757
body: {
5858
userid: user,
59-
password: password
59+
password,
6060
},
6161
auth: { user: 'admin', pass: 'admin' },
6262
headers: {
6363
'OCS-ApiRequest': 'true',
6464
'Content-Type': 'application/x-www-form-urlencoded',
65-
Authorization: 'Basic YWRtaW46YWRtaW4='
66-
}
65+
Authorization: `Basic ${btoa('admin:admin')}`,
66+
},
6767
}).then(response => {
6868
cy.log(`Created user ${user}`, response.status)
6969
})
@@ -80,7 +80,7 @@ Cypress.Commands.add('uploadFile', (fileName, mimeType, path = '') => {
8080
await axios.put(`${Cypress.env('baseUrl')}/remote.php/webdav${path}/${fileName}`, file, {
8181
headers: {
8282
requesttoken: window.OC.requestToken,
83-
'Content-Type': mimeType
83+
'Content-Type': mimeType,
8484
}
8585
}).then(response => {
8686
cy.log(`Uploaded ${fileName}`, response)

0 commit comments

Comments
 (0)