mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-07-05 21:58:39 -04:00
Use dep
and adapt travis to, too
This commit is contained in:
38
.travis.yml
38
.travis.yml
@ -13,9 +13,12 @@ services:
|
||||
- postgresql
|
||||
|
||||
env:
|
||||
- MONEYGO_TEST_DB=sqlite
|
||||
- MONEYGO_TEST_DB=mysql
|
||||
- MONEYGO_TEST_DB=postgres
|
||||
global:
|
||||
- DEP_VERSION="0.3.2"
|
||||
matrix:
|
||||
- MONEYGO_TEST_DB=sqlite
|
||||
- MONEYGO_TEST_DB=mysql
|
||||
- MONEYGO_TEST_DB=postgres
|
||||
|
||||
# OSX builds take too long, so don't wait for all of them
|
||||
matrix:
|
||||
@ -24,8 +27,16 @@ matrix:
|
||||
- os: osx
|
||||
go: master
|
||||
|
||||
# Install MySQL or Postgres if on OSX
|
||||
before_install:
|
||||
# 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
|
||||
- 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
|
||||
@ -33,25 +44,24 @@ before_install:
|
||||
- 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
|
||||
|
||||
install:
|
||||
- dep ensure
|
||||
|
||||
# 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 = '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
|
||||
- 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
|
||||
# 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
|
||||
# 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
|
||||
|
||||
# Report the test coverage
|
||||
after_script:
|
||||
- $GOPATH/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN
|
||||
|
Reference in New Issue
Block a user