Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.DS_Store
*.map
node_modules
wordpress
vendor
120 changes: 82 additions & 38 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
language: php
dist: trusty

php:
- "5.6"
- "7.2"
- "7.3"
- "7.4"
language: generic

services:
- mysql

env:
- RUN_PHPCS=1 WP_VERSION=latest WP_MULTISITE=0 #Current stable release

# Test WP 5.2 and on PHP 5.6, 7.2, 7.3, and 7.4 (w/ and w/o multisite enabled)
- docker

matrix:
include:
# current stable release w/ multisite
- env: WP_VERSION=latest WP_MULTISITE=1
- php: "5.6"
env: WP_VERSION=latest WP_MULTISITE=0
- php: "7.2"
env: WP_VERSION=latest WP_MULTISITE=0
- php: "7.3"
env: WP_VERSION=latest WP_MULTISITE=0
- php: "7.4"
env: RUN_PHPCS=1 WP_VERSION=latest WP_MULTISITE=0
# Only need to run PHPCS on one test
- php: "7.4"
env: WP_VERSION=latest WP_MULTISITE=1
# n-1 major release
- php: "5.6"
env: WP_VERSION=5.2 WP_MULTISITE=0
Expand All @@ -34,33 +35,76 @@ matrix:
env: WP_VERSION=5.2 WP_MULTISITE=1
# - skip PHP 7.4 and WP 5.2 (not compatible)

env:
global:
- WP_DEVELOP_DIR: ./wordpress
- INSTALL_COMPOSER: true
- INSTALL_WORDPRESS: true
- WP_VERSION: latest
- WP_MULTISITE: 0

before_install:
- nvm install --latest-npm
- |
if [[ "$INSTALL_WORDPRESS" = "true" ]]; then
# Upgrade docker-compose.
sudo rm /usr/local/bin/docker-compose
curl -sL https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > docker-compose
chmod +x docker-compose
sudo mv docker-compose /usr/local/bin
fi

install:
- |
if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then
composer install
fi
# Build Edit Flow.
- npm ci
- npm run build
- |
if [[ "$INSTALL_WORDPRESS" = "true" ]]; then
# Download and unpack WordPress.
curl -sL https://github.com/WordPress/WordPress/archive/master.zip -o /tmp/wordpress-latest.zip
unzip -q /tmp/wordpress-latest.zip -d /tmp
mkdir -p wordpress/src
mv /tmp/WordPress-master/* wordpress/src

before_script:
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
- export COMPOSER_BIN_DIR="$HOME/.config/composer/vendor/bin"
- export PATH="$COMPOSER_BIN_DIR:$PATH"
- |
if [[ ${RUN_PHPCS} == "1" ]]; then
npm install
fi
- |
if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then
composer global require "phpunit/phpunit=5.7.*"
fi
- phpunit --version
- php --version
# Create the upload directory with permissions that Travis can handle.
mkdir -p wordpress/src/wp-content/uploads
chmod 767 wordpress/src/wp-content/uploads

script:
# Grab the tools we need for WordPress' local-env.
curl -sL https://github.com/WordPress/wordpress-develop/archive/master.zip -o /tmp/wordpress-develop.zip
unzip -q /tmp/wordpress-develop.zip -d /tmp
mv \
/tmp/wordpress-develop-master/tools \
/tmp/wordpress-develop-master/tests \
/tmp/wordpress-develop-master/.env \
/tmp/wordpress-develop-master/docker-compose.yml \
/tmp/wordpress-develop-master/wp-cli.yml \
/tmp/wordpress-develop-master/*config-sample.php \
/tmp/wordpress-develop-master/package.json wordpress

# Install WordPress.
cd wordpress
chmod -R 777 .
npm install dotenv wait-on
npm run env:start
sleep 10
npm run env:install
cd ..

# Connect Edit Flow to WordPress.
npm run env connect
npm run env cli plugin activate Edit-Flow
fi
- |
if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]] && [[ ${RUN_PHPCS} == "1" ]]; then
bash bin/phpcs-diff.sh
npm run lint
fi
- phpunit
if [[ "$INSTALL_COMPOSER" = "true" ]]; then
npm run env docker-run -- php composer install
fi

sudo: false
script:
- npm run test-unit-php
- $( npm bin )/wp-scripts test-e2e --config=./tests/e2e/jest.config.js
- |
if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]] && [[ ${RUN_PHPCS} == "1" ]]; then
bash bin/phpcs-diff.sh
npm run lint
fi
13 changes: 13 additions & 0 deletions bin/docker-compose.override.yml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
wordpress-develop:
volumes:
- %PLUGIN_MOUNT_DIR%:/var/www/${LOCAL_DIR-src}/wp-content/plugins/%PLUGIN_INSTALL_DIR%
php:
volumes:
- %PLUGIN_MOUNT_DIR%:/var/www/${LOCAL_DIR-src}/wp-content/plugins/%PLUGIN_INSTALL_DIR%
cli:
volumes:
- %PLUGIN_MOUNT_DIR%:/var/www/${LOCAL_DIR-src}/wp-content/plugins/%PLUGIN_INSTALL_DIR%
phpunit:
volumes:
- %PLUGIN_MOUNT_DIR%:/var/www/${LOCAL_DIR-src}/wp-content/plugins/%PLUGIN_INSTALL_DIR%
Loading