Skip to content

Commit

Permalink
Merge pull request #187 from pfrenssen/travis-build-matrix
Browse files Browse the repository at this point in the history
A build matrix for Travis CI

Signed-off-by: Jonathan Hedstrom <jhedstrom@gmail.com>
  • Loading branch information
jhedstrom committed Jul 10, 2015
1 parent c200281 commit 766b4a1
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 46 deletions.
85 changes: 46 additions & 39 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,69 @@
language: php

php: [5.5, 5.4]
php:
- 5.4
- 5.5
- 5.6
- 7.0

env:
- PATH=$PATH:/home/travis/.composer/vendor/bin
global:
- PATH=$PATH:/home/travis/.composer/vendor/bin
matrix:
- DRUPAL_VERSION=6
- DRUPAL_VERSION=7
- DRUPAL_VERSION=8

matrix:
exclude:
- php: 5.3
env: DRUPAL_VERSION=8
- php: 5.4
env: DRUPAL_VERSION=8
- php: 5.6
env: DRUPAL_VERSION=6
- php: 7.0
env: DRUPAL_VERSION=6
- php: hhvm
env: DRUPAL_VERSION=6
allow_failures:
- php: 7.0

install:
- composer self-update
- composer install
- composer global require drush/drush:dev-master --prefer-source

before_script:
# Define the module path according to the Drupal version being tested.
- test ${DRUPAL_VERSION} -eq 8 && export MODULE_PATH='drupal/modules' || export MODULE_PATH='drupal/sites/all/modules'
# Drupal 8 uses semantic versioning.
- test ${DRUPAL_VERSION} -eq 8 && export PROJECT_NAME='drupal-8.0.x' || export PROJECT_NAME="drupal-${DRUPAL_VERSION}.x"
# Set sendmail so drush doesn't throw an error during site install.
- echo "sendmail_path='true'" >> `php --ini | grep "Loaded Configuration" | awk '{print $4}'`
# Setup a stack Drupal 6 install to test api abilities.
- mysql -e 'create database drupal6'
- drush --quiet dl drupal-6 --drupal-project-rename=drupal6
- drush --yes --root=$PWD/drupal6 site-install --db-url=mysql://travis:@127.0.0.1/drupal6
- cp -r fixtures/drupal6/modules/behat_test drupal6/sites/all/modules
- cd drupal6
- drush --yes en behat_test
# - drush --yes fr behat_test
- drush cc all
- drush --debug runserver :8886 > ~/debug6.txt 2>&1 &
- cd -
# Setup a stock Drupal 7 install to test api abilities.
- mysql -e 'create database drupal7'
- drush --quiet dl drupal-7 --drupal-project-rename=drupal7
- drush --yes --root=$PWD/drupal7 site-install --db-url=mysql://travis:@127.0.0.1/drupal7
- cp -r fixtures/drupal7/modules/behat_test drupal7/sites/all/modules
- cd drupal7
- drush --yes en behat_test
- drush --yes fr behat_test
- drush cc all
- drush --debug runserver :8887 > ~/debug7.txt 2>&1 &
- cd -
# Setup a stock Drupal 8 install to test api abilities.
- mysql -e 'create database drupal8'
- (cd drupal8 && git pull && cd -) || git clone --branch 8.0.x http://git.drupal.org/project/drupal.git drupal8
- drush --yes --root=$PWD/drupal8 site-install --db-url=mysql://travis:@127.0.0.1/drupal8
- cp -r fixtures/drupal8/modules/behat_test drupal8/modules
- cd drupal8
- mysql -e 'create database drupal'
- drush --quiet dl ${PROJECT_NAME} --dev --all --drupal-project-rename=drupal
- drush --yes --root=$PWD/drupal site-install --db-url=mysql://travis:@127.0.0.1/drupal
- cp -r fixtures/drupal${DRUPAL_VERSION}/modules/behat_test ${MODULE_PATH}
- cd drupal
- drush --yes en behat_test
- drush --yes pmu page_cache
- drush cr
- drush runserver :8888 > ~/debug8.txt 2>&1 &
# Only revert features on Drupal 7.
- test ${DRUPAL_VERSION} -eq 7 && drush --yes fr behat_test || true
# Disable the page cache on Drupal 8.
- test ${DRUPAL_VERSION} -eq 8 && drush --yes pmu page_cache || true
# Clear the cache on Drupal 6 and 7, rebuild on Drupal 8.
- test ${DRUPAL_VERSION} -eq 8 && drush cr || drush cc all || true
- drush --debug runserver :8888 > ~/debug.txt 2>&1 &
- cd -
- sleep 4s

script:
- vendor/bin/phpspec run -f pretty --no-interaction
- vendor/bin/behat -fprogress --strict
- vendor/bin/behat -fprogress --profile=drupal6 --strict
- vendor/bin/behat -fprogress --profile=drupal7 --strict
- vendor/bin/behat -fprogress --profile=drush --strict
- vendor/bin/behat -fprogress --profile=drupal8 --strict
- vendor/bin/behat -fprogress --profile=drupal${DRUPAL_VERSION} --strict
# Only test the Drush profile if Drupal 7 was installed.
- test ${DRUPAL_VERSION} -eq 7 && vendor/bin/behat -fprogress --profile=drush --strict || true

after_failure:
- cat ~/debug6.txt
- cat ~/debug7.txt
- cat ~/debug8.txt
- cat ~/debug.txt
14 changes: 7 additions & 7 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ drupal6:
tags: "@d6"
extensions:
Behat\MinkExtension:
base_url: http://localhost:8886
base_url: http://localhost:8888
Drupal\DrupalExtension:
api_driver: "drupal"
drupal:
# Change this to the absolute path to Drupal install.
drupal_root: "drupal6"
drupal_root: "drupal"
region_map:
left sidebar: "#sidebar-first"
content: "#content"
Expand All @@ -65,12 +65,12 @@ drupal7:
tags: "@d7"
extensions:
Behat\MinkExtension:
base_url: http://localhost:8887
base_url: http://localhost:8888
Drupal\DrupalExtension:
api_driver: "drupal"
drupal:
# Change this to the absolute path to Drupal install.
drupal_root: "drupal7"
drupal_root: "drupal"
region_map:
left sidebar: "#sidebar-first"
content: "#content"
Expand All @@ -90,12 +90,12 @@ drush:
tags: "@drushTest"
extensions:
Behat\MinkExtension:
base_url: http://localhost:8887
base_url: http://localhost:8888
Drupal\DrupalExtension:
api_driver: "drush"
drush_driver: "drush"
drush:
root: "drupal7"
root: "drupal"
region_map:
left sidebar: "#sidebar-first"
content: "#content"
Expand All @@ -118,7 +118,7 @@ drupal8:
api_driver: "drupal"
drupal:
# Change this to the absolute path to Drupal install.
drupal_root: "drupal8"
drupal_root: "drupal"
region_map:
left sidebar: "#sidebar-first"
content: "#content"

0 comments on commit 766b4a1

Please sign in to comment.