1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2024-12-26 07:33:21 -05:00
moneygo/.travis.yml

70 lines
3.4 KiB
YAML
Raw Normal View History

2017-10-05 08:06:59 -04:00
language: go
os:
- linux
2017-11-17 09:18:20 -05:00
- osx
2017-10-05 08:06:59 -04:00
go:
- 1.9.x
- master
services:
- mysql
- postgresql
env:
2017-11-18 20:08:15 -05:00
global:
- DEP_VERSION="0.3.2"
matrix:
- MONEYGO_TEST_DB=sqlite
- MONEYGO_TEST_DB=mysql
- MONEYGO_TEST_DB=postgres
2017-12-09 05:59:30 -05:00
# OSX builds take too long, so don't wait for them
matrix:
fast_finish: true
allow_failures:
- os: osx
2017-11-17 09:18:20 -05:00
before_install:
2017-11-18 20:08:15 -05:00
# Fetch/build coverage reporting tools
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls
- go install github.com/mattn/goveralls
# Download `dep` and ensure it's executable
- if [ $TRAVIS_OS_NAME = 'linux' ]; then curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep; fi
- if [ $TRAVIS_OS_NAME = 'osx' ]; then curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-darwin-amd64 -o $GOPATH/bin/dep; fi
- chmod +x $GOPATH/bin/dep
# Install and start MySQL or Postgres if on OSX
2017-11-17 09:18:20 -05:00
- 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
2017-11-18 20:08:15 -05:00
install:
- dep ensure
2017-11-17 09:18:20 -05:00
# Initialize databases, if testing MySQL or Postgres
before_script:
2017-11-18 20:08:15 -05:00
- if [ $MONEYGO_TEST_DB = 'mysql' ]; then export MONEYGO_TEST_DSN="root@tcp(127.0.0.1:3306)/moneygo_test?parseTime=true"; fi
- if [ $MONEYGO_TEST_DB = 'postgres' ]; then export MONEYGO_TEST_DSN="postgres://postgres@localhost/moneygo_test?sslmode=disable"; fi
2017-11-17 09:18:01 -05:00
- if [ $MONEYGO_TEST_DB = 'mysql' ]; then mysql -u root -e 'CREATE DATABASE IF NOT EXISTS moneygo_test;'; fi
- if [ $MONEYGO_TEST_DB = 'postgres' ]; then psql -c 'DROP DATABASE IF EXISTS moneygo_test;' -U postgres; fi
- if [ $MONEYGO_TEST_DB = 'postgres' ]; then psql -c 'CREATE DATABASE moneygo_test;' -U postgres; fi
2017-10-05 08:06:59 -04:00
script:
2017-11-18 20:08:15 -05:00
# Don't allow the test to query for a full list of all CUSIPs
2017-10-05 08:06:59 -04:00
- touch $GOPATH/src/github.com/aclindsa/moneygo/internal/handlers/cusip_list.csv
2017-11-18 20:08:15 -05:00
# Build and test MoneyGo
2017-10-05 08:06:59 -04:00
- go generate -v github.com/aclindsa/moneygo/internal/handlers
- export COVER_PACKAGES="github.com/aclindsa/moneygo/internal/config,github.com/aclindsa/moneygo/internal/handlers,github.com/aclindsa/moneygo/internal/models,github.com/aclindsa/moneygo/internal/store,github.com/aclindsa/moneygo/internal/store/db,github.com/aclindsa/moneygo/internal/reports"
- go test -v -covermode=count -coverpkg $COVER_PACKAGES -coverprofile=integration_coverage.out github.com/aclindsa/moneygo/internal/integration
- go test -v -covermode=count -coverpkg $COVER_PACKAGES -coverprofile=config_coverage.out github.com/aclindsa/moneygo/internal/config
- go test -v -covermode=count -coverpkg $COVER_PACKAGES -coverprofile=models_coverage.out github.com/aclindsa/moneygo/internal/models
2017-11-18 20:08:15 -05:00
# Report the test coverage
after_script:
- $GOPATH/bin/goveralls -coverprofile=integration_coverage.out,config_coverage.out,models_coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN