From 408b59d522ec39561b9b3563d905e31cd7503fe3 Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Fri, 17 Nov 2017 09:18:01 -0500 Subject: [PATCH] .travis.yml: Comment, reorganize --- .travis.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 39468c2..b3f6580 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,20 +13,28 @@ services: env: - MONEYGO_TEST_DB=sqlite - - MONEYGO_TEST_DB=mysql MONEYGO_TEST_DSN="root@tcp(127.0.0.1)/moneygo_test?parseTime=true" - - MONEYGO_TEST_DB=postgres MONEYGO_TEST_DSN="postgres://postgres@localhost/moneygo_test" + - MONEYGO_TEST_DB=mysql + - MONEYGO_TEST_DB=postgres +# Initialize databases, if necessary before_script: - - sh -c "if [ $MONEYGO_TEST_DB = 'postgres' ]; then psql -c 'DROP DATABASE IF EXISTS moneygo_test;' -U postgres; fi" - - sh -c "if [ $MONEYGO_TEST_DB = 'postgres' ]; then psql -c 'CREATE DATABASE moneygo_test;' -U postgres; fi" - - sh -c "if [ $MONEYGO_TEST_DB = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS moneygo_test;'; fi" + - 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 script: +# 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 +# Fetch MoneyGo itself - go get -d github.com/aclindsa/moneygo +# Don't allow the test to query for a full list of all CUSIPs - touch $GOPATH/src/github.com/aclindsa/moneygo/internal/handlers/cusip_list.csv +# Build and test MoneyGo - go generate -v github.com/aclindsa/moneygo/internal/handlers - go test -v -covermode=count -coverprofile=coverage.out github.com/aclindsa/moneygo/internal/handlers +# Finally, report the test coverage - $GOPATH/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN