| 1 | | # Travis CI Configuration File |
| 2 | | |
| 3 | | # Use new Travis container-based infrastructure |
| 4 | | # http://docs.travis-ci.com/user/workers/container-based-infrastructure/ |
| 5 | | os: linux |
| 6 | | |
| 7 | | language: php |
| 8 | | |
| 9 | | dist: trusty |
| 10 | | |
| 11 | | cache: |
| 12 | | apt: true |
| 13 | | directories: |
| 14 | | - $HOME/.composer/cache/files |
| 15 | | - $HOME/.npm |
| 16 | | - /tmp/node |
| 17 | | |
| 18 | | git: |
| 19 | | depth: 10 |
| 20 | | |
| 21 | | php: |
| 22 | | - 7.3 |
| 23 | | - 7.2 |
| 24 | | |
| 25 | | # WordPress comes from the Git mirror, where 'master' mirrors svn 'trunk' and |
| 26 | | # x.y mirrors the latest from the x.y branch |
| 27 | | env: |
| 28 | | - WP_VERSION=master BP_TRAVISCI=travis:phpunit |
| 29 | | - WP_VERSION=5.7 BP_TRAVISCI=travis:phpunit |
| 30 | | - WP_VERSION=5.6 BP_TRAVISCI=travis:phpunit |
| 31 | | - WP_VERSION=5.5 BP_TRAVISCI=travis:phpunit |
| 32 | | - WP_VERSION=5.4 BP_TRAVISCI=travis:phpunit |
| 33 | | - WP_VERSION=5.3 BP_TRAVISCI=travis:phpunit |
| 34 | | - WP_VERSION=5.2 BP_TRAVISCI=travis:phpunit |
| 35 | | - WP_VERSION=5.1 BP_TRAVISCI=travis:phpunit |
| 36 | | |
| 37 | | matrix: |
| 38 | | include: |
| 39 | | - php: 7.4 |
| 40 | | env: WP_VERSION=master BP_TRAVISCI=travis:phpunit |
| 41 | | - php: 7.3 |
| 42 | | env: WP_VERSION=master BP_TRAVISCI=travis:grunt |
| 43 | | - php: 7.3 |
| 44 | | env: WP_VERSION=master BP_TRAVISCI=travis:phpcompat |
| 45 | | - php: 5.6 |
| 46 | | env: WP_VERSION=4.9 BP_TRAVISCI=travis:phpunit |
| 47 | | - php: 5.6 |
| 48 | | env: WP_VERSION=5.0 BP_TRAVISCI=travis:phpunit |
| 49 | | |
| 50 | | # before_install: Failures in this section will result in build status 'errored' |
| 51 | | before_install: |
| 52 | | # set up WP install |
| 53 | | - export WP_DEVELOP_DIR=/tmp/wordpress/ |
| 54 | | - mkdir -p $WP_DEVELOP_DIR |
| 55 | | - git clone --depth=1 --branch="$WP_VERSION" git://develop.git.wordpress.org/ $WP_DEVELOP_DIR |
| 56 | | - plugin_slug=$(basename $(pwd)) |
| 57 | | - plugin_dir=$WP_DEVELOP_DIR/src/wp-content/plugins/$plugin_slug |
| 58 | | - cd .. |
| 59 | | - mv $plugin_slug $plugin_dir |
| 60 | | - | |
| 61 | | # Remove Xdebug for a huge performance increase: |
| 62 | | if [[ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]]; then |
| 63 | | phpenv config-rm xdebug.ini |
| 64 | | fi |
| 65 | | |
| 66 | | # set up tests config |
| 67 | | - cd $WP_DEVELOP_DIR |
| 68 | | - echo $WP_DEVELOP_DIR |
| 69 | | - cp wp-tests-config-sample.php wp-tests-config.php |
| 70 | | - sed -i "s/youremptytestdbnamehere/wordpress_test/" wp-tests-config.php |
| 71 | | - sed -i "s/yourusernamehere/root/" wp-tests-config.php |
| 72 | | - sed -i "s/yourpasswordhere//" wp-tests-config.php |
| 73 | | |
| 74 | | # set up database |
| 75 | | - mysql -e 'CREATE DATABASE wordpress_test;' -uroot |
| 76 | | |
| 77 | | # prepare for running the tests |
| 78 | | - cd $plugin_dir |
| 79 | | |
| 80 | | # setup NodeJS version using NVM |
| 81 | | - export PATH="$HOME/.composer/vendor/bin:$PATH" |
| 82 | | - node --version |
| 83 | | - nvm install 14.15.0 |
| 84 | | - node --version |
| 85 | | - npm install -g grunt-cli |
| 86 | | - npm --version |
| 87 | | - mysql --version |
| 88 | | - phpenv versions |
| 89 | | - php --version |
| 90 | | - php -m |
| 91 | | # The installed PHPUnit version does not support PHP 7.2 on trusty dist. |
| 92 | | - if [[ ${TRAVIS_PHP_VERSION:0:3} != "7.2" ]]; then phpunit --version; fi |
| 93 | | - curl --version |
| 94 | | - grunt --version |
| 95 | | - git --version |
| 96 | | - svn --version |
| 97 | | |
| 98 | | # before_script: Failures in this section will result in build status 'errored' |
| 99 | | before_script: |
| 100 | | - mkdir -p /tmp/node/node_modules |
| 101 | | - ln -s /tmp/node/node_modules $plugin_dir/node_modules |
| 102 | | - npm install |
| 103 | | - if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.6" ]]; then composer require --with-all-dependencies phpunit/phpunit:5.7.27; fi |
| 104 | | - if [[ ${TRAVIS_PHP_VERSION:0:3} != "5.6" ]]; then composer install; fi |
| 105 | | |
| 106 | | # Run tests |
| 107 | | script: grunt $BP_TRAVISCI |
| 108 | | |
| 109 | | notifications: |
| 110 | | email: false |
| 111 | | |
| 112 | | irc: |
| 113 | | channels: |
| 114 | | - secure: "Z+gAlyOafrw0Xg294np+7IpqOKTsswGjAWyOZsbzT7Xo8uY1nmz8tTuU50Gpo8jo5HQqG9G0QgI3zB3Cxy3M5dF+J5oLl1lBz1zL0mtHiq1HoXi2cbVnGCCpxtMvYII6UmPUGAg8zvNUQol+cw1jb3PzLwEDfGcDH64o/Z3j8Gg=" |
| 115 | | template: |
| 116 | | - "Build %{build_number} (%{branch} - %{commit}): %{message} %{build_url}" |
| 117 | | slack: |
| 118 | | secure: JQT+HWoVhLzoG00HmJscYZO+Gy7ywnIlrUbCaI7DxFdFOIkKxsTLLq9cKE4y3VqgZAARTOKjP1eQ7a5OEg1vT11Ow+rB7iUAMNmITxXO4feTOx1i2673xRNBro/SZMhlLd7DY2erbMDZaG9hBQB4xLXRYOvP29pLxf5zTSyZMyE= |