Skip to content

Commit

Permalink
Fix travis build on macos, native php (7.1.23) conflicts with brew ph…
Browse files Browse the repository at this point in the history
…p (7.1.33).
  • Loading branch information
zobo committed Nov 17, 2019
1 parent 15c6fd9 commit f6c9841
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: php

php:
- '5.6'
- '7.1'
- '5.6'
env:
global:
- NODE_VERSION=8.9.3
Expand Down
15 changes: 14 additions & 1 deletion scripts/travis-beforeinstall.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -x

isFunction() {
declare -fF -- "${@:?'No arguments provided.'}" > /dev/null
Expand All @@ -22,13 +23,23 @@ beforeInstall::test() {
# Fix ruby error https://github.com/Homebrew/brew/issues/3299
brew install "${atAbbr}" nvm

# check currenty install php
php --version

# Try to clobber native php install
brew link --force --overwrite "${atAbbr}"

echo 'export PATH="/usr/local/opt/php@7.1/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php@7.1/sbin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

# full version
php --version
vFull="$(php --version | egrep -o '([[:digit:]]+\.?){2,3}' | head -1)"
vAbbr="${vFull%.*}"
printf -v dirConfd '/usr/local/etc/php/%s/conf.d' "${vAbbr}"
printf -v dirCellar '/usr/local/Cellar/%s/%s/pecl' "${atAbbr}" "${vFull}"

brew link --force --overwrite "${atAbbr}"
mkdir -p "${dirConfd}"
cp -f "${TRAVIS_INI}" "${dirConfd}"
TRAVIS_INI="${dirConfd}/travis-php.ini"
Expand All @@ -39,6 +50,8 @@ beforeInstall::test() {
# make xdebug.so available at pecl's expected location
ln -s "${dirCellar}" '/usr/local/lib/php/pecl'
php --ini
php --version
whereis php

[ -r "${HOME}/.nvm/nvm.sh" ] && . "${HOME}/.nvm/nvm.sh"
beforeInstall::main
Expand Down

0 comments on commit f6c9841

Please sign in to comment.