Skip to content

Commit

Permalink
Better Travis CI
Browse files Browse the repository at this point in the history
NEW:
Cleaned up routines for better readability of both declaration and results.
PHP versions now really covered.
    The old code forced install of PHP and didn't use Travis provided versions.
    This resulted in the process not being executed with the declared PHP version.
Dropped MySQL in favor of MariaDB.
    This is now the FLOSS community standard.
    This should help avoid problems with buggy MySQL releases.
Fast finish enabled to show results faster.
Optimized tools installation with composer.
    The right version of the tool is installed for the PHP version under test.
New PHP linter to check for syntax errors.
    Parallelized for better speed.
Apache + PHP FPM for testing webservices.
    The previous mod_php configuration was not supported on Travis.
New global DEBUG environment variable to show verbose output with configuration files content.
IRC notification on #dolibarr@freenode for community awareness.

FIXES:
Bug in scripts preventing execution with environmentalized PHP.
Wrong detection of MAIN_URL_ROOT under specific circumstances.
    $_SERVER["DOCUMENT_ROOT"] empty and $_SERVER["SCRIPT_NAME"] populated.
Relative ignore directive in coding style ruleset to avoid bypassing test.
Unit test errors without an exit status.
    This prevented the CI from properly detecting and reporting the error.

TODOS:
PostgreSQL support.
    This one is tricky since we only have a MySQL dump and the syntax is not directly compatible.
SQLite support.
    Disabled in core at the moment.
Nginx + PHP FPM support.
    Test webservices on the second most popular webserver.
Run dev/* checks.
    We have a nice collection of scripts we could leverage.
Check Javascript.
Check CSS.
Check SQL.
  • Loading branch information
rdoursenaud committed Dec 13, 2015
1 parent dc6ec91 commit bbe7498
Show file tree
Hide file tree
Showing 48 changed files with 370 additions and 211 deletions.
434 changes: 294 additions & 140 deletions .travis.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/aps/configure.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/*-----------------------------------------------------
*
Expand Down
2 changes: 1 addition & 1 deletion build/generate_filecheck_xml.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
*
Expand Down
18 changes: 18 additions & 0 deletions build/travis-ci/apache.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<VirtualHost *:80>
DocumentRoot %TRAVIS_BUILD_DIR%/htdocs

<Directory "%TRAVIS_BUILD_DIR%/htdocs">
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>

# Wire up Apache to use Travis CI's php-fpm.
<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
</IfModule>
</VirtualHost>
18 changes: 0 additions & 18 deletions composer.json.phpcs

This file was deleted.

12 changes: 6 additions & 6 deletions dev/codesniffer/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<ruleset name="Dolibarr">
<description>Dolibarr coding standard.</description>

<exclude-pattern>*/conf.php</exclude-pattern>
<exclude-pattern>*/includes/*</exclude-pattern>
<exclude-pattern>*/documents/*</exclude-pattern>
<exclude-pattern>*/dev/vagrant/*</exclude-pattern>
<exclude-pattern>*/custom/*</exclude-pattern>
<exclude-pattern>*/nltechno*</exclude-pattern>
<exclude-pattern type="relative">build/html</exclude-pattern>
<exclude-pattern type="relative">documents</exclude-pattern>
<exclude-pattern type="relative">htdocs/custom</exclude-pattern>
<exclude-pattern type="relative">htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">htdocs/conf.php</exclude-pattern>
<exclude-pattern type="relative">*/nltechno*</exclude-pattern>

<!-- List of all tests -->

