Skip to content

Commit

Permalink
Reorganize travis scripts for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
gggeek committed Mar 21, 2015
1 parent c19e9f6 commit f608df9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 21 deletions.
16 changes: 10 additions & 6 deletions .travis.yml
Expand Up @@ -9,32 +9,36 @@ php:
- hhvm

before_install:
# This is mandatory or the 'apt-get install' calls following will fail
- sudo apt-get update -qq

install:
- sudo apt-get install -y apache2 libapache2-mod-fastcgi
- sudo apt-get install -y privoxy

install:
- composer self-update && composer install

before_script:
# Disable xdebug. NB: this should NOT be done for hhvm...
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" -a "$TRAVIS_PHP_VERSION" != "7.0" ]; then phpenv config-rm xdebug.ini; fi

# We set up an Apache instance inside the Travis VM and test it.
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then ./tests/ci/travis/setup_apache.sh; fi
- if [ "$TRAVIS_PHP_VERSION" = "hhvm" ]; then ./tests/ci/travis/setup_apache_hhvm.sh; fi
# Set up Apache and Privoxy instances inside the Travis VM and use them for testing against
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then ./tests/ci/travis/setup_php_fpm.sh; ./tests/ci/travis/setup_apache.sh; fi
- if [ "$TRAVIS_PHP_VERSION" = "hhvm" ]; then ./tests/ci/travis/setup_hhvm.sh; ./tests/ci/travis/setup_apache_hhvm.sh; fi
- ./tests/ci/travis/setup_privoxy.sh

script:
# to have code coverage: --coverage-clover=coverage.clover
# Travis currently compiles PHP with an oldish cURL/GnuTLS combination;
# to make the tests pass when Apache has a bogus SSL cert whe need the full set of options below
phpunit tests LOCALSERVER=localhost URI=/demo/server/server.php HTTPSSERVER=localhost HTTPSURI=/demo/server/server.php PROXY=localhost:8080 HTTPSVERIFYHOST=0 HTTPSIGNOREPEER=1 SSLVERSION=3

after_failure:
# Save as much info as we can to help developers
- cat apache_error.log
- cat apache_access.log
- php -i

after_script:
# # upload code-coverage to Scrutinizer
# # Upload code-coverage to Scrutinizer
# - wget https://scrutinizer-ci.com/ocular.phar
# - php ocular.phar code-coverage:upload --format=php-clover coverage.clover
12 changes: 1 addition & 11 deletions tests/ci/travis/setup_apache.sh
@@ -1,20 +1,10 @@
#!/bin/sh

# enable php-fpm
# set up Apache for php-fpm
# @see https://github.com/travis-ci/travis-ci.github.com/blob/master/docs/user/languages/php.md#apache--php

sudo a2enmod rewrite actions fastcgi alias ssl

# enable php-fpm
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
# work around travis issue #3385
if [ "$TRAVIS_PHP_VERSION" = "7.0" -a -n "$(ls -A ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d)" ]; then
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf
fi
echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
echo "always_populate_raw_post_data = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm

# configure apache virtual hosts
sudo cp -f tests/ci/travis/apache_vhost /etc/apache2/sites-available/default
sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default
Expand Down
5 changes: 1 addition & 4 deletions tests/ci/travis/setup_apache_hhvm.sh
@@ -1,13 +1,10 @@
#!/bin/sh

# enable hhvm-fcgi
# set up Apache for hhvm-fcgi
# @see https://github.com/travis-ci/travis-ci.github.com/blob/master/docs/user/languages/php.md#apache--php

sudo a2enmod rewrite actions fastcgi alias ssl

# start HHVM
hhvm -m daemon -vServer.Type=fastcgi -vServer.Port=9000 -vServer.FixPathInfo=true

# configure apache virtual hosts
sudo cp -f tests/ci/travis/apache_vhost_hhvm /etc/apache2/sites-available/default
sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default
Expand Down
4 changes: 4 additions & 0 deletions tests/ci/travis/setup_hhvm.sh
@@ -0,0 +1,4 @@
#!/bin/sh

# start HHVM
hhvm -m daemon -vServer.Type=fastcgi -vServer.Port=9000 -vServer.FixPathInfo=true
11 changes: 11 additions & 0 deletions tests/ci/travis/setup_php_fpm.sh
@@ -0,0 +1,11 @@
#!/bin/sh

# enable php-fpm
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
# work around travis issue #3385
if [ "$TRAVIS_PHP_VERSION" = "7.0" -a -n "$(ls -A ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d)" ]; then
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf
fi
echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
echo "always_populate_raw_post_data = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm

0 comments on commit f608df9

Please sign in to comment.