2017-10-05 08:06:59 -04:00
|
|
|
language: go
|
|
|
|
|
|
|
|
os:
|
|
|
|
- linux
|
|
|
|
|
|
|
|
go:
|
|
|
|
- 1.9.x
|
|
|
|
- master
|
|
|
|
|
2017-11-16 19:27:34 -05:00
|
|
|
services:
|
|
|
|
- mysql
|
|
|
|
- postgresql
|
|
|
|
|
|
|
|
env:
|
|
|
|
- MONEYGO_TEST_DB=sqlite
|
2017-11-17 09:18:01 -05:00
|
|
|
- MONEYGO_TEST_DB=mysql
|
|
|
|
- MONEYGO_TEST_DB=postgres
|
2017-11-16 19:27:34 -05:00
|
|
|
|
2017-11-17 09:18:01 -05:00
|
|
|
# Initialize databases, if necessary
|
2017-11-16 19:27:34 -05:00
|
|
|
before_script:
|
2017-11-17 09:18:01 -05:00
|
|
|
- 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
|
|
|
|
- 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-11-16 19:27:34 -05:00
|
|
|
|
2017-10-05 08:06:59 -04:00
|
|
|
script:
|
2017-11-17 09:18:01 -05:00
|
|
|
# Fetch/build coverage reporting tools
|
2017-10-05 08:06:59 -04:00
|
|
|
- go get golang.org/x/tools/cmd/cover
|
|
|
|
- go get github.com/mattn/goveralls
|
|
|
|
- go install github.com/mattn/goveralls
|
2017-11-17 09:18:01 -05:00
|
|
|
# Fetch MoneyGo itself
|
2017-10-05 08:06:59 -04:00
|
|
|
- go get -d github.com/aclindsa/moneygo
|
2017-11-17 09:18:01 -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-17 09:18:01 -05:00
|
|
|
# Build and test MoneyGo
|
2017-10-05 08:06:59 -04:00
|
|
|
- go generate -v github.com/aclindsa/moneygo/internal/handlers
|
|
|
|
- go test -v -covermode=count -coverprofile=coverage.out github.com/aclindsa/moneygo/internal/handlers
|
2017-11-17 09:18:01 -05:00
|
|
|
# Finally, report the test coverage
|
2017-10-05 08:06:59 -04:00
|
|
|
- $GOPATH/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN
|