1- language : php
1+ dist : trusty
22
3- php :
4- - " 5.6"
5- - " 7.2"
6- - " 7.3"
7- - " 7.4"
3+ language : generic
84
95services :
10- - mysql
11-
12- env :
13- - RUN_PHPCS=1 WP_VERSION=latest WP_MULTISITE=0 # Current stable release
14-
15- # Test WP 5.2 and on PHP 5.6, 7.2, 7.3, and 7.4 (w/ and w/o multisite enabled)
6+ - docker
167
178matrix :
189 include :
1910 # current stable release w/ multisite
20- - env : WP_VERSION=latest WP_MULTISITE=1
11+ - php : " 5.6"
12+ env : WP_VERSION=latest WP_MULTISITE=0
13+ - php : " 7.2"
14+ env : WP_VERSION=latest WP_MULTISITE=0
15+ - php : " 7.3"
16+ env : WP_VERSION=latest WP_MULTISITE=0
17+ - php : " 7.4"
18+ env : RUN_PHPCS=1 WP_VERSION=latest WP_MULTISITE=0
19+ # Only need to run PHPCS on one test
20+ - php : " 7.4"
21+ env : WP_VERSION=latest WP_MULTISITE=1
2122 # n-1 major release
2223 - php : " 5.6"
2324 env : WP_VERSION=5.2 WP_MULTISITE=0
@@ -34,33 +35,76 @@ matrix:
3435 env : WP_VERSION=5.2 WP_MULTISITE=1
3536 # - skip PHP 7.4 and WP 5.2 (not compatible)
3637
38+ env :
39+ global :
40+ - WP_DEVELOP_DIR : ./wordpress
41+ - INSTALL_COMPOSER : true
42+ - INSTALL_WORDPRESS : true
43+ - WP_VERSION : latest
44+ - WP_MULTISITE : 0
45+
46+ before_install :
47+ - nvm install --latest-npm
48+ - |
49+ if [[ "$INSTALL_WORDPRESS" = "true" ]]; then
50+ # Upgrade docker-compose.
51+ sudo rm /usr/local/bin/docker-compose
52+ curl -sL https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > docker-compose
53+ chmod +x docker-compose
54+ sudo mv docker-compose /usr/local/bin
55+ fi
56+
3757install :
38- - |
39- if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then
40- composer install
41- fi
58+ # Build Edit Flow.
59+ - npm ci
60+ - npm run build
61+ - |
62+ if [[ "$INSTALL_WORDPRESS" = "true" ]]; then
63+ # Download and unpack WordPress.
64+ curl -sL https://github.com/WordPress/WordPress/archive/master.zip -o /tmp/wordpress-latest.zip
65+ unzip -q /tmp/wordpress-latest.zip -d /tmp
66+ mkdir -p wordpress/src
67+ mv /tmp/WordPress-master/* wordpress/src
4268
43- before_script :
44- - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
45- - export COMPOSER_BIN_DIR="$HOME/.config/composer/vendor/bin"
46- - export PATH="$COMPOSER_BIN_DIR:$PATH"
47- - |
48- if [[ ${RUN_PHPCS} == "1" ]]; then
49- npm install
50- fi
51- - |
52- if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then
53- composer global require "phpunit/phpunit=5.7.*"
54- fi
55- - phpunit --version
56- - php --version
69+ # Create the upload directory with permissions that Travis can handle.
70+ mkdir -p wordpress/src/wp-content/uploads
71+ chmod 767 wordpress/src/wp-content/uploads
5772
58- script :
73+ # Grab the tools we need for WordPress' local-env.
74+ curl -sL https://github.com/WordPress/wordpress-develop/archive/master.zip -o /tmp/wordpress-develop.zip
75+ unzip -q /tmp/wordpress-develop.zip -d /tmp
76+ mv \
77+ /tmp/wordpress-develop-master/tools \
78+ /tmp/wordpress-develop-master/tests \
79+ /tmp/wordpress-develop-master/.env \
80+ /tmp/wordpress-develop-master/docker-compose.yml \
81+ /tmp/wordpress-develop-master/wp-cli.yml \
82+ /tmp/wordpress-develop-master/*config-sample.php \
83+ /tmp/wordpress-develop-master/package.json wordpress
84+
85+ # Install WordPress.
86+ cd wordpress
87+ chmod -R 777 .
88+ npm install dotenv wait-on
89+ npm run env:start
90+ sleep 10
91+ npm run env:install
92+ cd ..
93+
94+ # Connect Edit Flow to WordPress.
95+ npm run env connect
96+ npm run env cli plugin activate Edit-Flow
97+ fi
5998 - |
60- if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]] && [[ ${RUN_PHPCS} == "1" ]]; then
61- bash bin/phpcs-diff.sh
62- npm run lint
63- fi
64- - phpunit
99+ if [[ "$INSTALL_COMPOSER" = "true" ]]; then
100+ npm run env docker-run -- php composer install
101+ fi
65102
66- sudo : false
103+ script :
104+ - npm run test-unit-php
105+ - $( npm bin )/wp-scripts test-e2e --config=./tests/e2e/jest.config.js
106+ - |
107+ if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]] && [[ ${RUN_PHPCS} == "1" ]]; then
108+ bash bin/phpcs-diff.sh
109+ npm run lint
110+ fi
0 commit comments