forked from pluginsGLPI/formcreator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
94 lines (83 loc) · 4.21 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
language: php
env:
global:
- GLPI_SOURCE="https://github.com/glpi-project/glpi"
- CS=7.2
- DBUSER=root
- DBNAME=glpitest
- OLDDBNAME=glpiupgradetest
- AFTER_SUCCESS_BRANCH=9.4/bugfixes
matrix:
- GLPI_BRANCH=9.3.0
- GLPI_BRANCH=9.3/bugfixes
- GLPI_BRANCH=9.4/bugfixes
# - GLPI_BRANCH=master
php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- nightly
matrix:
allow_failures:
- php: nightly
# - env: GLPI_BRANCH=master
before_script:
- |
if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then
mkdir ~/.composer -p
touch ~/.composer/composer.json
composer config -g github-oauth.github.com $GH_TOKEN
fi
- # setup GLPI and its plugins
- mysql -u root -e 'create database $DBNAME;'
- mysql -u root -e 'create database $OLDDBNAME;'
- git clone --depth=35 $GLPI_SOURCE -b $GLPI_BRANCH ../glpi && cd ../glpi
- composer install --no-dev --no-interaction
- mkdir -p tests/files/_cache
- IFS=/ read -a repo <<< $TRAVIS_REPO_SLUG
- mv ../${repo[1]} plugins/formcreator
- # prepare plugin to test
- cd plugins/formcreator
- composer install
script:
- # setup code coverage
- COVERAGE="-ncc"
- if [ "${TRAVIS_PHP_VERSION:0:3}" = "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then COVERAGE="--nccfc CommonTreeDropdown CommonDropdown CommonDBTM CommonGLPI CommonDBChild CommonDBConnexity CommonDBRelation"; fi
- # install GLPI with an old schema of the plugin and upgrade it
- export PASSWORDARG=""
- if [ "$DBPASSWD" != "" ]; then export PASSWORDARG="-p$DBPASSWD"; fi
- if [ -e ../../scripts/cliinstall.php ] && [ "$DBPASSWD" != "" ]; then DBPASSWDARG="--pass=$DBPASSWD"; fi
- if [ -e ../../bin/console ] && [ "$DBPASSWD" != "" ]; then DBPASSWDARG="--db-password=$DBPASSWD"; fi
- echo Installing GLPI on database $OLDDBNAME
- rm ../../tests/files/_cache/cache_db/* ../../tests/files/_cache_/cache_trans/* ../../tests/files/_cache/*.json || true
- rm ../../tests/config_db.php || true
- if [ -e ../../scripts/cliinstall.php ]; then php ../../scripts/cliinstall.php --db=$OLDDBNAME --user=$DBUSER $DBPASSWDARG --tests ; fi
- if [ -e ../../bin/console ]; then php ../../bin/console glpi:database:install --db-name=$OLDDBNAME --db-user=$DBUSER $DBPASSWDARG --config-dir=../../tests --no-interaction --no-plugins --force; fi
- mysql -u $DBUSER $PASSWORDARG $OLDDBNAME < tests/plugin_formcreator_empty_2.5.0.sql
- mysql -u $DBUSER $PASSWORDARG $OLDDBNAME < tests/plugin_formcreator_config_2.5.0.sql
- # upgrade test
- php scripts/cliinstall.php --tests
- # install GLPI with a fresh install of the plugin
- if [ -e ../../scripts/cliinstall.php ] && [ "$DBPASSWD" != "" ]; then DBPASSWDARG="--pass=$DBPASSWD"; fi
- if [ -e ../../bin/console ] && [ "$DBPASSWD" != "" ]; then DBPASSWDARG="--db-password=$DBPASSWD"; fi
- echo Installing GLPI on database $DBNAME
- rm ../../tests/files/_cache/cache_db/* ../../tests/files/_cache_/cache_trans/* ../../tests/files/_cache/*.json || true
- rm ../../tests/config_db.php || true
- if [ -e ../../scripts/cliinstall.php ]; then php ../../scripts/cliinstall.php --db=$DBNAME --user=$DBUSER $DBPASSWDARG --tests ; fi
- if [ -e ../../bin/console ]; then php ../../bin/console glpi:database:install --db-name=$DBNAME --db-user=$DBUSER $DBPASSWDARG --config-dir=../../tests --no-interaction --no-plugins --force; fi
- # fresh install test
- ./vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-install -ncc
- ./vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-integration $COVERAGE
- ./vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-unit $COVERAGE
- ./vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-uninstall -ncc
- ./vendor/bin/parallel-lint --exclude vendor .
- if [ "${TRAVIS_PHP_VERSION:0:3}" = "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then vendor/bin/robo --no-interaction code:cs; fi
after_success:
# let's update the documentation and locales
- if [ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then tests/after_success.sh; fi
- if [ ${TRAVIS_PHP_VERSION:0:3} == "$APIDOCS_PHP" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then tests/apidocs.sh; fi
cache:
directories:
- $HOME/.composer/cache