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