|
| 1 | +sudo: false |
1 | 2 | language: php
|
2 |
| -dist: precise |
3 |
| - |
4 | 3 | php:
|
5 |
| - - 5.2 |
6 |
| - - 5.3 |
| 4 | + - 5.4 |
7 | 5 | - 5.5
|
8 | 6 | - 5.6
|
9 | 7 | - 7.0
|
10 | 8 | - 7.1
|
11 |
| - |
| 9 | + - 7.2 |
12 | 10 | env:
|
13 |
| - - WP_VERSION=latest WP_MULTISITE=0 |
14 |
| - - WP_VERSION=4.5 WP_MULTISITE=0 |
15 |
| - |
| 11 | + - WP_VERSION=latest |
| 12 | + - WP_VERSION=4.5 |
| 13 | +dist: trusty |
16 | 14 | matrix:
|
17 | 15 | include:
|
| 16 | + - php: 5.2 |
| 17 | + env: WP_VERSION=latest |
| 18 | + dist: precise |
| 19 | + - php: 5.2 |
| 20 | + env: WP_VERSION=4.5 |
| 21 | + dist: precise |
| 22 | + - php: 5.3 |
| 23 | + env: WP_VERSION=latest |
| 24 | + dist: precise |
| 25 | + - php: 5.3 |
| 26 | + env: WP_VERSION=4.5 |
| 27 | + dist: precise |
18 | 28 | - php: 5.6
|
19 | 29 | env: WP_VERSION=latest WP_MULTISITE=1
|
20 |
| - allow_failures: |
21 |
| - - php: 5.2 |
| 30 | + - php: 5.6 |
| 31 | + env: WP_VERSION=4.5 WP_MULTISITE=1 |
| 32 | + - php: 7.0 |
| 33 | + env: NPM_TESTS=1 |
22 | 34 |
|
23 | 35 | before_script:
|
24 |
| - - rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install 8 |
25 |
| - - composer install |
26 |
| - - npm install |
27 |
| - - bash tests/bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION |
| 36 | + - | |
| 37 | + stable='^[0-9\.]+$' |
| 38 | + if [[ "$TRAVIS_PHP_VERSION" =~ $stable ]]; then |
| 39 | + if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then |
| 40 | + phpenv config-rm xdebug.ini |
| 41 | + fi |
| 42 | + fi |
| 43 | + - | |
| 44 | + if [[ "$NPM_TESTS" == "1" ]]; then |
| 45 | + rm -rf ~/.nvm |
| 46 | + git clone https://github.com/creationix/nvm.git ~/.nvm |
| 47 | + cd ~/.nvm |
| 48 | + git checkout `git describe --abbrev=0 --tags` |
| 49 | + cd $TRAVIS_BUILD_DIR |
| 50 | + source ~/.nvm/nvm.sh |
| 51 | + nvm install 8 |
| 52 | + npm install |
| 53 | + fi |
28 | 54 | - export PATH="$HOME/.composer/vendor/bin:$PATH"
|
29 | 55 | - |
|
30 |
| - if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then |
31 |
| - composer global require "phpunit/phpunit=5.7.*" |
| 56 | + case "$TRAVIS_PHP_VERSION" in |
| 57 | + 5.6|5.5|5.4|5.3) |
| 58 | + composer global require "phpunit/phpunit:^4" |
| 59 | + ;; |
| 60 | + 5.2) |
| 61 | + ;; |
| 62 | + *) |
| 63 | + composer global require "phpunit/phpunit:^6" |
| 64 | + ;; |
| 65 | + esac |
| 66 | + - | |
| 67 | + if [[ "$TRAVIS_PHP_VERSION" == "5.2" ]]; then |
| 68 | + phpenv global 5.4 |
| 69 | + composer install |
| 70 | + phpenv global "$TRAVIS_PHP_VERSION" |
32 | 71 | else
|
33 |
| - composer global require "phpunit/phpunit=4.8.*" |
| 72 | + composer install |
| 73 | + fi |
| 74 | + - | |
| 75 | + if [[ "$WP_VERSION" == "latest" ]]; then |
| 76 | + curl -s http://api.wordpress.org/core/version-check/1.7/ > /tmp/wp-latest.json |
| 77 | + grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json |
| 78 | + WP_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') |
| 79 | + fi |
| 80 | + - | |
| 81 | + if [[ "$NPM_TESTS" != "1" ]]; then |
| 82 | + PLUGIN_SLUG=$(basename $(pwd)) |
| 83 | + export WP_DEVELOP_DIR=/tmp/wordpress/ |
| 84 | + git clone --depth=50 --branch="$WP_VERSION" git://develop.git.wordpress.org/ /tmp/wordpress |
| 85 | + cd .. |
| 86 | + cp -r "$PLUGIN_SLUG" "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG" |
| 87 | + cd /tmp/wordpress/ |
| 88 | + cp wp-tests-config-sample.php wp-tests-config.php |
| 89 | + sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php |
| 90 | + sed -i "s/yourusernamehere/travis/" wp-tests-config.php |
| 91 | + sed -i "s/yourpasswordhere//" wp-tests-config.php |
| 92 | + mysql -e "CREATE DATABASE wordpress_tests;" -uroot |
| 93 | + cd "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG" |
| 94 | + phpenv rehash |
34 | 95 | fi
|
35 |
| -
|
36 |
| -
|
37 | 96 | script:
|
38 |
| - - phpunit |
39 |
| - - npm test |
| 97 | + - | |
| 98 | + if [[ "$NPM_TESTS" == "1" ]]; then |
| 99 | + npm test |
| 100 | + else |
| 101 | + phpunit |
| 102 | + fi |
0 commit comments