forked from Yoast/wordpress-seo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
121 lines (111 loc) · 4.63 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
language: php
dist: trusty
sudo: false
branches:
only:
- master
- trunk
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
jobs:
fast_finish: true
include:
- php: 7.0
env: WP_VERSION=4.8 WP_MULTISITE=1 PHPLINT=1 PHPCS=1 CHECKJS=1 COVERAGE=1 TRAVIS_NODE_VERSION=node CXX=g++-4.8
- 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.7 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.6
- php: 5.6
env: WP_VERSION=4.6
# WP >= 4.8 is needed for PHP 7.1
- php: 7.1
env: WP_VERSION=4.8
- 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
before_install:
- if [[ "$CHECKJS" == "1" ]]; then nvm install $TRAVIS_NODE_VERSION; fi
- if [[ "$CHECKJS" == "1" ]]; then curl -o- -L https://yarnpkg.com/install.sh | bash; fi
- if [[ "$CHECKJS" == "1" ]]; then 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
- composer selfupdate 1.0.0 --no-interaction
- 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; fi
- if [[ "$CHECKJS" == "1" ]]; then 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
script:
- if [[ "$PHPLINT" == "1" ]]; then find -L . -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l; fi
- if [[ "$PHPCS" == "1" ]]; then vendor/bin/phpcs -v --runtime-set ignore_warnings_on_exit 1; fi
- if [[ "$CHECKJS" == "1" ]]; then grunt check:js; fi
- if [[ -z "$CODECLIMATE_REPO_TOKEN" ]]; then COVERAGE="0"; fi
- if [[ "$COVERAGE" != "1" ]] && [[ ${TRAVIS_PHP_VERSION:0:1} == "5" || $TRAVIS_PHP_VERSION == hhv* ]]; then phpunit -c phpunit.xml; fi
- if [[ "$COVERAGE" != "1" ]] && [[ ${TRAVIS_PHP_VERSION:0:1} == "7" || $TRAVIS_PHP_VERSION == "nightly" ]]; then phpunit -c phpunit.xml; 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 vendor/bin/phpunit -c phpunit.xml --coverage-clover build/logs/clover.xml; fi
- if [[ "$CHECKJS" == "1" ]]; then yarn test; fi
after_success:
- if [[ "$COVERAGE" == "1" ]]; then vendor/bin/test-reporter; fi
notifications:
slack:
secure: W3StABr+AdcdQawTObK4nbsnn5nLrTTtZfVpD/GEN6gvSOQcykbGEC5+ceYg0jn5b4StDyCiTo5blEsrpVICFpYKc44+ogah+qaGRUfVRS/rpOvn4AueXTWn4JxhZzuxqKMiTmyW+MQG0uYM7sk7Q5S+15jj6ilkj4QATaBVNbY=
email: false