test build php for osx in travis

This commit is contained in:
Arkadiusz Kondas 2016-07-01 22:05:20 +02:00
parent 2f152b4a34
commit 43ba6e99fc
3 changed files with 69 additions and 6 deletions

View File

@ -1,13 +1,26 @@
language: php
os:
- linux
matrix:
fast_finish: true
php:
- 7.0
include:
- os: linux
php: '7.0'
before_script:
- composer install --ignore-platform-reqs
- os: osx
osx_image: xcode7.3
language: generic
env:
- _OSX=10.11
- _PHP: php70
before_install:
- if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then /usr/bin/env bash build/prepare_osx_env.sh ; fi
install:
- if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then /usr/bin/env bash tools/handle_brew_pkg.sh "${_PHP}" ; fi
- curl -s http://getcomposer.org/installer | php
- php composer.phar install --dev --no-interaction --ignore-platform-reqs
script:
- bin/phpunit

31
tools/handle_brew_pkg.sh Normal file
View File

@ -0,0 +1,31 @@
#!/usr/bin/env bash
if [[ "$#" -eq 1 ]]; then
echo "Handling \"$1\" brew package..."
else
echo "Brew failed - invalid $0 call"
exit 1;
fi
if [[ $(brew ls --versions "$1") ]]; then
if brew outdated "$1"; then
echo "Package upgrade is not required, skipping"
else
echo "Updating package...";
brew upgrade "$1"
if [ $? -ne 0 ]; then
echo "Upgrade failed"
exit 1
fi
fi
else
echo "Package not available - installing..."
brew install "$1"
if [ $? -ne 0 ]; then
echo "Install failed"
exit 1
fi
fi
echo "Linking installed package..."
brew link "$1"

19
tools/prepare_osx_env.sh Normal file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
echo "Here's the OSX environment:"
sw_vers
brew --version
echo "Updating brew..."
brew update
if [[ "${_PHP}" == "hhvm" ]]; then
echo "Adding brew HHVM dependencies..."
brew tap hhvm/hhvm
else
echo "Adding brew PHP dependencies..."
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
fi