Skip to content

Commit

Permalink
Build for tests on CircleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
orthagh authored and trasher committed Feb 16, 2018
1 parent aa6d0c6 commit 38d25e8
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
version: 2

shared: &shared
steps:
- checkout
- run:
name: Dependencies
command: |
sudo apt-get install -y mysql-client libpng-dev libxml2-dev
sudo docker-php-ext-install mysqli gd xmlrpc
- run:
name: Composer
command: |
composer self-update
sed -e '/"php":/d' -i composer.json
rm -f composer.lock
composer install --optimize-autoloader
- run:
name: Update DB
command: |
mysql -h 127.0.0.1 -u root -e 'create database glpitest0723;'
mysql -h 127.0.0.1 -u root glpitest0723 < tests/glpi-0.72.3-empty.sql
cp tests/circleci.config_db.php tests/config_db.php
php scripts/cliupdate.php --config-dir=../tests --dev
php scripts/cliupdate.php --config-dir=../tests --dev |grep -q "No migration needed." || (echo "scripts/cliupdate.php FAILED" && exit 1)
php scripts/innodb_migration.php --config-dir=../tests
rm tests/config_db.php
- run:
name: Install DB
command: |
mysql -h 127.0.0.1 -u root -e 'create database glpitest;'
php scripts/cliinstall.php --db=glpitest --host=127.0.0.1 --user=root --tests
php scripts/cliupdate.php --config-dir=../tests |grep -q "No migration needed." || (echo "scripts/cliupdate.php FAILED" && exit 1)
./tests/test_fail_update.sh; git checkout install/update_92_93.php;
- run:
name: tests DB
command: composer testdb
- run:
name: tests
command: composer test
- run:
name: tests WEB
command: |
php -S localhost:8088 tests/router.php &>/dev/null &
composer testweb
- run:
name: tests LDAP
command: |
./tests/LDAP/ldap_run.sh
composer testldap
- run:
name: Coding standards
command: composer cs
jobs:
"build":
<<: *shared
docker:
- image: circleci/php:5.6-apache-node-browsers
- image: circleci/mariadb:10.1
"php5.6":
<<: *shared
docker:
- image: circleci/php:5.6-apache-node-browsers
- image: circleci/mariadb:10.1
"php7.0":
<<: *shared
docker:
- image: circleci/php:7.0-apache-node-browsers
- image: circleci/mariadb:10.2
"php7.1":
<<: *shared
docker:
- image: circleci/php:7.1-apache-node-browsers
- image: circleci/mariadb:10.3
"php7.2":
<<: *shared
docker:
- image: circleci/php:7.2-apache-node-browsers
- image: circleci/mariadb:10.3

workflows:
version: 2
tests_all:
jobs:
- php5.6
- php7.0
- php7.1
- php7.2
37 changes: 37 additions & 0 deletions tests/circleci.config_db.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2018 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
class DB extends DBmysql {
public $dbhost = '127.0.0.1';
public $dbuser = 'root';
public $dbpassword = '';
public $dbdefault = 'glpitest0723';
}

0 comments on commit 38d25e8

Please sign in to comment.