-
-
Notifications
You must be signed in to change notification settings - Fork 89
/
.gitlab-ci.yml
142 lines (135 loc) Β· 8.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
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
image: ubuntu:19.10
stages:
- test
- deploy
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt-get update -yqq
- apt-get install git sudo make php-xdebug php7.3-sqlite3 php7.3-curl php7.3-xml php7.3-mbstring php7.3-json php7.3-zip php7.3-gd php7.3-intl unzip curl wget nodejs npm sed -yqq > /dev/null 2>&1
- npm install -g npm
- npm install -g jshint > /dev/null 2>&1
- curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar
- chmod +x /usr/local/bin/phpunit
test_nc17_sqlite:
stage: test
only:
refs:
- master
- test
artifacts:
paths:
- coverage
coverage: '/^\s*Lines:\s*(\d+.\d+)\%/'
script:
# copy local copy that has been cloned already
- cp -r . /tmp/maps
- mkdir -p /var/www/html ; pushd /var/www/html
- git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b master nextcloud
# temporary fix of autoloader.php
- sed -i $'s|if (substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|if (is_string($root) and substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|g' nextcloud/lib/autoloader.php
- pushd nextcloud/apps && mv /tmp/maps ./
- cd maps ; make ; cd .. && chown -R www-data:www-data /var/www/html/nextcloud
- sudo -u www-data php /var/www/html/nextcloud/occ maintenance:install --database "sqlite" --admin-user "admin" --admin-pass "password" --data-dir /var/www/html/nextcloud/data
- sudo -u www-data OC_PASS=newpassword php /var/www/html/nextcloud/occ user:add --password-from-env --display-name="Test 1" --group="users" test
- sudo -u www-data OC_PASS=newpassword php /var/www/html/nextcloud/occ user:add --password-from-env --display-name="Test 2" --group="users" test2
- sudo -u www-data OC_PASS=newpassword php /var/www/html/nextcloud/occ user:add --password-from-env --display-name="Test 3" --group="users" test3
#- sudo -u www-data mkdir -p /var/www/html/nextcloud/data/test/files
#- sudo -u www-data mkdir -p /var/www/html/nextcloud/data/test2/files
#- sudo -u www-data mkdir -p /var/www/html/nextcloud/data/test3/files
#- sudo -u www-data cp /var/www/html/nextcloud/apps/maps/tests/test_files/* /var/www/html/nextcloud/data/test/files/
#- sudo -u www-data mkdir -p /var/www/html/nextcloud/data/test/files/Maps
- sudo -u www-data php /var/www/html/nextcloud/occ app:enable maps
- sudo -u www-data php /var/www/html/nextcloud/occ maintenance:mode --off
# check code with occ
# disabled because it does not like type=>filesystem in info.xml
#- sudo -u www-data php /var/www/html/nextcloud/occ app:check-code maps
# check JS code
- jshint --verbose maps/js/script.js && echo "jshint OK" || echo "jshint has complaints"
- cd /var/www/html/nextcloud/apps/maps
- sudo -u www-data php7.3 /usr/local/bin/phpunit --configuration /var/www/html/nextcloud/apps/maps/phpunit.xml > /dev/null 2>&1 || echo "FIRST TEST FAILED as expected..."
- sudo -u www-data php7.3 /usr/local/bin/phpunit --configuration /var/www/html/nextcloud/apps/maps/phpunit.xml --coverage-text --color=never --coverage-html /builds/eneiluj/maps/coverage
test_nc17_pgsql:
stage: test
only:
refs:
- master
- test
services:
- postgres:latest
variables:
POSTGRES_DB: plop
POSTGRES_USER: postgres
POSTGRES_PASSWORD: "toto"
script:
- DEBIAN_FRONTEND=noninteractive apt-get install php7.3-pgsql postgresql-client -yqq > /dev/null 2>&1
# copy local copy that has been cloned already
- cp -r . /tmp/maps
- mkdir -p /var/www/html ; pushd /var/www/html
- git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b master nextcloud
# temporary fix of autoloader.php
- sed -i $'s|if (substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|if (is_string($root) and substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|g' nextcloud/lib/autoloader.php
- pushd nextcloud/apps && mv /tmp/maps ./
- cd maps ; make ; cd .. && chown -R www-data:www-data /var/www/html/nextcloud
- sudo -u www-data php /var/www/html/nextcloud/occ maintenance:install --database "pgsql" --database-host "postgres:5432" --database-name oc_autotest --database-user postgres --database-pass="toto" --admin-user "admin" --admin-pass "password" --data-dir /var/www/html/nextcloud/data
- sudo -u www-data OC_PASS=newpassword php /var/www/html/nextcloud/occ user:add --password-from-env --display-name="Test 1" --group="users" test
- sudo -u www-data OC_PASS=newpassword php /var/www/html/nextcloud/occ user:add --password-from-env --display-name="Test 2" --group="users" test2
- sudo -u www-data OC_PASS=newpassword php /var/www/html/nextcloud/occ user:add --password-from-env --display-name="Test 3" --group="users" test3
- sudo -u www-data php /var/www/html/nextcloud/occ app:enable maps
- sudo -u www-data php /var/www/html/nextcloud/occ maintenance:mode --off
# check code with occ
#- sudo -u www-data php /var/www/html/nextcloud/occ app:check-code maps
# check JS code
- jshint --verbose maps/js/script.js && echo "jshint OK" || echo "jshint has complaints"
- cd /var/www/html/nextcloud/apps/maps
- sudo -u www-data php7.3 /usr/local/bin/phpunit --configuration /var/www/html/nextcloud/apps/maps/phpunit.xml > /dev/null 2>&1 || echo "FIRST TEST FAILED as expected..."
- sudo -u www-data php7.3 /usr/local/bin/phpunit --configuration /var/www/html/nextcloud/apps/maps/phpunit.xml --coverage-text --color=never
test_nc17_mysql:
stage: test
only:
refs:
- master
- test
script:
# DB
- DEBIAN_FRONTEND=noninteractive apt-get install mariadb-server php7.3-mysql -yqq > /dev/null 2>&1
- service mysql start
- mysql -u root -e 'create database oc_autotest;'
- mysql -u root -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY '';"
- mysql -u root -e "grant all on oc_autotest.* to 'oc_autotest'@'localhost';"
# copy local copy that has been cloned already
- cp -r . /tmp/maps
- mkdir -p /var/www/html ; pushd /var/www/html
- git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b master nextcloud
# temporary fix of autoloader.php
- sed -i $'s|if (substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|if (is_string($root) and substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|g' nextcloud/lib/autoloader.php
- pushd nextcloud/apps && mv /tmp/maps ./
- cd maps ; make ; cd .. && chown -R www-data:www-data /var/www/html/nextcloud
- sudo -u www-data php /var/www/html/nextcloud/occ maintenance:install --database "mysql" --database-name oc_autotest --database-user oc_autotest --database-pass="" --admin-user "admin" --admin-pass "password" --data-dir /var/www/html/nextcloud/data
- sudo -u www-data OC_PASS=newpassword php /var/www/html/nextcloud/occ user:add --password-from-env --display-name="Test 1" --group="users" test
- sudo -u www-data OC_PASS=newpassword php /var/www/html/nextcloud/occ user:add --password-from-env --display-name="Test 2" --group="users" test2
- sudo -u www-data OC_PASS=newpassword php /var/www/html/nextcloud/occ user:add --password-from-env --display-name="Test 3" --group="users" test3
- sudo -u www-data php /var/www/html/nextcloud/occ app:enable maps
- sudo -u www-data php /var/www/html/nextcloud/occ maintenance:mode --off
# check code with occ
#- sudo -u www-data php /var/www/html/nextcloud/occ app:check-code maps
# check JS code
- jshint --verbose maps/js/script.js && echo "jshint OK" || echo "jshint has complaints"
- cd /var/www/html/nextcloud/apps/maps
- sudo -u www-data php7.3 /usr/local/bin/phpunit --configuration /var/www/html/nextcloud/apps/maps/phpunit.xml > /dev/null 2>&1 || echo "FIRST TEST FAILED as expected..."
- sudo -u www-data php7.3 /usr/local/bin/phpunit --configuration /var/www/html/nextcloud/apps/maps/phpunit.xml --coverage-text --color=never
pages:
stage: deploy
dependencies:
- test_nc17_sqlite
before_script:
- echo 'nothing to install for pages jobs'
only:
refs:
- master
artifacts:
paths:
- public
script:
- sleep 5
- mkdir public
- mv coverage public/