forked from WebberZone/contextual-related-posts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
98 lines (85 loc) · 2.55 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
sudo: false
dist: trusty
language: php
notifications:
email:
on_success: never
on_failure: change
branches:
only:
- master
cache:
- composer
- $HOME/.composer/cache
matrix:
fast_finish: true
include:
- php: 7.0
env: SNIFF=1
- php: 7.2
env: WP_VERSION=latest
- php: 7.1
env: WP_VERSION=latest WP_MULTISITE=1
- php: 5.6
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=4.1
- php: 7.2
env: WP_VERSION=trunk
allow_failures:
# Allow failures for unstable builds.
- php: nightly
- env: WP_VERSION=master
- env: SNIFF=1
before_script:
- export PHPCS_DIR=/tmp/phpcs
- export SNIFFS_DIR=/tmp/sniffs
- |
# Export Composer's global bin dir to PATH, but not on PHP 5.2:
composer config --list --global
export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PHPCS_DIR/bin:$PATH"; }`
- |
if [[ ! -z "$WP_VERSION" ]] ; then
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
case "$TRAVIS_PHP_VERSION" in
7.4snapshot|7.3|7.2|7.1|nightly)
echo "Using PHPUnit 7.x"
travis_retry composer global require "phpunit/phpunit:^7"
;;
7.0)
echo "Using PHPUnit 6.x"
travis_retry composer global require "phpunit/phpunit:^6"
;;
5.6)
echo "Using PHPUnit 4.x"
travis_retry composer global require "phpunit/phpunit:^4"
;;
*)
echo "No PHPUnit version handling for PHP version $TRAVIS_PHP_VERSION"
exit 1
;;
esac
fi
- which phpunit
- phpunit --version
- mysql --version
- phpenv versions
- php --version
# Install PHP_CodeSniffer.
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR; fi
# Install WordPress Coding Standards.
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $SNIFFS_DIR; fi
# Set install path for WordPress Coding Standards.
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/bin/phpcs --config-set installed_paths $SNIFFS_DIR; fi
- if [[ "$SNIFF" == "1" ]]; then phpcs -i; fi
# After CodeSniffer install you should refresh your path.
- if [[ "$SNIFF" == "1" ]]; then phpenv rehash; fi
script:
- |
if [[ ! -z "$WP_VERSION" ]] ; then
phpunit
fi
- |
if [[ "$SNIFF" == "1" ]] ; then
$PHPCS_DIR/bin/phpcs -p -v -s --standard=phpcs.ruleset.xml $(find . -name '*.php')
fi