diff --git a/.travis.yml b/.travis.yml index fa5c13424..4a4bcb2a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,9 @@ branches: cache: - composer - - $HOME/.composer/cache + - directories: + - $HOME/.composer/cache + - $HOME/opt/$TRAVIS_PHP_VERSION env: global: @@ -35,7 +37,7 @@ matrix: before_install: - phpenv config-rm xdebug.ini - - if [[ $TRAVIS_PHP_VERSION = '5.6' ]]; then printf "\n" | pecl install imagick; fi + - ./bin/install-imagick.sh - php -m install: diff --git a/bin/install-imagick.sh b/bin/install-imagick.sh new file mode 100755 index 000000000..9022da287 --- /dev/null +++ b/bin/install-imagick.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +set -ex + +# Install imagick for PHP 5.6, 7.0 and 7.1. +# Taken from http://stackoverflow.com/a/41138688/664741 + +# ImageMagick version to use for PHP 7.x +IMAGEMAGICK_VERSION='6.9.8-3' + +install_imagemagick() { + cd /tmp + + curl -O https://www.imagemagick.org/download/ImageMagick-$IMAGEMAGICK_VERSION.tar.gz + tar xzf ImageMagick-$IMAGEMAGICK_VERSION.tar.gz + cd ImageMagick-$IMAGEMAGICK_VERSION + + ./configure --prefix=$HOME/opt/$TRAVIS_PHP_VERSION + make + make install + + cd $TRAVIS_BUILD_DIR +} + +if [[ ${TRAVIS_PHP_VERSION:0:2} == '7.' ]]; then + + PATH=$HOME/opt/$TRAVIS_PHP_VERSION/bin:$PATH convert -v | grep $IMAGEMAGICK_VERSION || install_imagemagick + + ls $HOME/opt/$TRAVIS_PHP_VERSION + + export LD_FLAGS=-L$HOME/opt/$TRAVIS_PHP_VERSION/lib + export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:$HOME/opt/$TRAVIS_PHP_VERSION/lib + export CPATH=$CPATH:$HOME/opt/$TRAVIS_PHP_VERSION/include + + echo $HOME/opt/$TRAVIS_PHP_VERSION | pecl install imagick + +elif [[ $TRAVIS_PHP_VERSION == 5.6 ]]; then + + echo | pecl install imagick +fi diff --git a/utils/behat-tags.php b/utils/behat-tags.php index df836b830..fa1e60185 100644 --- a/utils/behat-tags.php +++ b/utils/behat-tags.php @@ -17,10 +17,23 @@ function version_tags( $prefix, $current, $operator = '<' ) { if ( ! $current ) return array(); - exec( "grep '@{$prefix}-[0-9\.]*' -h -o features/*.feature | uniq", $existing_tags ); - $skip_tags = array(); + if ( 'require-wp' === $prefix ) { + if ( 'trunk' === $current ) { + // Exclude nothing. + return array(); + } + // Exclude cutting-edge. + $skip_tags[] = '@require-wp-trunk'; + + if ( 'latest' === $current ) { + return $skip_tags; + } + } + + exec( "grep '@{$prefix}-[0-9\.]*' -h -o features/*.feature | sort -u", $existing_tags ); + foreach ( $existing_tags as $tag ) { $compare = str_replace( "@{$prefix}-", '', $tag ); if ( version_compare( $current, $compare, $operator ) ) { @@ -43,7 +56,7 @@ function version_tags( $prefix, $current, $operator = '<' ) { # Require PHP extension, eg 'imagick'. function extension_tags() { $extension_tags = array(); - exec( "grep '@require-extension-[A-Za-z_]*' -h -o features/*.feature | uniq", $extension_tags ); + exec( "grep '@require-extension-[A-Za-z_]*' -h -o features/*.feature | sort -u", $extension_tags ); $skip_tags = array();