Travis: Updating travis.yml

This commit is contained in:
Renato Alves 2017-11-10 15:05:08 -03:00
parent 67e0917d32
commit 98c3b4880e
3 changed files with 52 additions and 44 deletions

View file

@ -1,4 +1,5 @@
sudo: false
dist: trusty

language: php

@ -11,25 +12,49 @@ branches:
only:
- master

php:
- 7.1
- 7.0
- 5.6
- 5.3

cache:
- composer
- $HOME/.composer/cache
directories:
- vendor
- $HOME/.composer/cache

env:
global:
- WP_CLI_BIN_DIR=/tmp/wp-cli-phar
matrix:
- WP_VERSION=latest
- WP_VERSION=trunk
- PATH="$TRAVIS_BUILD_DIR/vendor/bin:$PATH"
- WP_CLI_BIN_DIR="$TRAVIS_BUILD_DIR/vendor/bin"

matrix:
include:
- php: 7.1
env: WP_VERSION=latest
- php: 7.0
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=4.4
- php: 5.6
env: WP_VERSION=trunk
- php: 5.3
dist: precise
env: WP_VERSION=latest

before_install:
- |
# Remove Xdebug for a huge performance increase:
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
phpenv config-rm xdebug.ini
else
echo "xdebug.ini does not exist"
fi

install:
- composer install
- bash bin/install-package-tests.sh
- export BBP_SRC_DIR=/tmp/bp-src/
- svn co --ignore-externals https://bbpress.svn.wordpress.org/trunk/src $BBP_SRC_DIR

before_script:
- composer validate
- bash bin/install-package-tests.sh

script: ./vendor/bin/behat --strict
script:
- bash bin/test.sh

View file

@ -2,39 +2,9 @@

set -ex

WP_CLI_BIN_DIR=${WP_CLI_BIN_DIR-/tmp/wp-cli-phar}

PACKAGE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../ && pwd )"

download() {
if [ `which curl` ]; then
curl -s "$1" > "$2";
elif [ `which wget` ]; then
wget -nv -O "$2" "$1"
fi
}

install_wp_cli() {

# the Behat test suite will pick up the executable found in $WP_CLI_BIN_DIR
mkdir -p $WP_CLI_BIN_DIR
download https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar $WP_CLI_BIN_DIR/wp
chmod +x $WP_CLI_BIN_DIR/wp

}

download_behat() {

cd $PACKAGE_DIR
composer require --dev behat/behat='~2.5'

}

install_db() {
mysql -e 'CREATE DATABASE IF NOT EXISTS wp_cli_test;' -uroot
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"localhost" IDENTIFIED BY "password1"' -uroot
}

install_wp_cli
download_behat
install_db

13
bin/test.sh Normal file
View file

@ -0,0 +1,13 @@
#!/bin/bash

set -ex

# Run the unit tests, if they exist
if [ -f "phpunit.xml" ] || [ -f "phpunit.xml.dist" ]
then
phpunit
fi

# Run the functional tests
BEHAT_TAGS=$(php utils/behat-tags.php)
vendor/behat/behat/bin/behat --format progress $BEHAT_TAGS --strict