From 766b4a12e44f10e85adbbb8db6ebf920764bbed8 Mon Sep 17 00:00:00 2001 From: Jonathan Hedstrom Date: Fri, 10 Jul 2015 10:03:29 -0700 Subject: [PATCH] Merge pull request #187 from pfrenssen/travis-build-matrix A build matrix for Travis CI Signed-off-by: Jonathan Hedstrom --- .travis.yml | 85 +++++++++++++++++++++++++++----------------------- behat.yml.dist | 14 ++++----- 2 files changed, 53 insertions(+), 46 deletions(-) diff --git a/.travis.yml b/.travis.yml index 39404b1e..5b834746 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,33 @@ 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 @@ -11,52 +35,35 @@ 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 diff --git a/behat.yml.dist b/behat.yml.dist index a377c94d..6fc0c532 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -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" @@ -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" @@ -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" @@ -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"