-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
114 lines (85 loc) · 3.4 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# @file
# .travis.yml - Drupal 8 Travis CI Integration
language: php
dist: trusty
sudo: required
group: edge
services:
- mysql
php:
- '7.4'
- '8.0'
env:
global:
- MODULE_NAME='date_time_day'
- DRUPAL_REPO='https://git.drupalcode.org/project/drupal.git'
- DRUPAL_VERSION='9.5.x'
- DRUSH_VERSION='10.1.*'
# Cache Composer & Drush directories.
cache:
bundler: true
apt: true
directories:
- "$HOME/.composer/cache"
- "$HOME/.drush/cache"
mysql:
database: drupal
username: root
encoding: utf8
before_install:
# Disable xdebug.
- phpenv config-rm xdebug.ini
# Composer.
- sed -i '1i export PATH="$HOME/.composer/vendor/bin:$PATH"' $HOME/.bashrc
- source $HOME/.bashrc
- composer self-update 1.9.0
# Drush.
- composer global require drush/drush:$DRUSH_VERSION
# Ensure the PHP environment is ready.
- phpenv rehash
install:
- git clone --branch $DRUPAL_VERSION $DRUPAL_REPO drupal --depth 1
- cd drupal && composer install && cd -
- mkdir -p drupal/modules/$MODULE_NAME
# Coder.
- $TRAVIS_BUILD_DIR/drupal/vendor/bin/phpcs --config-set installed_paths ./vendor/drupal/coder/coder_sniffer
- $TRAVIS_BUILD_DIR/drupal/vendor/bin/phpcs -i
# switched to doing it this way because it makes local testing a bit easier.
# create symbolic links to all of the files/folders in the module directory
- for d in $(pwd)/*; do ln -s "$d" "drupal/modules/$MODULE_NAME"; done
# remove the recursive drupal folder from the symlinks
- rm -f drupal/modules/$MODULE_NAME/drupal
- cd drupal
before_script:
# This fixes a fail when install Drupal.
- echo 'sendmail_path = /bin/true' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
# Mysql might time out for long tests, increase the wait timeout.
- mysql -e "SET @@GLOBAL.wait_timeout=1200"
# Install Drupal and enable the required modules (including this one).
- mysql -e "create database drupal;"
- cd $TRAVIS_BUILD_DIR/drupal && drush --yes site-install standard --db-url="mysql://root@127.0.0.1/drupal"
# Dependency Modules
- cd $TRAVIS_BUILD_DIR/drupal && drush --yes en $MODULE_NAME
- cd $TRAVIS_BUILD_DIR/drupal && drush --yes en simpletest
# Export web server URL for browser tests.
- export SIMPLETEST_BASE_URL=http://localhost:8080
# Export database variable for kernel tests.
- export SIMPLETEST_DB=mysql://root:@127.0.0.1/drupal
script:
# Start a web server.
- cd $TRAVIS_BUILD_DIR/drupal
- drush runserver 127.0.0.1:8080 &
# Run code sniffer.
# Warnings are disabled until the SMS notifier is ported.
- $TRAVIS_BUILD_DIR/drupal/vendor/bin/phpcs --report=full --standard=$TRAVIS_BUILD_DIR/drupal/vendor/drupal/coder/coder_sniffer/Drupal/ruleset.xml --warning-severity=0 $TRAVIS_BUILD_DIR/drupal/modules/$MODULE_NAME --ignore=bin,*.css,gulpfile.js,libraries,modules/contrib,vendor
# Drupal "SimpleTests" via run-tests.sh
- cd $TRAVIS_BUILD_DIR/drupal
- composer run-script drupal-phpunit-upgrade
- php core/scripts/run-tests.sh --verbose --color --module $MODULE_NAME --php $(which php) --url http://127.0.0.1:8080
# PHP Unit Tests
# - cd $TRAVIS_BUILD_DIR/drupal
# - phpunit -c core/phpunit.xml.dist modules/$MODULE_NAME --debug --testdox
# Behat Tests - RUN THESE LAST OTHERWISE PHPUNIT WILL FAIL BECAUSE OF DEPENDENCY CONFLICTS
# - cd $TRAVIS_BUILD_DIR/drupal/modules/$MODULE_NAME
# - composer install
# - vendor/bin/behat --config tests/behat/behat.yml