-
Notifications
You must be signed in to change notification settings - Fork 19
/
.gitlab-ci.yml
67 lines (59 loc) · 2.08 KB
/
.gitlab-ci.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
image: docker
.before_script: &before_script
- apk add jq
- cd tests
- echo "$ENV" > .env
- echo "$CYPRESS_ENV_JSON" > cypress.env.json
before_script:
- *before_script
services:
- docker:dind
stages:
- test
.app_tests:
except:
- merge_requests
script:
# Start containers
- docker-compose up -d
# Fix permissions of custom apps folder
- docker exec $(docker ps -qf "name=app") sh -c 'chown www-data:root custom_apps'
# Disable first run wizard app when nextcloud is up
- sleep 30
- docker exec -u www-data $(docker ps -qf "name=app") sh -c 'php -f ./occ app:disable firstrunwizard'
# Get the IP of the web container
- export SERVER_IP=$(docker container inspect -f '{{ .NetworkSettings.Networks.tests_default.IPAddress }}' $(docker ps -qf "name=web"))
# Run tests in cypress container
- docker run --network tests_default -v $CI_BUILDS_DIR/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:$CI_BUILDS_DIR/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME -w $CI_BUILDS_DIR/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME cypress/browsers:node18.12.0-chrome107 sh -c "cd tests && npm ci && export CYPRESS_NC_VERSION=$NC_VERSION && npm test -- --config baseUrl=http://$SERVER_IP"
# Echo log file for debug purposes
- docker exec $(docker ps -qf "name=app") sh -c 'cat data/nextcloud.log' > nextcloud.log
- cat nextcloud.log | jq .message
artifacts:
expire_in: 1 week
when: always
paths:
- tests/cypress/screenshots
- tests/nextcloud.log
reports:
junit:
- tests/results/TEST-*.xml
after_script:
- cd tests
- docker-compose down -v
app_test_nc_26:
extends: .app_tests
before_script:
- export NC_VERSION=26
- *before_script
app_test_nc_27:
extends: .app_tests
before_script:
- sed -i "s#nextcloud:26-fpm-alpine#nextcloud:27-fpm-alpine#g" tests/docker-compose.yml
- export NC_VERSION=27
- *before_script
app_test_nc_28:
extends: .app_tests
before_script:
- sed -i "s#nextcloud:26-fpm-alpine#nextcloud:28-fpm-alpine#g" tests/docker-compose.yml
- export NC_VERSION=28
- *before_script