Skip to content

Commit

Permalink
Merge pull request #1033 from AronNovak/1032-travis
Browse files Browse the repository at this point in the history
Travis fix for 7.x-1.x
  • Loading branch information
amitaibu authored Jul 3, 2018
2 parents 51bdede + 2be71da commit e1f00c3
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
25 changes: 25 additions & 0 deletions .travis-apache.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<VirtualHost *:80>
# [...]

DocumentRoot PATH

<Directory "PATH">
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
Require all granted
</Directory>

# Wire up Apache to use Travis CI's php-fpm.
<IfModule mod_fastcgi.c>
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

<Directory /usr/lib/cgi-bin>
Require all granted
</Directory>
</IfModule>

# [...]
</VirtualHost>
30 changes: 19 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -21,38 +21,46 @@ 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
- echo "error_log=syslog" >> `php --ini | grep "Loaded Configuration" | awk '{print $4}'`
# 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
Expand Down

0 comments on commit e1f00c3

Please sign in to comment.