forked from julien-nc/cospend-nc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
133 lines (125 loc) · 5.61 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
image: ubuntu:20.04
stages:
- test
- deploy
- build
before_script:
- bash ci/docker_install.sh
test_nc_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/cospend
- mkdir -p /var/www/html ; pushd /var/www/html
#- wget -q https://download.nextcloud.com/server/releases/nextcloud-16.0.1.zip ; unzip -q nextcloud-16.0.1.zip ; rm nextcloud-16.0.1.zip
- 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
- chown -R www-data:www-data nextcloud && pushd nextcloud/apps && mv /tmp/cospend ./
- sudo -u www-data php /var/www/html/nextcloud/occ maintenance:install --database "sqlite" --admin-user "admin" --admin-pass "password"
- sudo -u www-data php /var/www/html/nextcloud/occ app:enable cospend
- 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 cospend
# check JS code
- jshint --verbose cospend/src/cospend.js && echo "jshint OK" || echo "jshint has complaints"
- popd ; popd ; mkdir coverage
- phpunit --configuration /var/www/html/nextcloud/apps/cospend/phpunit.xml --coverage-text --color=never --coverage-html coverage
test_nc_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.4-pgsql postgresql-client -yqq > /dev/null 2>&1
# copy local copy that has been cloned already
- cp -r . /tmp/cospend
- mkdir -p /var/www/html ; pushd /var/www/html
#- wget -q https://download.nextcloud.com/server/releases/nextcloud-16.0.1.zip ; unzip -q nextcloud-16.0.1.zip ; rm nextcloud-16.0.1.zip
- 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
- chown -R www-data:www-data nextcloud && pushd nextcloud/apps && mv /tmp/cospend ./
- 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"
- sudo -u www-data php /var/www/html/nextcloud/occ app:enable cospend
- 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 cospend
# check JS code
- jshint --verbose cospend/src/cospend.js && echo "jshint OK" || echo "jshint has complaints"
- popd ; popd ; mkdir coverage
- phpunit --configuration /var/www/html/nextcloud/apps/cospend/phpunit.xml
test_nc_mysql:
stage: test
only:
refs:
- master
- test
script:
# DB
- DEBIAN_FRONTEND=noninteractive apt-get install mariadb-server php7.4-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/cospend
- mkdir -p /var/www/html ; pushd /var/www/html
#- wget -q https://download.nextcloud.com/server/releases/nextcloud-16.0.1.zip ; unzip -q nextcloud-16.0.1.zip ; rm nextcloud-16.0.1.zip
- 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
- chown -R www-data:www-data nextcloud && pushd nextcloud/apps && mv /tmp/cospend ./
- 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"
- sudo -u www-data php /var/www/html/nextcloud/occ app:enable cospend
- 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 cospend
# check JS code
- jshint --verbose cospend/src/cospend.js && echo "jshint OK" || echo "jshint has complaints"
- popd ; popd ; mkdir coverage
- phpunit --configuration /var/www/html/nextcloud/apps/cospend/phpunit.xml
pages:
stage: deploy
dependencies:
- test_nc_sqlite
before_script:
- echo 'nothing to install for pages jobs'
only:
refs:
- master
artifacts:
paths:
- public
script:
- sleep 5
- mkdir public
- mv coverage public/
build_nightly:
stage: build
only:
refs:
- build
artifacts:
paths:
- cospend-nightly.tar.gz
script:
- npm install -g npm
- make
- version=nightly make appstore
- mv /tmp/build/cospend-nightly.tar.gz ./