-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
122 lines (100 loc) · 4.29 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
115
116
117
118
119
120
121
122
os: linux
language: php
dist: xenial
env:
global:
# Make the script re-usable for other modules.
- MODULE=rules
# Initialise the real SYMFONY_DEPRECATIONS_HELPER variable.
- SYMFONY_DEPRECATIONS_HELPER=0
# Create a default for the allowed deprecations per branch.
- DEPRECATIONS=0
jobs:
fast_finish: true
include:
- php: 7.3
env:
- DRUPAL_CORE=9.1.x
# --- Remaining self deprecation notices (0)
# --- Remaining direct deprecation notices (50)
# 50 Support for keys without a placeholder prefix
- DEPRECATIONS=50
- php: 7.4
env:
- DRUPAL_CORE=9.2.x
# --- Remaining self deprecation notices (0)
# --- Remaining direct deprecation notices (696)
# 134 core/jquery.ui asset library is deprecated in drupal:9.2.0
# 128 core/jquery.ui.widget
# 128 core/jquery.ui.position
# 128 core/jquery.ui.menu
# 128 core/jquery.ui.autocomplete
# 50 Support for keys without a placeholder prefix
- DEPRECATIONS=696
services:
- mysql
# 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
# Save the current $MODULE test directory for use in the Drupal installation.
- TESTDIR=$(pwd)
# Navigate out 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 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
# Reference $MODULE in build site.
- ln -s $TESTDIR modules/$MODULE
# Install dependencies.
- travis_retry git clone --branch 8.x-1.x --depth 1 https://git.drupalcode.org/project/typed_data.git modules/typed_data
# At job start-up Composer is installed at 1.8.4 then self-update is run. From
# 24 October 2020 this bumped the version to Composer 2. Drupal Core 8.8 has
# plugins that only run with composer-plugin-api ^1.0 so revert to Composer 1.
- if [ "$DRUPAL_CORE" == "8.8.x" ]; then
travis_retry composer self-update --1;
fi
- travis_retry composer install
# Set the phpcs 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
# Get the allowed number of deprecation warnings for this branch.
- SYMFONY_DEPRECATIONS_HELPER=$DEPRECATIONS || $SYMFONY_DEPRECATIONS_HELPER
- echo $SYMFONY_DEPRECATIONS_HELPER
script:
# Run the PHPUnit tests which also include the kernel tests.
- cd $DRUPAL_ROOT;
- ./vendor/bin/phpunit -c ./core/phpunit.xml.dist ./modules/$MODULE/tests/
# Check for coding standards. First show the Coder, Codesniffer and phpcs versions.
- composer show drupal/coder | egrep 'name |vers'
- composer show squizlabs/php_codesniffer | egrep 'name |vers'
- $DRUPAL_ROOT/vendor/bin/phpcs --version
# Change into $MODULE directory to avoid having to add --standard=$DRUPAL_ROOT/modules/$MODULE/phpcs.xml.dist
- cd $DRUPAL_ROOT/modules/$MODULE
# List all the sniffs that are used.
- $DRUPAL_ROOT/vendor/bin/phpcs -i
- $DRUPAL_ROOT/vendor/bin/phpcs -e
# Show the errors and warnings in detail, in summary and by source sniff.
# Do not fail for 9.1.x or 9.2.x as there are known errors.
- |
if [[ "$DRUPAL_CORE" == "9.1.x" || "$DRUPAL_CORE" == "9.2.x" ]]; then
$DRUPAL_ROOT/vendor/bin/phpcs . --report-width=100 --report-full --report-summary --report-source -s --runtime-set ignore_warnings_on_exit 1 --runtime-set ignore_errors_on_exit 1
else
$DRUPAL_ROOT/vendor/bin/phpcs . --report-width=100 --report-full --report-summary --report-source -s
fi