Skip to content

Commit

Permalink
[CI] improved tests added php 7.0, 7.1, 7.2 build, also improve scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kilip committed Feb 16, 2018
1 parent 1c37098 commit d1a6960
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 55 deletions.
72 changes: 44 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: php

php:
- "5.6"

services:
- mongodb

Expand All @@ -12,57 +9,76 @@ cache:
- "$HOME/.npm"

env:
- PECLMONGO=mongo-1.6.10
global:
- DRIVER_VERSION="stable"
- ADAPTER_VERSION="^1.0.0"
- APPLICATION_ENV=development
- TRAVIS_NODE_VERSION="8"
- COMPOSER_FLAGS="--prefer-dist --no-interaction"

before_install:
- sudo apt-get update > /dev/null
- "mongo --eval 'db.runCommand({setParameter: 1, textSearchEnabled: true})' admin"
matrix:
fast_finish: true
include:
- php: '5.6'
env: COVERAGE=yes DRIVER_VERSION="1.6.10"
- php: '5.6'
- php: '7.0'
- php: '7.1'
- php: '7.2'

install:
# install php packages required for running YAWIK phpunit tests
- sudo apt-get install -y --force-yes php5-intl php5-curl php5-xsl
# install npm to manage js assets
- sudo apt-get install -y nodejs
before_install:
- node --version
# remove xdebug when not collecting code coverage
- if [[ $COVERAGE != yes ]]; then phpenv config-rm xdebug.ini; fi;
- pecl channel-update pecl.php.net

before_script:
# add composer's global bin directory to the path
- export PATH="$HOME/.composer/vendor/bin:$PATH"

before_script:
# copy default app config
- mkdir -p config/autoload
- mkdir -p build/behat
- mkdir -p build/mails
- cp .travis/autoload/*.* config/autoload

# install Mongo extension
- sh -c "wget http://pecl.php.net/get/$PECLMONGO.tgz"
- sh -c "tar xfz $PECLMONGO.tgz"
- sh -c "cd $PECLMONGO && phpize && ./configure && make && sudo make install"

- phpenv config-add .travis/phpenv.ini
- ./install.sh -b .travis/build.properties.travis
- ./composer.phar self-update
- ./composer.phar install --dev

- if [[ ${TRAVIS_PHP_VERSION:0:2} == "5." ]]; then yes '' | pecl -q install -f mongo-${DRIVER_VERSION}; fi
- if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then pecl install -f mongodb-${DRIVER_VERSION}; fi
- 'if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then
composer require "alcaeus/mongo-php-adapter=${ADAPTER_VERSION}" --prefer-dist --no-interaction --ignore-platform-reqs;
fi'
- composer install $COMPOSER_FLAGS --ignore-platform-reqs
# setup display, behat, and selenium
- ./bin/start-selenium.sh > /dev/null 2>&1 &
- sleep 5
- APPLICATION_ENV=development php -S localhost:8000 -t public public/index.php > /dev/null 2>&1 &
- php -S localhost:8000 -t public > /dev/null 2>&1 &
- sleep 3


script:
- ./vendor/bin/phpunit -c test
- APPLICATION_ENV=development ./vendor/bin/behat --strict --no-interaction
- 'if [[ $COVERAGE = yes ]]; then
./vendor/bin/phpunit -c test --verbose --coverage-clover=build/logs/clover.xml --coverage-php=build/logs/clover.serialized;
else
./vendor/bin/phpunit -c test --verbose;
fi'
# only run behat tests when not collecting coverage
- if [[ $COVERAGE != yes ]]; then ./vendor/bin/behat --strict --no-interaction; fi

after_script:
after_failure:
- cd $TRAVIS_BUILD_DIR
- "./vendor/lakion/mink-debug-extension/travis/tools/upload-textfiles \"build/behat/*.log\""
- "./vendor/lakion/mink-debug-extension/travis/tools/upload-textfiles \"log/*.log\""
- "./vendor/lakion/mink-debug-extension/travis/tools/upload-textfiles \"log/tracy/*.*\""
- "IMGUR_CLIENT_ID=bec050c54e1bb52 ./bin/imgur-uploader.sh build/behat/*.png"
- ls -l test/build/logs
- php vendor/bin/coveralls -vvv
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover test/build/logs/clover.serialized

after_script:
# process coverage
- 'if [[ $COVERAGE = yes ]]; then
composer require satooshi/php-coveralls ^1.0;
php vendor/bin/coveralls -vvv;
wget https://scrutinizer-ci.com/ocular.phar;
php ocular.phar code-coverage:upload --format=php-clover test/build/logs/clover.serialized;
fi'
42 changes: 21 additions & 21 deletions .travis/autoload/yawik.config.global.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<?php

return array(
'doctrine' =>
array(
'connection' =>
array(
'odm_default' =>
array(
'connectionString' => '',
),
),
'configuration' =>
array(
'odm_default' =>
array(
'default_db' => 'YAWIK',
),
),
),
'core_options' =>
array(
'system_message_email' => 'test.yawik@gmail.com',
),
'doctrine' =>
array(
'connection' =>
array(
'odm_default' =>
array(
'connectionString' => 'mongodb://localhost:27017/YAWIK',
),
),
'configuration' =>
array(
'odm_default' =>
array(
'default_db' => 'YAWIK',
),
),
),
'core_options' =>
array(
'system_message_email' => 'test.yawik@gmail.com',
),
);
2 changes: 0 additions & 2 deletions .travis/phpenv.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@

extension="mongo.so"
memory_limit=512M
4 changes: 0 additions & 4 deletions test/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="Bootstrap.php" colors="true" ignoreDeprecatedCodeUnitsFromCodeCoverage="true">
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="coverage-php" target="build/logs/clover.serialized"/>
</logging>
<filter>
<whitelist processUncoveredFilesFromWhitelist="false">
<directory suffix=".php">../module/*/src</directory>
Expand Down

0 comments on commit d1a6960

Please sign in to comment.