diff --git a/.travis-apache.cfg b/.travis-apache.cfg new file mode 100644 index 00000000..507734f9 --- /dev/null +++ b/.travis-apache.cfg @@ -0,0 +1,25 @@ + + # [...] + + DocumentRoot PATH + + + Options FollowSymLinks MultiViews ExecCGI + AllowOverride All + Require all granted + + + # Wire up Apache to use Travis CI's php-fpm. + + AddHandler php5-fcgi .php + Action php5-fcgi /php5-fcgi + Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi + FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization + + + Require all granted + + + + # [...] + diff --git a/.travis.yml b/.travis.yml index 8ad30316..aaf28932 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ php: - 5.6 env: - - PATH=$PATH:/home/travis/.composer/vendor/bin + - PATH="$HOME/.config/composer/vendor/bin:$PATH" # This will create the database mysql: @@ -21,15 +21,14 @@ install: # Make sure we don't fail when checking out projects - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config # LAMP package installation (mysql is already started) - - sudo apt-get update - sudo apt-get install apache2 libapache2-mod-fastcgi # enable php-fpm, travis does not support any other method with php and apache - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf - sudo a2enmod rewrite actions fastcgi alias - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars + - sudo chown -R travis:travis /var/lib/apache2/fastcgi - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm - # Make sure the apache root is in our wanted directory - - echo "$(curl -fsSL https://gist.githubusercontent.com/nickveenhof/11386315/raw/b8abaf9304fe12b5cc7752d39c29c1edae8ac2e6/gistfile1.txt)" | sed -e "s,PATH,$TRAVIS_BUILD_DIR/../drupal,g" | sudo tee /etc/apache2/sites-available/default > /dev/null # Set sendmail so drush doesn't throw an error during site install. - echo "sendmail_path='true'" >> `php --ini | grep "Loaded Configuration" | awk '{print $4}'` # Forward the errors to the syslog so we can print them @@ -37,22 +36,31 @@ install: # Get latest drupal 8 core - cd $TRAVIS_BUILD_DIR/.. - git clone --depth 1 --branch 7.x http://git.drupal.org/project/drupal.git - # Restart apache and test it - - sudo service apache2 restart - - curl -v "http://localhost" + # Make sure the apache root is in our wanted directory + - cd drupal && export DOCROOT=$(pwd) + - export APACHE_SITE_CFG="/etc/apache2/sites-available/000-default.conf" + - sudo sh -c 'cat $TRAVIS_BUILD_DIR/.travis-apache.cfg | sed -e "s,PATH,$DOCROOT,g" | tee > $APACHE_SITE_CFG' + # Re-enable when trying to get CodeSniffer doesn't return a 403 anymore. #- composer global require drupal/coder:\>7 before_script: - cd $TRAVIS_BUILD_DIR/../drupal - # Update drupal core - - git pull origin 7.x # Install the site - drush -v site-install minimal --db-url=mysql://root:@localhost/drupal --yes + - phpenv rehash + - echo " > MySQL fine-tuning." + - sudo service mysql stop # Increase max_allowed_packet to avoid MySQL errors - echo -e "[server]\nmax_allowed_packet=64M" | sudo tee -a /etc/mysql/conf.d/drupal.cnf - - sudo service mysql restart - - phpenv rehash + # Performance optimization - MySQL to RAM disk + - sudo mv /var/lib/mysql /var/run/tmpfs + - sudo ln -s /var/run/tmpfs /var/lib/mysql + - sudo service mysql start + + # Restart apache and test it + - sudo service apache2 restart + - curl -v "http://localhost" script: # Go to our Drupal module directory