forked from Yoast/wordpress-seo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
189 lines (180 loc) · 6.21 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
language: php
dist: trusty
sudo: false
branches:
only:
- master
- trunk
- /^release\/\d+\.\d+(\.\d+)?(-\S*)?$/
- /^hotfix\/\d+\.\d+(\.\d+)?(-\S*)?$/
jobs:
fast_finish: true
include:
- php: 7.2
env: WP_VERSION=4.9 WP_MULTISITE=1 PHPLINT=1 PHPCS=1 CHECKJS=1 TRAVIS_NODE_VERSION=node
- php: 7.2
env: WP_VERSION=4.9 WP_MULTISITE=1 COVERAGE=1
- php: 5.2
# As 'trusty' is not supporting PHP 5.2/5.3 anymore, we need to force using 'precise'.
dist: precise
env: WP_VERSION=4.8 WP_MULTISITE=1 PHPLINT=1
- php: 5.3
# As 'trusty' is not supporting PHP 5.2/5.3 anymore, we need to force using 'precise'.
dist: precise
env: WP_VERSION=4.9
- php: 5.6
env: WP_VERSION=4.9
# WP >= 4.8 is needed for PHP 7.1
- php: 7.0
env: WP_VERSION=4.9
- php: 5.2
# As 'trusty' is not supporting PHP 5.2/5.3 anymore, we need to force using 'precise'.
dist: precise
env: WP_VERSION=master
- php: nightly
env: WP_VERSION=master
- stage: 🚀 deployment
if: branch = deploy # Only build when on the `deploy` branch, this functionality is not used yet and is taking a long time to complete.
before_script: skip
script: grunt artifact
before_install: skip
install:
- yarn global add grunt-cli
- yarn install
deploy:
skip_cleanup: true
provider: s3
access_key_id: AKIAJRNLQAPRL5UKDJKQ
secret_access_key:
secure: TE13B5MDyw16DxEIRpbXPtxb1LZAzi8jdCU4FZuTzNsdVaowlAXUEFFB+g8uapoQhJKqvZrwvrpqifRPhH0tcRlJ5Z0A+qWp8WhiFGmipp3gJBblacviAIvswGzKFN8+DgQVwHSKpzk3ZjEkDkH/KYq6OTYPL/g5oRwsjI0Ug9w=
bucket: yoast-seo-builds
region: us-east-1
local-dir: artifact
upload-dir: $TRAVIS_BRANCH
on:
repo: Yoast/wordpress-seo
all_branches: true
allow_failures:
# Allow failures for unstable builds.
- php: nightly
- env: WP_VERSION=master
cache:
yarn: true
directories:
- vendor
- $HOME/.composer/cache
- node_modules
before_install:
- PHPUNIT_BIN="phpunit"
- if [[ ${TRAVIS_PHP_VERSION:0:1} == "7" || $TRAVIS_PHP_VERSION == "nightly" ]]; then PHPUNIT_BIN="vendor/bin/phpunit"; fi
- if [[ -z "$CC_TEST_REPORTER_ID" ]]; then COVERAGE="0"; fi
- if [[ "$COVERAGE" != "1" ]]; then phpenv config-rm xdebug.ini || echo 'No xdebug config.'; fi
- |
if [[ "$CHECKJS" == "1" ]]; then
nvm install $TRAVIS_NODE_VERSION
curl -o- -L https://yarnpkg.com/install.sh | bash
export PATH=$HOME/.yarn/bin:$PATH
fi
install:
- if [[ $TRAVIS_PHP_VERSION == "5.2" || $TRAVIS_PHP_VERSION == "5.3" ]]; then phpenv local 5.6.13; fi
- if [[ ${TRAVIS_PHP_VERSION:0:1} == "7" || $TRAVIS_PHP_VERSION == "nightly" ]]; then composer require --dev phpunit/phpunit ^5.7; fi
- composer install --no-interaction
- composer config-yoastcs
- if [[ $TRAVIS_PHP_VERSION == "5.2" || $TRAVIS_PHP_VERSION == "5.3" ]]; then phpenv local --unset; fi
- |
if [[ "$CHECKJS" == "1" ]]; then
yarn global add grunt-cli
yarn install
fi
before_script:
- PLUGIN_SLUG=$(basename $(pwd))
- export WP_DEVELOP_DIR=/tmp/wordpress/
- git clone --depth=50 --branch="$WP_VERSION" git://develop.git.wordpress.org/ /tmp/wordpress
- cd ..
- cp -r "$PLUGIN_SLUG" "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG"
- cd /tmp/wordpress/
- cp wp-tests-config-sample.php wp-tests-config.php
- sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
- sed -i "s/yourusernamehere/travis/" wp-tests-config.php
- sed -i "s/yourpasswordhere//" wp-tests-config.php
- mysql -e "CREATE DATABASE wordpress_tests;" -uroot
- cd "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG"
- phpenv rehash
- |
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
- export -f travis_fold
- export -f travis_time_start
- export -f travis_time_finish
- mysql --version
- phpenv versions
- php --version
- php -m
- $PHPUNIT_BIN --version
- curl --version
- git --version
- svn --version
- |
if [[ "$CHECKJS" == "1" ]]; then
npm --version
node --version
yarn --version
grunt --version
fi
- locale -a
script:
# JavaScript checks
- |
if [[ "$CHECKJS" == "1" ]]; then
travis_fold start "JavaScript.check" && travis_time_start
grunt check:js
travis_time_finish && travis_fold end "JavaScript.check"
fi
# JavaScript tests
- |
if [[ "$CHECKJS" == "1" ]]; then
travis_fold start "JavaScript.tests" && travis_time_start
yarn test
travis_time_finish && travis_fold end "JavaScript.tests"
fi
# PHP Linting
- |
if [[ "$PHPLINT" == "1" ]]; then
travis_fold start "PHP.check" && travis_time_start
find -L . -path ./vendor -prune -o -path ./node_modules -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
travis_time_finish && travis_fold end "PHP.check"
fi
# PHP CS
- |
if [[ "$PHPCS" == "1" ]]; then
travis_fold start "PHP.code-style" && travis_time_start
vendor/bin/phpcs -q --runtime-set ignore_warnings_on_exit 1
travis_time_finish && travis_fold end "PHP.code-style"
fi
# PHP Unit
- |
if [[ "$COVERAGE" != "1" ]]; then
travis_fold start "PHP.tests" && travis_time_start
$PHPUNIT_BIN -c phpunit.xml
travis_time_finish && travis_fold end "PHP.tests"
fi;
# Coverage environment variable is only set on the PHP 7 build, so we can safely
# assume that PHPUnit is in the vendor directory.
- |
if [[ "$COVERAGE" == "1" ]]; then
travis_fold start "PHP.coverage" && travis_time_start
$PHPUNIT_BIN -c phpunit.xml --coverage-clover build/logs/clover.xml
travis_time_finish && travis_fold end "PHP.coverage"
fi
# Validate the composer.json file.
# @link https://getcomposer.org/doc/03-cli.md#validate
- if [[ $TRAVIS_PHP_VERSION == "5.3" || $TRAVIS_PHP_VERSION == "7.2" ]]; then composer validate --no-check-all; fi
after_script:
- if [[ "$COVERAGE" == "1" ]]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
notifications:
slack:
secure: W3StABr+AdcdQawTObK4nbsnn5nLrTTtZfVpD/GEN6gvSOQcykbGEC5+ceYg0jn5b4StDyCiTo5blEsrpVICFpYKc44+ogah+qaGRUfVRS/rpOvn4AueXTWn4JxhZzuxqKMiTmyW+MQG0uYM7sk7Q5S+15jj6ilkj4QATaBVNbY=
email: false