forked from jhedstrom/drupalextension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
91 lines (83 loc) · 4.2 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
language: php
php:
- 7.3
- 7.4
- 8.0
- 8.1
env:
global:
- PATH=$PATH:/home/travis/.config/composer/vendor/bin
- TRAVIS_NODE_VERSION="4.0.0"
matrix:
- DRUPAL_VERSION=7
- DRUPAL_VERSION=9
# Enable Travis containers.
sudo: false
services:
- mysql
install:
- composer self-update
# For Drupal 8 install the behat drush endpoint.
# Pins symfony/dependency-injection to match core.
# @see https://github.com/jhedstrom/drupalextension/issues/413
# @todo Re-enable behat drush endpoint testing.
# @see https://github.com/jhedstrom/drupalextension/issues/458
- test ${DRUPAL_VERSION} -lt 8 || composer require --no-interaction --dev --no-update drupal/core-recommended:^${DRUPAL_VERSION} drupal/core-composer-scaffold:^${DRUPAL_VERSION} drush/drush:^10
# Remove core/drush deps for Drupal 7.
- test ${DRUPAL_VERSION} -ge 8 || composer remove --dev drush/drush drupal/core-recommended drupal/core-composer-scaffold
- composer install
# For Drupal 8, change composer.json to require symfony 3.x as conflicting
# versions between the separate drupal and drupalextension vendor folders
# can create conflicts.
# Install drush globally.
- (test ${DRUPAL_VERSION} -lt 8 && composer global require drush/drush:~8.0 drupal/drupal-driver) || composer global require drush/drush:~10.0
# Install the Behat Drush Endpoint for Drupal 7 tests.
- test ${DRUPAL_VERSION} -gt 7 || (git clone https://github.com/drush-ops/behat-drush-endpoint.git drush/behat-drush-endpoint && (cd drush/behat-drush-endpoint && composer install --no-dev && cd -))
# Pin node version.
# @see http://austinpray.com/ops/2015/09/20/change-travis-node-version.html
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
- npm install
before_script:
# Define the module path according to the Drupal version being tested.
- test ${DRUPAL_VERSION} -lt 8 || export MODULE_PATH="drupal/modules"
- test ${DRUPAL_VERSION} -ge 8 || export MODULE_PATH="drupal/sites/all/modules" && mkdir -p ${MODULE_PATH}
# Set sendmail so drush doesn't throw an error during site install.
- echo "sendmail_path='true'" >> `php --ini | grep "Loaded Configuration" | awk '{print $4}'`
- mysql -e 'create database drupal'
# Download and install Drupal so we can test API abilities.
# For Drush 9, dl is deprecated so we must use composer. However, we still
# cannot simply require drupal/drupal since it hardcodes it's autoloader
# and we'd need to use drupal-scaffold, etc, etc.
- test ${DRUPAL_VERSION} -ge 8 || drush dl --quiet --yes drupal-${DRUPAL_VERSION}.x --all --drupal-project-rename=drupal
# Install Drupal.
- drush --yes --root=$PWD/drupal site-install --db-url=mysql://travis:@127.0.0.1/drupal --debug
# Copy the static HTML that is used for blackbox testing in the web root.
- cp -r fixtures/blackbox $PWD/drupal
# Copy our test module to the correct location.
- cp -r fixtures/drupal${DRUPAL_VERSION}/modules/behat_test ${MODULE_PATH}
- cd drupal
- drush --yes en behat_test
- drush cc drush
# @todo Re-enable behat drush endpoint testing.
# @see https://github.com/jhedstrom/drupalextension/issues/458
# - test ${DRUPAL_VERSION} -eq 6 || test ${DRUPAL_VERSION} -eq 8 || (test ${DRUPAL_VERSION} -eq 7 && drush help behat)
# Only revert features on Drupal 7.
- test \! ${DRUPAL_VERSION} -eq 7 || drush --yes fr behat_test
# Disable the page cache on Drupal 8.
- test \! ${DRUPAL_VERSION} -ge 8 || drush --yes pmu page_cache
# Test with big_pipe enabled for Drupal 8.
- test \! ${DRUPAL_VERSION} -ge 8 || drush --yes en -y big_pipe
# Clear the cache on Drupal 6 and 7, rebuild on Drupal 8.
- test ${DRUPAL_VERSION} -ge 8 && drush cr || drush cc all || true
- drush --debug runserver :8888 > ~/debug.txt 2>&1 &
- cd -
- sleep 4s
script:
- composer test
- npm test
- vendor/bin/behat -fprogress --strict
- vendor/bin/behat -fprogress --profile=drupal${DRUPAL_VERSION} --strict
# Do not test the Drush profile unless Drupal 7 was installed.
- test ${DRUPAL_VERSION} -ne 7 || vendor/bin/behat -fprogress --profile=drush --strict
after_failure:
- cat ~/debug.txt