Skip to content
This repository was archived by the owner on May 30, 2018. It is now read-only.

Commit ca200d0

Browse files
committed
ci(travis): refactor CI files
Signed-off-by: Thierry Bugier <[email protected]>
1 parent 5cbcedf commit ca200d0

File tree

2 files changed

+49
-34
lines changed

2 files changed

+49
-34
lines changed

.travis.yml

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,37 @@ language: php
22

33
env:
44
global:
5-
- GLPI_SOURCE="https://github.com/glpi-project/glpi -b 9.2/bugfixes"
6-
- FUSION_SOURCE="https://github.com/fusioninventory/fusioninventory-for-glpi -b master"
7-
- FLYVEMDM_SOURCE="https://github.com/flyve-mdm/flyve-mdm-glpi-plugin -b develop"
5+
- GLPI_SOURCE="https://github.com/glpi-project/glpi"
6+
- FI_SOURCE="https://github.com/fusioninventory/fusioninventory-for-glpi"
7+
- CS=7.2
8+
- DBNAME=glpitest
89
- secure: riqurLkD5HXiKdkjSZXipb4+2VhXIjV6yjex7z89eHYqVhK049k/qIuxX2nCCCB7BxVuA+2fjDXXgjH4XihYvIcwxepplbDEjzgTYp/dDmN/8w3v9GvNBrD5fiV68a98Wpdy9zfbGk5hcoabKGJdyYCAFzCqLYmMGo5JU52lV2v6FcjkmkogFEpcKkg6+eZvDdCuCMgKziXwXKG7mDENAZA3PlPMaTmQ+sNaCWyYPKYC08+TGRIP9sS+lTY78SW/gY06CgWeJ1cF/MSRf8g0payEl9B4BuVFt8eAk+QIhDxvfkUmjIMEciT9c3stwsLnZQW1P4AAsmAqpmdajoGPg8XY+ZmFNdvAkh9hbGzdIy50v+cKlNyi2w/ZC5iQg43fmC0YwoGLd225FI1gJQFMkQiMYj2mi1Ir0/QFfVM5G5VWALRGQs5CyGOl9MOy01QISkkuURHYGLw+7jCCZyYmfww5gFO4RFcjPDBpoQt8Ra3Lbq1IaWt/gd4eQWjoXqiUjkYQ5L0tHd2Na4DR9q7X72mPoswUucxRAusF1M883uxIVWJRGFVs3Sup6U8qnZxXrpWIN8fpAtO7NuTQoCF48AhIC32+i41Ab002AUQLij8r8GGVehprhgyTbqDtd7zXWuC04rWBwVmXLsYvvqcszY2INUz4/jPswvHuvpZraxI=
9-
- DB=glpitest
10-
11-
cache:
12-
directories:
13-
- $HOME/.composer/cache
10+
matrix:
11+
- GLPI_BRANCH=9.2.1 FI_BRANCH=glpi9.2+1.0
12+
- GLPI_BRANCH=9.2/bugfixes FI_BRANCH=glpi9.2+1.0
13+
- GLPI_BRANCH=9.3/bugfixes FI_BRANCH=master
14+
- GLPI_BRANCH=master FI_BRANCH=master
15+
16+
php:
17+
- 5.6
18+
- 7.0
19+
- 7.1
20+
- 7.2
21+
- nightly
22+
23+
allow_failures:
24+
- php: nightly
1425

1526
before_script:
16-
- mysql -u root -e 'create database $DB;'
17-
- phpenv config-rm xdebug.ini || true
18-
- rm -f composer.lock
19-
- tests/config-composer.sh
20-
- git clone --depth=1 $GLPI_SOURCE ../glpi && cd ../glpi
21-
- composer install --no-dev
22-
- php tools/cliinstall.php --db=$DB --user=travis --tests
23-
- cp tests/config_db.php config/config_db.php
24-
- mkdir plugins/fusioninventory && git clone --depth=1 $FUSION_SOURCE plugins/fusioninventory
25-
- mkdir plugins/flyvemdm && git clone --depth=1 $FLYVEMDM_SOURCE plugins/flyvemdm
26-
- cd plugins/flyvemdm && composer install --no-dev && cd ../..
27-
- IFS=/ read -a repo <<< $TRAVIS_REPO_SLUG
28-
- mv ../${repo[1]} plugins/flyvemdmdemo
29-
- cd plugins/flyvemdmdemo && composer install -o
27+
- "./tests/before_script.sh"
3028

3129
script:
3230
- vendor/bin/phpunit -v
33-
- if [[ "$CS" == "true" ]]; then vendor/bin/phpcs -p --standard=vendor/glpi-project/coding-standard/GlpiStandard/ *.php front/ inc/ tests/; fi
31+
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ]] && [ "$GLPI_BRANCH" = "9.2/bugfixes" ]; then vendor/bin/phpcs -p --standard=vendor/glpi-project/coding-standard/GlpiStandard/ *.php front/ inc/ tests/; fi
32+
33+
cache:
34+
directories:
35+
- $HOME/.composer/cache
3436

35-
matrix:
36-
include:
37-
- php: 5.6
38-
- php: 7.0
39-
- php: 7.1
40-
- php: 7.2
41-
env: CS=true
42-
- php: nightly
43-
allow_failures:
44-
- php: nightly
45-
4637
notifications:
4738
webhooks: https://hooks.aethonan.pro/travisci/-1001061475099/

tests/before_script.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
#
4+
# Before script for Travis CI
5+
#
6+
7+
# config composer
8+
if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then
9+
mkdir ~/.composer -p
10+
touch ~/.composer/composer.json
11+
composer config -g github-oauth.github.com $GH_OAUTH
12+
fi
13+
14+
mysql -u root -e 'create database $DBNAME;'
15+
git clone --depth=1 $GLPI_SOURCE -b $GLPI_BRANCH ../glpi && cd ../glpi
16+
composer install --no-dev --no-interaction
17+
if [ -e scripts/cliinstall.php ] ; then php scripts/cliinstall.php --db=glpitest --user=root --tests ; fi
18+
if [ -e tools/cliinstall.php ] ; then php tools/cliinstall.php --db=glpitest --user=root --tests ; fi
19+
mkdir plugins/fusioninventory && git clone --depth=1 $FI_SOURCE -b $FI_BRANCH plugins/fusioninventory
20+
mkdir plugins/flyvemdm && git clone --depth=1 $FLYVEMDM_SOURCE -b $FLYVEMDM_BRANCH plugins/flyvemdm
21+
cd plugins/flyvemdm && composer install --no-dev && cd ../..
22+
IFS=/ read -a repo <<< $TRAVIS_REPO_SLUG
23+
mv ../${repo[1]} plugins/flyvemdmdemo
24+
cd plugins/flyvemdmdemo && composer install -o

0 commit comments

Comments
 (0)