.travis.yml: Add OSX

This commit is contained in:
Aaron Lindsay 2017-11-17 09:18:20 -05:00
parent 408b59d522
commit 955bb214b8
1 changed files with 11 additions and 1 deletions

View File

@ -2,6 +2,7 @@ language: go
os:
- linux
- osx
go:
- 1.9.x
@ -16,7 +17,16 @@ env:
- MONEYGO_TEST_DB=mysql
- MONEYGO_TEST_DB=postgres
# Initialize databases, if necessary
# Install MySQL or Postgres if on OSX
before_install:
- if [ $TRAVIS_OS_NAME = 'osx' ] && [ $MONEYGO_TEST_DB = 'mysql' ]; then brew update > /dev/null && brew install mariadb && mysql.server start; fi
- if [ $TRAVIS_OS_NAME = 'osx' ] && [ $MONEYGO_TEST_DB = 'postgres' ]; then brew update > /dev/null; fi
- if [ $TRAVIS_OS_NAME = 'osx' ] && [ $MONEYGO_TEST_DB = 'postgres' ]; then rm -rf /usr/local/var/postgres; fi
- if [ $TRAVIS_OS_NAME = 'osx' ] && [ $MONEYGO_TEST_DB = 'postgres' ]; then initdb /usr/local/var/postgres; fi
- if [ $TRAVIS_OS_NAME = 'osx' ] && [ $MONEYGO_TEST_DB = 'postgres' ]; then pg_ctl -D /usr/local/var/postgres start; fi
- if [ $TRAVIS_OS_NAME = 'osx' ] && [ $MONEYGO_TEST_DB = 'postgres' ]; then createuser -s postgres; fi
# Initialize databases, if testing MySQL or Postgres
before_script:
- if [ $MONEYGO_TEST_DB = 'mysql' ]; then export MONEYGO_TEST_DSN="root@tcp(127.0.0.1)/moneygo_test?parseTime=true"; fi
- if [ $MONEYGO_TEST_DB = 'postgres' ]; then export MONEYGO_TEST_DSN="postgres://postgres@localhost/moneygo_test"; fi