Skip to content

Commit

Permalink
test build php for osx in travis
Browse files Browse the repository at this point in the history
  • Loading branch information
akondas committed Jul 1, 2016
1 parent 2f152b4 commit 43ba6e9
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 6 deletions.
25 changes: 19 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 31 additions & 0 deletions tools/handle_brew_pkg.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 19 additions & 0 deletions tools/prepare_osx_env.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 43ba6e9

Please sign in to comment.