From 981c26142189d9e7ba7c9cdd151cd62e7e57d510 Mon Sep 17 00:00:00 2001 From: Aron Novak Date: Fri, 22 Jun 2018 11:04:04 +0200 Subject: [PATCH 1/2] Travis fixes for 2.x --- .travis-apache.cfg | 25 +++++++++++++++++++++++++ .travis.yml | 32 ++++++++++++++++++-------------- 2 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 .travis-apache.cfg 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 d20552a7..b8b97ef0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,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: @@ -19,14 +19,6 @@ install: - phpenv rehash # Make sure we don't fail when checking out projects - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - - sudo cat /etc/apt/sources.list - - echo "deb http://archive.ubuntu.com/ubuntu/ precise multiverse" | sudo tee -a /etc/apt/sources.list - - echo "deb-src http://archive.ubuntu.com/ubuntu/ precise multiverse" | sudo tee -a /etc/apt/sources.list - - echo "deb http://archive.ubuntu.com/ubuntu/ precise-updates multiverse" | sudo tee -a /etc/apt/sources.list - - echo "deb-src http://archive.ubuntu.com/ubuntu/ precise-updates multiverse" | sudo tee -a /etc/apt/sources.list - - echo "deb http://security.ubuntu.com/ubuntu precise-security multiverse" | sudo tee -a /etc/apt/sources.list - - echo "deb-src http://security.ubuntu.com/ubuntu precise-security multiverse" | sudo tee -a /etc/apt/sources.list - # LAMP package installation (mysql is already started) - sudo apt-get update - sudo apt-get install apache2 libapache2-mod-fastcgi @@ -34,9 +26,9 @@ install: - 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 @@ -44,9 +36,11 @@ 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 @@ -60,6 +54,16 @@ before_script: - 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 + - echo " > Move MySQL datadir to RAM disk." + - sudo service mysql stop + - 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 From 602689b0c1dabbe43370c8ccfb7d60f8340b28bf Mon Sep 17 00:00:00 2001 From: Aron Novak Date: Fri, 22 Jun 2018 11:06:43 +0200 Subject: [PATCH 2/2] remove apt-get update, epxlicit sudo required --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b8b97ef0..ddb49a85 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: php +sudo: required php: - 5.5 @@ -20,7 +21,6 @@ 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