-
Notifications
You must be signed in to change notification settings - Fork 199
/
.travis.yml
122 lines (104 loc) · 5.79 KB
/
.travis.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
language: php
sudo: false
services:
- mysql
- postgresql
php:
- 7.2
env:
global:
- OC_PASS=ampache
matrix:
include:
# ownCloud versions
- env: DB=mysql CLOUD=owncloud CORE_VER=10.0.10
- env: DB=mysql CLOUD=owncloud CORE_VER=10.1.1
- env: DB=mysql CLOUD=owncloud CORE_VER=10.2.1
- env: DB=mysql CLOUD=owncloud CORE_VER=10.3.2
- env: DB=mysql CLOUD=owncloud CORE_VER=10.4.1
- env: DB=mysql CLOUD=owncloud CORE_VER=complete-20200731 # 10.5
- env: DB=mysql CLOUD=owncloud CORE_VER=complete-20201216 # 10.6
# Nextcloud versions
- env: DB=mysql CLOUD=nextcloud CORE_VER=stable13
- env: DB=mysql CLOUD=nextcloud CORE_VER=stable14
- env: DB=mysql CLOUD=nextcloud CORE_VER=stable15
- env: DB=mysql CLOUD=nextcloud CORE_VER=stable16
- env: DB=mysql CLOUD=nextcloud CORE_VER=stable17
- env: DB=mysql CLOUD=nextcloud CORE_VER=stable18
- env: DB=mysql CLOUD=nextcloud CORE_VER=stable19
- env: DB=mysql CLOUD=nextcloud CORE_VER=stable20
- php: 7.3
env: DB=mysql CLOUD=nextcloud CORE_VER=stable21
- php: 7.3
env: DB=mysql CLOUD=nextcloud CORE_VER=master
# PostgreSQL
- env: DB=pgsql CLOUD=nextcloud CORE_VER=stable15
# PHP versions
- php: 7.1
env: DB=mysql CLOUD=nextcloud CORE_VER=stable15
- php: 7.3
env: DB=mysql CLOUD=nextcloud CORE_VER=stable15
- php: 7.4
env: DB=mysql CLOUD=nextcloud CORE_VER=stable18
- php: 8.0
env: DB=mysql CLOUD=nextcloud CORE_VER=stable21
fast_finish: true
branches:
only:
- master
- travis
cache:
directories:
- "/tmp/downloadedData"
before_install:
- php --info
# Set up DB
- if [[ "$DB" == 'pgsql' ]]; then createuser -U travis -s oc_autotest; fi
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e 'CREATE DATABASE oc_autotest;'; fi
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY '';"; fi
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e "GRANT ALL ON oc_autotest.* TO 'oc_autotest'@'localhost';"; fi
# The behat version working on PHP 7.1 doesn't work on PHP 8.0 and vice versa. Substitute the locked dependencies with newer when using PHP 8.0.
- sh -c "if [ '${TRAVIS_PHP_VERSION:0:3}' = '8.0' ]; then rm composer.lock; cp composer.php8.json composer.json; fi;"
- composer self-update
- composer install
# The Nextcloud version in the master branch is almost always one which is not yet officially supported by the Music app. To enable testing, hack the supported NC version to a high value.
- sh -c "if [ '$CLOUD' = 'nextcloud' ] && [ $CORE_VER = 'master' ]; then sed -i -r 's/(<nextcloud min-version=\"..\" max-version=\")../\1255/g' appinfo/info.xml; fi;"
# Nextcloud has deprecated the use of database.xml to specify the database schema a long time ago, and NC22 removes the support entirely.
# Meanwhile, the replacement "Migrations" system does not work with ownCloud which still happily uses database.xml. To overcome this, our source
# repository contains both mechanisms. The database.xml is deleted when deploying for NC, and the migrations script is disregarded by oC by default.
- if [[ "$CLOUD" == 'nextcloud' ]]; then rm appinfo/database.xml; fi
- cd ..
- sh -c "if [ '$CLOUD' = 'nextcloud' ]; then git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b $CORE_VER core; fi;"
- sh -c "if [ '$CLOUD' = 'owncloud' ]; then wget https://download.owncloud.org/community/owncloud-${CORE_VER}.zip; unzip owncloud-${CORE_VER}.zip; mv owncloud core; fi;"
- cd core
- sh -c "if [ '$CLOUD' = 'nextcloud' ]; then git submodule update --init; fi;"
- mkdir data
- cd ..
- mv music core/apps/
before_script:
# setup ownCloud
- cd core
- ./occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database $DB --database-pass=''
- ./occ app:enable music
- ./occ user:add ampache --password-from-env
# download test data (only if not cached already)
- apps/music/tests/downloadTestData.sh ${TRAVIS_BUILD_DIR}/../core/data/ampache
- ./occ files:scan ampache
- ./occ music:scan ampache
# add Ampache API key with ampache as password for user ampache
- bash -c "if [ '$DB' == 'sqlite' ]; then sqlite3 data/owncloud.db 'INSERT INTO oc_music_ampache_users (user_id, hash) VALUES (\"ampache\", \"3e60b24e84cfa047e41b6867efc3239149c54696844fd3a77731d6d8bb105f18\");'; fi"
- bash -c "if [ '$DB' == 'mysql' ]; then mysql -u oc_autotest oc_autotest -e 'INSERT INTO oc_music_ampache_users (user_id, hash) VALUES (\"ampache\", \"3e60b24e84cfa047e41b6867efc3239149c54696844fd3a77731d6d8bb105f18\");'; fi"
- bash -c "if [ '$DB' == 'pgsql' ]; then psql -U oc_autotest -d oc_autotest -w -c \"INSERT INTO oc_music_ampache_users (user_id, hash) VALUES ('ampache', '3e60b24e84cfa047e41b6867efc3239149c54696844fd3a77731d6d8bb105f18');\"; fi"
- php -S localhost:8888 -t . &
- cd apps/music
- cp tests/behat.yml.travis tests/behat.yml
script:
- vendor/bin/phpunit --coverage-clover clover-unit.xml --configuration tests/php/unit/phpunit.xml tests/php/unit
- vendor/bin/phpunit --coverage-clover clover-integration.xml --configuration tests/php/integration/phpunit.xml tests/php/integration
- cd tests && ../vendor/bin/behat
# Post coverage report from NC13 to Scrutinizer as this version is included only in a single configuration, and run early in the queue
- bash -c "if [ '$CORE_VER' == 'stable13' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi"
- bash -c "if [ '$CORE_VER' == 'stable13' ]; then php ocular.phar code-coverage:upload --format=php-clover ../clover-unit.xml; fi"
- bash -c "if [ '$CORE_VER' == 'stable13' ]; then php ocular.phar code-coverage:upload --format=php-clover ../clover-integration.xml; fi"
# debug section to check what went wrong
- cat ../../../data/$CLOUD.log