├── .travis.yml ├── README.md ├── test ├── drupal_unit_test_case_example.test └── drupal_web_test_case_example.test ├── travis_ci_drupal_module_example.info └── travis_ci_drupal_module_example.module /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 5.3 5 | - 5.4 6 | - 5.5 7 | - 5.6 8 | - hhvm 9 | 10 | matrix: 11 | fast_finish: true 12 | allow_failures: 13 | - php: hhvm 14 | 15 | mysql: 16 | database: travis_ci_drupal_module_example_test 17 | username: root 18 | encoding: utf8 19 | 20 | before_install: 21 | - sudo apt-get update > /dev/null 22 | 23 | install: 24 | # install php packages required for running a web server from drush on php 5.3 25 | - sudo apt-get install -y --force-yes php5-cgi php5-mysql 26 | 27 | # add composer's global bin directory to the path 28 | # see: https://github.com/drush-ops/drush#install---composer 29 | - export PATH="$HOME/.composer/vendor/bin:$PATH" 30 | 31 | # install drush globally 32 | - composer global require drush/drush:6.* 33 | 34 | before_script: 35 | # navigate out of module directory to prevent blown stack by recursive module lookup 36 | - cd ../.. 37 | 38 | # create new site, stubbing sendmail path with true to prevent delivery errors and manually resolving drush path 39 | - mysql -e 'create database travis_ci_drupal_module_example_test' 40 | - php -d sendmail_path=`which true` ~/.composer/vendor/bin/drush.php --yes core-quick-drupal --profile=testing --no-server --db-url=mysql://root:@127.0.0.1/travis_ci_drupal_module_example_test --enable=simpletest travis_ci_drupal_module_example_test 41 | 42 | # reference and enable travis_ci_drupal_module_example in build site 43 | - ln -s $(readlink -e $(cd -)) travis_ci_drupal_module_example_test/drupal/sites/all/modules/travis_ci_drupal_module_example 44 | - cd travis_ci_drupal_module_example_test/drupal 45 | - drush --yes pm-enable travis_ci_drupal_module_example 46 | 47 | # start a web server on port 8080, run in the background; wait for initialization 48 | - drush runserver 127.0.0.1:8080 & 49 | - until netstat -an 2>/dev/null | grep '8080.*LISTEN'; do true; done 50 | 51 | script: drush test-run 'Travis-CI Drupal Module Example' --uri=http://127.0.0.1:8080 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Example Drupal Module 2 | ===================== 3 | 4 | The purpose of this repository is to show how to use Travis CI to do 5 | continuous integration with a Drupal project. 6 | 7 | Here is a sample status icon showing the state of the master branch. 8 | 9 | [![Build Status](https://secure.travis-ci.org/sonnym/travis-ci-drupal-module-example.png?branch=master)](http://travis-ci.org/sonnym/travis-ci-drupal-module-example) 10 | 11 | In order to run this project just fork it on github.com and then [enable](http://about.travis-ci.org/docs/user/getting-started/) 12 | your fork on your [travis-ci profile](http://travis-ci.org/profile). Every push will then trigger a new build on Travis CI. 13 | -------------------------------------------------------------------------------- /test/drupal_unit_test_case_example.test: -------------------------------------------------------------------------------- 1 | 'Example Drupal Unit Test Case', 6 | 'group' => 'Travis-CI Drupal Module Example', 7 | ); 8 | } 9 | 10 | public function testAssertTrue() { 11 | $this->assert(true); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/drupal_web_test_case_example.test: -------------------------------------------------------------------------------- 1 | 'Example Drupal Web Test Case', 6 | 'group' => 'Travis-CI Drupal Module Example', 7 | ); 8 | } 9 | 10 | public function testAssertTrue() { 11 | $this->assert(true); 12 | } 13 | 14 | public function testDrupalGet() { 15 | $this->drupalGet('node'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /travis_ci_drupal_module_example.info: -------------------------------------------------------------------------------- 1 | name = Travis-CI Drupal Module Example 2 | description = An example of how to configure Travis-CI for a Drupal module. 3 | package = Development 4 | php = 5.3 5 | core = 7.x 6 | 7 | files[] = test/drupal_unit_test_case_example.test 8 | files[] = test/drupal_web_test_case_example.test 9 | -------------------------------------------------------------------------------- /travis_ci_drupal_module_example.module: -------------------------------------------------------------------------------- 1 |