Skip to content

Commit

Permalink
Extract travis-ci scripts to bash script files; Add a PHP7 build targ…
Browse files Browse the repository at this point in the history
…et; fix redis/mongo exts
  • Loading branch information
padraic committed Feb 15, 2015
1 parent 69d8323 commit 9388aa5
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 9 deletions.
17 changes: 8 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ php:
- 5.4
- 5.5
- 5.6
- 5.3.3 #This will actually use PHP7
- hhvm
- hhvm-nightly

Expand All @@ -19,22 +20,20 @@ cache:
directories:
- $HOME/.composer/cache

before_install:
- ./travis/before_install.sh

install:
- travis_retry composer install -n
- travis_retry ./travis/install.sh

before_script:
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]]; then echo "extension = mongo.so\nextension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
- phpenv rehash
- ./travis/before_script.sh

script:
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]]; then vendor/bin/phpunit --coverage-text --coverage-clover ./build/logs/clover.xml; fi
- if [[ "$TRAVIS_PHP_VERSION" == "hhvm" ]] || [[ "$TRAVIS_PHP_VERSION" == "hhvm-nightly" ]]; then vendor/bin/phpunit; fi
- ./travis/script.sh

after_script:
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]]; then vendor/bin/coveralls -v; fi
- if [[ "$TRAVIS_PHP_VERSION" == "5.5" ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [[ "$TRAVIS_PHP_VERSION" == "5.5" ]]; then php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi

- ./travis/after_script.sh
notifications:
email:
- padraic.brady@gmail.com
Expand Down
12 changes: 12 additions & 0 deletions travis/after_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
if [[ "$TRAVIS_PHP_VERSION" != "hhvm" && "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]]; then
vendor/bin/coveralls -v
fi

if [[ "$TRAVIS_PHP_VERSION" == "5.6" ]]; then
wget https://scrutinizer-ci.com/ocular.phar
fi

if [[ "$TRAVIS_PHP_VERSION" == "5.6" ]]; then
php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml
fi
21 changes: 21 additions & 0 deletions travis/before_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
if [[ "$TRAVIS_PHP_VERSION" == "5.3.3" ]]; then
pushd $HOME
git clone https://github.com/php/php-src.git
pushd php-src
./buildconf -f
./configure --with-curl --prefix=$HOME/.phpenv/versions/7 --quiet
make --quiet
make install
phpenv global 7
popd
popd
php --version
echo Travis PHP Version is $TRAVIS_PHP_VERSION
wget http://getcomposer.org/composer.phar
mkdir $PWD/phar
mv composer.phar $PWD/phar/composer
chmod +x $PWD/phar/composer
else
composer self-update
fi
7 changes: 7 additions & 0 deletions travis/before_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
if [[ "$TRAVIS_PHP_VERSION" != "hhvm" \
&& "$TRAVIS_PHP_VERSION" != "hhvm-nightly" \
&& "$TRAVIS_PHP_VERSION" != "5.3.3" ]]; then
phpenv config-add ./travis/extra.ini
fi
phpenv rehash
2 changes: 2 additions & 0 deletions travis/extra.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extension = "mongo.so"
extension = "redis.so"
6 changes: 6 additions & 0 deletions travis/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
export PATH=$PWD/phar:$PATH
if [[ "$TRAVIS_PHP_VERSION" == "5.3.3" ]]; then
echo PATH is $PATH
fi
composer install -n
8 changes: 8 additions & 0 deletions travis/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
if [[ "$TRAVIS_PHP_VERSION" != "hhvm" && "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]]; then
vendor/bin/phpunit --coverage-text --coverage-clover ./build/logs/clover.xml
fi

if [[ "$TRAVIS_PHP_VERSION" == "hhvm" || "$TRAVIS_PHP_VERSION" == "hhvm-nightly" ]]; then
vendor/bin/phpunit
fi

0 comments on commit 9388aa5

Please sign in to comment.