Have Travis CI Install Drupal

Public

This is a decent starting point for any Travis CI stuff that needs to stand up a drupal site to work against. Here's a working example based on this snippet https://github.com/drupalprojects/elmsmedia

</> CopyGet raw version
yaml
  1. language: php
  2.  
  3. php:
  4. - 5.3
  5. - 5.4
  6. - 5.5
  7. - hhvm
  8.  
  9. matrix:
  10.   allow-failures:
  11.   - php: hhvm
  12.  
  13.   env:
  14.   global:
  15. - ES_VER=1.0.1
  16. - ES_MAPPER_ATTACHMENTS_VER=2.0.0.RC1
  17. - ES_TRANSPORT_THRIFT_VER=2.0.0.RC1
  18. - ES_GEOCLUSTER_FACET_VER=0.0.10
  19. - ES_WAIT_ON_MAPPING_CHANGE=true
  20. - DATABASE='drupal'
  21. - DB_USERNAME='root'
  22. - DB_ENCODE='utf8'
  23.   matrix:
  24. - DRUPAL_3RD_PARTY='composer_manager'
  25. - DRUPAL_3RD_PARTY='libraries'
  26.  
  27. mysql:
  28.   database: $DATABASE
  29.   username: $DB_USERNAME
  30.   encoding: $DB_ENCODE
  31.  
  32. before_install:
  33. - export UPDATE TRAVIS_BUILD_DIR
  34. - BUILD_TOP=`dirname $TRAVIS_BUILD_DIR`
  35. - EXIT_VALUE=0
  36. - sudo apt-get update > /dev/null
  37. - composer self-update
  38. # mail requirements
  39. - sudo apt-get update -qq
  40. - sudo apt-get install -y -qq postfix
  41. install:
  42. # install php packages required for running a web server from drush on php 5.3
  43. - sudo apt-get install -y --force-yes php5-cgi php5-mysql
  44. # install drush globally
  45. - composer global require drush/drush:6.*
  46. # add composer's global bin directory to the path
  47. # see: https://github.com/drush-ops/drush#install---composer
  48. - export PATH="$HOME/.composer/vendor/bin:$PATH"
  49. before_script:
  50. # setup fake mailserver
  51. - sudo service postfix stop
  52. - smtp-sink -d "%d.%H.%M.%S" 127.0.0.1:2500 1000 &
  53. - echo -e '#!/usr/bin/env bash\nexit 0' | sudo tee /usr/sbin/sendmail
  54. - echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' | sudo tee "/home/travis/.phpenv/versions/`php -i | grep "PHP Version" | head -n 1 | grep -o -P '\d+\.\d+\.\d+.*'`/etc/conf.d/sendmail.ini"
  55. # establish drupal package put in place the right way
  56. - sudo mkdir -p /var/www
  57. - sudo chown travis:travis /var/www
  58. - drush dl drupal --destination=/var/www --default-major=7 --drupal-project-rename=drupal --y
  59. # get drush recipes setup functions
  60. - sudo mkdir -p ~/.drush
  61. - sudo chown -R travis:travis ~/.drush
  62. - cd ~/.drush/
  63. # get some plugins good for testing and building systems rapidly
  64. - drush dl drush_recipes, registry_rebuild, drush_ecl --y
  65. - drush cc drush
  66.  
  67. script:
  68. # stand up drupal
  69. - cd /var/www/drupal
  70. - drush site-install -y --db-url=mysql://root@127.0.0.1/travisdb --db-su='root' --db-su-pw=''
  71. # @todo put the other stuff here to build but this should give us a site
  72. - cd /var/www/drupal/sites/all/modules
  73. after_script:
  74. - drush status
  75.  
  76. notifications:
  77. # add your IRC here
  78. # irc: irc.freenode.org#{CHANNEL}
  79.  
  80. # email: false
  81. # slack:
  82. # rooms:
  83. # add your slack rooms here

Comments