-
Notifications
You must be signed in to change notification settings - Fork 14
/
.travis.yml
110 lines (87 loc) · 3.62 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
language: php
# The Travis CI container mode has random functional test fails, so we must use
# sudo here.
sudo: true
php:
# - 5.6
- 7.1
- 7.2
- 7.3
services:
- mysql
env:
global:
- MODULE=custom
matrix:
#- DRUPAL_CORE=8.7.x
#- DRUPAL_CORE=8.8.x
- DRUPAL_CORE=8.9.x
matrix:
fast_finish: true
# Start using PHP7.3 with Core 8.8 not before.
# Core 8.8+ no longer supports PHP5.
exclude:
#- php: 7.3
#env: DRUPAL_CORE=8.7.x
#- php: 5.6
#env: DRUPAL_CORE=8.8.x
- php: 5.6
env: DRUPAL_CORE=8.9.x
# Be sure to cache composer downloads.
cache:
directories:
- $HOME/.composer
before_script:
- echo $MODULE
# Remove Xdebug as we don't need it and it causes
# PHP Fatal error: Maximum function nesting level of '256' reached.
# We also don't care if that file exists or not on PHP 7.
- phpenv config-rm xdebug.ini || true
# Navigate out of module directory to prevent blown stack by recursive module
# lookup.
- cd ..
# Create database.
- mysql -e "create database $MODULE"
# Export database variable for kernel tests.
- export SIMPLETEST_DB=mysql://root:@127.0.0.1/$MODULE
# Download Drupal 8 core from the Github mirror because it is faster.
- travis_retry git clone --branch $DRUPAL_CORE --depth 1 https://github.com/drupal/drupal.git
- cd drupal
# Store the path to Drupal root.
- DRUPAL_ROOT=$(pwd)
- echo $DRUPAL_ROOT
# Make a directory for our module and copy the built source into it.
- mkdir $DRUPAL_ROOT/modules/$MODULE
- cp -R $TRAVIS_BUILD_DIR/* $DRUPAL_ROOT/modules/$MODULE/
# Run composer self-update and install.
- travis_retry composer self-update && travis_retry composer install
# If running Core 8.6 or 8.7 the following script will upgrade to phpunit 6
# which is required in PHP7. The script has now been deleted from Core 8.8.
- if [[ $DRUPAL_CORE == "8.6.x" || $DRUPAL_CORE == "8.7.x" ]]; then
travis_retry composer run-script drupal-phpunit-upgrade;
fi
# Run composer update in the module directory in order to fetch dependencies.
- travis_retry composer update -d $DRUPAL_ROOT/modules/$MODULE
# Install drush
- travis_retry composer require drush/drush:^9.0
# Coder is already installed as part of composer install. We just need to set
# the installed_paths to pick up the Drupal standards.
- $DRUPAL_ROOT/vendor/bin/phpcs --config-set installed_paths $DRUPAL_ROOT/vendor/drupal/coder/coder_sniffer
# Start a web server on port 8888, run in the background.
- php -S localhost:8888 &
# Export web server URL for browser tests.
- export SIMPLETEST_BASE_URL=http://localhost:8888
script:
# Run the PHPUnit tests.
- ./vendor/bin/phpunit -c ./core/phpunit.xml.dist --verbose --group=devel,devel-generate,devel_generate,webprofiler ./modules/$MODULE
# Check for coding standards. First change directory to our module.
- cd $DRUPAL_ROOT/modules/$MODULE
# List all the sniffs that were used.
- $DRUPAL_ROOT/vendor/bin/phpcs --version
- $DRUPAL_ROOT/vendor/bin/phpcs -i
- $DRUPAL_ROOT/vendor/bin/phpcs -e
- $DRUPAL_ROOT/vendor/bin/phpcs --standard=drupal,drupalPractice -e
# Show the violations in detail and do not fail for any errors or warnings.
- $DRUPAL_ROOT/vendor/bin/phpcs --standard=drupal,drupalPractice --ignore=vendor --report-width=130 --colors --runtime-set ignore_warnings_on_exit 1 --runtime-set ignore_errors_on_exit 1 .
# Run again to give a summary and total count.
- $DRUPAL_ROOT/vendor/bin/phpcs --standard=drupal,drupalPractice --ignore=vendor --report-width=130 --colors --runtime-set ignore_warnings_on_exit 1 --runtime-set ignore_errors_on_exit 1 --report=summary .