From 955bb214b822c26f0d7eb17faf488cd56daeba18 Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Fri, 17 Nov 2017 09:18:20 -0500 Subject: [PATCH] .travis.yml: Add OSX --- .travis.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b3f6580..a082dba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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