From f608df9f126422c61d8555e84613f0cc87f585bb Mon Sep 17 00:00:00 2001 From: gggeek Date: Sat, 21 Mar 2015 18:29:53 +0000 Subject: [PATCH] Reorganize travis scripts for clarity --- .travis.yml | 16 ++++++++++------ tests/ci/travis/setup_apache.sh | 12 +----------- tests/ci/travis/setup_apache_hhvm.sh | 5 +---- tests/ci/travis/setup_hhvm.sh | 4 ++++ tests/ci/travis/setup_php_fpm.sh | 11 +++++++++++ 5 files changed, 27 insertions(+), 21 deletions(-) create mode 100644 tests/ci/travis/setup_hhvm.sh create mode 100644 tests/ci/travis/setup_php_fpm.sh diff --git a/.travis.yml b/.travis.yml index ecb7e35..1ad93c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/tests/ci/travis/setup_apache.sh b/tests/ci/travis/setup_apache.sh index 4aff745..a39d676 100755 --- a/tests/ci/travis/setup_apache.sh +++ b/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 diff --git a/tests/ci/travis/setup_apache_hhvm.sh b/tests/ci/travis/setup_apache_hhvm.sh index 7d86a09..a72941d 100755 --- a/tests/ci/travis/setup_apache_hhvm.sh +++ b/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 diff --git a/tests/ci/travis/setup_hhvm.sh b/tests/ci/travis/setup_hhvm.sh new file mode 100644 index 0000000..289e750 --- /dev/null +++ b/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 diff --git a/tests/ci/travis/setup_php_fpm.sh b/tests/ci/travis/setup_php_fpm.sh new file mode 100644 index 0000000..7788fdc --- /dev/null +++ b/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 -- 2.43.0