MDL-54059 testing: Simplify travis output

This commit is contained in:
Andrew Nicols 2016-05-05 14:29:52 +08:00
parent 2c952b2f38
commit a24aff4edf

View file

@ -27,16 +27,16 @@ env:
# Postgres is significantly is pretty reasonable in its run-time.
# Run unit tests on MySQL
- DB=mysqli PHPUNIT=true INSTALL=false CITEST=false
- DB=mysqli TASK=PHPUNIT
# Run CI Tests without running PHPUnit.
- DB=none PHPUNIT=false INSTALL=false CITEST=true
- DB=none TASK=CITEST
# Run unit tests on Postgres
- DB=pgsql PHPUNIT=true INSTALL=false CITEST=false
- DB=pgsql TASK=PHPUNIT
# Perform an upgrade test too.
- DB=pgsql PHPUNIT=false INSTALL=true CITEST=false UPGRADE=true
- DB=pgsql TASK=UPGRADE
matrix:
# Enable fast finish.
@ -47,17 +47,17 @@ matrix:
exclude:
# MySQL - it's just too slow.
# Exclude it on all versions except for 7.0
# - env: DB=mysqli PHPUNIT=true INSTALL=false CITEST=false
# - env: DB=mysqli TASK=PHPUNIT
# php: 5.6
#
# - env: DB=mysqli PHPUNIT=true INSTALL=false CITEST=false
# - env: DB=mysqli TASK=PHPUNIT
# php: 5.5
- env: DB=mysqli PHPUNIT=true INSTALL=false CITEST=false
- env: DB=mysqli TASK=PHPUNIT
php: 5.4
# Moodle 2.7 is not compatible with PHP 7 for the upgrade test.
- env: DB=pgsql PHPUNIT=false INSTALL=true CITEST=false UPGRADE=true
- env: DB=pgsql TASK=UPGRADE
php: 7.0
cache:
@ -70,6 +70,7 @@ install:
# Set the encrypted GITHUB_TOKEN if it's available to raise the API limit.
- if [ -n "$GITHUB_APITOKEN" ]; then composer config github-oauth.github.com $GITHUB_APITOKEN; fi
- echo 'auth.json' >> .git/info/exclude
# Install composer dependencies.
# We need --no-interaction in case we hit API limits for composer. This causes it to fall back to a standard clone.
@ -78,7 +79,7 @@ install:
before_script:
- >
if [ "$INSTALL" = 'true' -o "$PHPUNIT" = 'true' ];
if [ "$TASK" = 'PHPUNIT' -o "$TASK" = 'UPGRADE' ];
then
# Copy generic configuration in place.
cp config-dist.php config.php ;
@ -120,38 +121,29 @@ before_script:
mysql -u root -e 'SET GLOBAL innodb_file_per_table=ON;' ;
mysql -e 'CREATE DATABASE travis_ci_test DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;' ;
fi
if [ "$PHPUNIT" = 'true' ];
then
# Create a directory for the phpunit dataroot.
mkdir -p "$HOME"/roots/phpunit
# The phpunit dataroot and prefix..
sed -i \
-e "/require_once/i \\\$CFG->phpunit_dataroot = '\/home\/travis\/roots\/phpunit';" \
-e "/require_once/i \\\$CFG->phpunit_prefix = 'p_';" \
config.php ;
# Initialise PHPUnit for Moodle.
php admin/tool/phpunit/cli/init.php
fi
fi
script:
########################################################################
# PHPUnit
########################################################################
- >
if [ "$PHPUNIT" = 'true' ];
if [ "$TASK" = 'PHPUNIT' ];
then
vendor/bin/phpunit;
# Create a directory for the phpunit dataroot.
mkdir -p "$HOME"/roots/phpunit
# The phpunit dataroot and prefix..
sed -i \
-e "/require_once/i \\\$CFG->phpunit_dataroot = '\/home\/travis\/roots\/phpunit';" \
-e "/require_once/i \\\$CFG->phpunit_prefix = 'p_';" \
config.php ;
# Initialise PHPUnit for Moodle.
php admin/tool/phpunit/cli/init.php
fi
########################################################################
# CI Tests
########################################################################
- >
if [ "$CITEST" = 'true' ];
if [ "$TASK" = 'CITEST' ];
then
# Note - this is deliberately placed in the script section as we
# should not add any code until after phpunit has run.
@ -174,18 +166,11 @@ script:
export phpcmd=`which php`;
fi
# Actually run the CI Tests - do this outside of the main test to make output clearer.
- >
if [ "$CITEST" = 'true' ];
then
bash local/ci/php_lint/php_lint.sh;
fi
########################################################################
# Upgrade test
########################################################################
- >
if [ "$UPGRADE" = 'true' ];
if [ "$TASK" = 'UPGRADE' ];
then
# We need the official upstream.
git remote add upstream https://github.com/moodle/moodle.git;
@ -205,7 +190,27 @@ script:
# The local_ci repository can be used to check upgrade savepoints.
git clone https://github.com/moodlehq/moodle-local_ci.git local/ci ;
fi
script:
- >
if [ "$TASK" = 'PHPUNIT' ];
then
vendor/bin/phpunit;
fi
- >
if [ "$TASK" = 'CITEST' ];
then
bash local/ci/php_lint/php_lint.sh;
fi
########################################################################
# Upgrade test
########################################################################
- >
if [ "$TASK" = 'UPGRADE' ];
then
cp local/ci/check_upgrade_savepoints/check_upgrade_savepoints.php ./check_upgrade_savepoints.php
result=`php check_upgrade_savepoints.php`;
# Check if there are problems