Expand Down
2 changes: 1 addition & 1 deletion dev/examples/create_invoice.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
Expand Down
2 changes: 1 addition & 1 deletion dev/examples/create_order.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
Expand Down
2 changes: 1 addition & 1 deletion dev/examples/create_product.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
Expand Down
2 changes: 1 addition & 1 deletion dev/examples/create_user.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
Expand Down
2 changes: 1 addition & 1 deletion dev/examples/get_contracts.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
Expand Down
2 changes: 1 addition & 1 deletion dev/initdata/generate-invoice.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
Expand Down
2 changes: 1 addition & 1 deletion dev/initdata/generate-order.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
Expand Down
2 changes: 1 addition & 1 deletion dev/initdata/generate-product.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
Expand Down
2 changes: 1 addition & 1 deletion dev/initdata/generate-proposal.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
Expand Down
2 changes: 1 addition & 1 deletion dev/initdata/generate-thirdparty.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
Expand Down
2 changes: 1 addition & 1 deletion dev/initdata/sftpget_and_loaddump.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
*
Expand Down
2 changes: 1 addition & 1 deletion dev/skeletons/build_api_class.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
Expand Down
2 changes: 1 addition & 1 deletion dev/skeletons/build_class_from_table.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
*
Expand Down
2 changes: 1 addition & 1 deletion dev/skeletons/build_webservice_from_class.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
Expand Down
2 changes: 1 addition & 1 deletion dev/skeletons/skeleton_script.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2007-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
Expand Down
2 changes: 1 addition & 1 deletion dev/translation/autotranslator.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net>
*
Expand Down
2 changes: 1 addition & 1 deletion dev/translation/sanity_check_en_langfiles.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (c) 2015 Tommaso Basilici <t.basilici@19.coop>
* Copyright (c) 2015 Laurent Destailleur <eldy@destailleur.fr>
Expand Down
2 changes: 1 addition & 1 deletion dev/translation/strip_language_file.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2014 by FromDual GmbH, licensed under GPL v2
* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
Expand Down
6 changes: 5 additions & 1 deletion htdocs/filefunc.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@
$tmp='';
$found=0;
$real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_document_root)); // A) Value found into config file, to say where are store htdocs files. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
$pathroot=$_SERVER["DOCUMENT_ROOT"]; // B) Value reported by web server setup, to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
if (!empty($_SERVER["DOCUMENT_ROOT"])) {
$pathroot = $_SERVER["DOCUMENT_ROOT"]; // B) Value reported by web server setup, to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
} else {
$pathroot = 'BOGUS';
}
$paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"])); // C) Value reported by web server, to say full path on filesystem of a file. Ex: /dolibarr/htdocs/admin/system/phpinfo.php
// Try to detect if $_SERVER["DOCUMENT_ROOT"]+start of $_SERVER["SCRIPT_NAME"] is $dolibarr_main_document_root. If yes, relative url to add before dol files is this start part.
$concatpath='';
Expand Down
3 changes: 2 additions & 1 deletion scripts/accountancy/export-thirdpartyaccount.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?PHP
#!/usr/bin/env php
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
Expand Down
2 changes: 1 addition & 1 deletion scripts/bank/export-bank-receipts.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
Expand Down
2 changes: 1 addition & 1 deletion scripts/company/export-contacts-xls-example.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
Expand Down
2 changes: 1 addition & 1 deletion scripts/company/sync_contacts_dolibarr2ldap.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
Expand Down
2 changes: 1 addition & 1 deletion scripts/contracts/email_expire_services_to_customers.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
Expand Down
2 changes: 1 addition & 1 deletion scripts/cron/cron_run_jobs.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
* Copyright (C) 2013 Florian Henry <forian.henry@open-concept.pro
Expand Down
2 changes: 1 addition & 1 deletion scripts/emailings/mailing-send.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
Expand Down
2 changes: 1 addition & 1 deletion scripts/invoices/email_unpaid_invoices_to_customers.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
Expand Down
2 changes: 1 addition & 1 deletion scripts/invoices/rebuild_merge_pdf.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net>
Expand Down
2 changes: 1 addition & 1 deletion scripts/members/sync_members_dolibarr2ldap.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
Expand Down
2 changes: 1 addition & 1 deletion scripts/members/sync_members_ldap2dolibarr.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
Expand Down
2 changes: 1 addition & 1 deletion scripts/product/migrate_picture_path.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/* Copyright (C) 2007-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean Heimburger <http://tiaris.eu>
Expand Down
2 changes: 1 addition & 1 deletion scripts/user/sync_groups_dolibarr2ldap.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
Expand Down
2 changes: 1 addition & 1 deletion scripts/user/sync_groups_ldap2dolibarr.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
Expand Down
2 changes: 1 addition & 1 deletion scripts/user/sync_users_dolibarr2ldap.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
Expand Down
2 changes: 1 addition & 1 deletion scripts/user/sync_users_ldap2dolibarr.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
Expand Down
2 changes: 1 addition & 1 deletion scripts/withdrawals/build_withdrawal_file.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
Expand Down
8 changes: 4 additions & 4 deletions test/phpunit/AllTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@
if ($langs->defaultlang != 'en_US')
{
print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n";
exit;
exit(1);
}
if (empty($conf->adherent->enabled))
{
print "Error: Module member must be enabled to have significatn results.\n";
exit;
print "Error: Module member must be enabled to have significant results.\n";
exit(1);
}
if (! empty($conf->ldap->enabled))
{
print "Error: LDAP module should not be enabled.\n";
exit;
exit(1);
}
if (! empty($conf->google->enabled))
{
Expand Down
2 changes: 1 addition & 1 deletion test/phpunit/ContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
if ($langs->defaultlang != 'en_US')
{
print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n";
exit;
exit(1);
}

if (empty($user->id))
Expand Down
2 changes: 1 addition & 1 deletion test/phpunit/PricesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
if (! empty($conf->global->MAIN_ROUNDING_RULE_TOT))
{
print "Parameter MAIN_ROUNDING_RULE_TOT must be set to 0 or not set.\n";
exit;
exit(1);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/phpunit/WebservicesProductsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
if (empty($conf->service->enabled))
{
print "Error: Module service must be enabled.\n";
exit;
exit(1);
}

/**
Expand Down

0 comments on commit bbe7498

Please sign in to comment.