-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
135 lines (124 loc) · 4.3 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
123
124
125
126
127
128
129
130
131
132
133
134
135
dist: trusty
sudo: false
language: php
addons:
apt:
packages:
- libxml2-utils
env:
global:
- CC_TEST_REPORTER_ID=75aaef18e38b7ef45eb3268c76129b80e9168129af63fbfb2838c4c3686f251c
- COMPOSER_NO_INTERACTION=1
- WP_VERSION=*
jobs:
include:
# WordPress and PHP 7.4: https://make.wordpress.org/core/2019/10/11/wordpress-and-php-7-4/.
- php: 7.4
env: WP_VERSION=5.3.* COVERAGE=1 PHPCS=1 PSALM=1 PHPSTAN=1 ESLINT=1 SASS_LINT=1
# WordPress 5.2 (or lower) will trigger PHP 7.4 (or higher) errors.
# @link https://make.wordpress.org/core/2019/10/11/wordpress-and-php-7-4/.
- php: 7.3
env: WP_VERSION=5.2.*
- php: 7.3
env: WP_VERSION=5.1.*
- php: 7.3
env: WP_VERSION=5.0.*
# WordPress 4.9 (or lower) will trigger PHP 7.3 (or higher) errors.
# @link https://core.trac.wordpress.org/ticket/44416
- php: 7.2
env: WP_VERSION=4.9.*
# WordPress 4.8 (or lower) will trigger PHP 7.2 (or higher) errors.
# @link https://make.wordpress.org/core/2018/10/15/wordpress-and-php-7-3/
# @link https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/
# @link https://make.wordpress.org/core/tag/4-9/?s=7.2
- php: 7.1
env: WP_VERSION=4.8.*
- php: 7.1
env: WP_VERSION=4.7.*
- php: 7.4
env: WP_MULTISITE=1
- php: 7.4
env: PHPMD=1
- php: 7.3
- php: 7.2
- php: 7.1
- php: 7.0
- php: 5.6
- php: nightly
allow_failures:
- php: nightly
- env: PHPMD=1
cache:
npm: true
directories:
- vendor
- $HOME/.composer/cache
before_install:
# Create database for PHPUnit tests.
- mysql -e 'CREATE DATABASE wp_phpunit_tests;'
# Remove Xdebug for a huge performance increase:
- |
if [[ "$COVERAGE" != "1" && -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]]; then
phpenv config-rm xdebug.ini
fi
# Set Xdebug mode for coverage.
- export XDEBUG_MODE=coverage
# Raise PHP memory limit to 2048MB
- echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
# Validate composer.json file.
- composer validate --strict
# Add Composer global vendor/bin to path.
- export PATH="$HOME/.composer/vendor/bin:$PATH"
# Maybe remove PHPCS import detection package.
- if [ "$PHPCS" != "1" ]; then composer remove sirbrillig/phpcs-import-detection --dev --no-update; fi
# Symfony Security Check
- |
if [ "$SYMFONY_SECURITY_CHECK" == "1" ]; then
curl -sS https://get.symfony.com/cli/installer | bash
export PATH="$HOME/.symfony/bin:$PATH"
fi
install:
# Install Grunt command line interface (https://github.com/gruntjs/grunt-cli).
- npm install -g grunt-cli
# Install Node.js packages.
- npm install
# Update Composer itself to the latest version (https://getcomposer.org/doc/03-cli.md#self-update-selfupdate-).
- composer self-update
# Install Composer packages.
- composer install
# PHPStan
- if [ "$PHPSTAN" == "1" ]; then composer bin phpstan install; fi
# Psalm
- if [ "$PSALM" == "1" ]; then composer bin psalm install; fi
# Test on specific WordPress version.
- composer require --dev --update-with-dependencies roots/wordpress:${WP_VERSION} wp-phpunit/wp-phpunit:${WP_VERSION}
# List available packages.
- composer show
before_script:
- |
if [ "$COVERAGE" == "1" ]; then
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
fi
script:
# PHPLint
- composer run-script phplint
# PHPUnit
- composer run-script phpunit
# PHP_CodeSniffer
- if [ "$PHPCS" == "1" ]; then composer run-script phpcs; fi
# PHP Mess Detector
- if [ "$PHPMD" == "1" ]; then composer run-script phpmd; fi
# PHPStan
- if [ "$PHPSTAN" == "1" ]; then composer run-script phpstan; fi
# Psalm
- if [ "$PSALM" == "1" ]; then composer run-script psalm; fi
# Symfony Security Check
- if [ "$SYMFONY_SECURITY_CHECK" == "1" ]; then symfony security:check; fi
# xmllint
- composer run-script xmllint
after_success:
- if [ "$COVERAGE" == "1" ]; then composer run-script coveralls; fi
- if [ "$COVERAGE" == "1" ]; then bash <(curl -s https://codecov.io/bash); fi
- if [ "$COVERAGE" == "1" ]; then ./cc-test-reporter upload-coverage; fi