1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2024-12-26 23:42:29 -05:00

Use dep and adapt travis to, too

This commit is contained in:
Aaron Lindsay 2017-11-18 20:08:15 -05:00
parent c1346e8a65
commit 197b2db962
3 changed files with 149 additions and 14 deletions

View File

@ -13,6 +13,9 @@ services:
- postgresql - postgresql
env: env:
global:
- DEP_VERSION="0.3.2"
matrix:
- MONEYGO_TEST_DB=sqlite - MONEYGO_TEST_DB=sqlite
- MONEYGO_TEST_DB=mysql - MONEYGO_TEST_DB=mysql
- MONEYGO_TEST_DB=postgres - MONEYGO_TEST_DB=postgres
@ -24,8 +27,16 @@ matrix:
- os: osx - os: osx
go: master go: master
# Install MySQL or Postgres if on OSX
before_install: 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 = '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 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 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 pg_ctl -D /usr/local/var/postgres start; fi
- if [ $TRAVIS_OS_NAME = 'osx' ] && [ $MONEYGO_TEST_DB = 'postgres' ]; then createuser -s postgres; 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 # Initialize databases, if testing MySQL or Postgres
before_script: 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 = '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 = '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 'DROP DATABASE IF EXISTS moneygo_test;' -U postgres; fi
- if [ $MONEYGO_TEST_DB = 'postgres' ]; then psql -c 'CREATE DATABASE moneygo_test;' -U postgres; fi - if [ $MONEYGO_TEST_DB = 'postgres' ]; then psql -c 'CREATE DATABASE moneygo_test;' -U postgres; fi
script: script:
# Fetch/build coverage reporting tools # Don't allow the test to query for a full list of all CUSIPs
- 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 - 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 generate -v github.com/aclindsa/moneygo/internal/handlers
- go test -v -covermode=count -coverprofile=coverage.out 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 - $GOPATH/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN

75
Gopkg.lock generated Normal file
View File

@ -0,0 +1,75 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
branch = "master"
name = "github.com/aclindsa/gorp"
packages = ["."]
revision = "d53dbb52439a458ae75f574d9420f66b6489441d"
[[projects]]
name = "github.com/aclindsa/ofxgo"
packages = ["."]
revision = "d81d75876fe515827c2c9e63b2bb7171acddede1"
version = "v0.1.0"
[[projects]]
branch = "master"
name = "github.com/aclindsa/xml"
packages = ["."]
revision = "5d4402bb4a207d3f39d33ae127c97557e1df8f05"
[[projects]]
name = "github.com/go-sql-driver/mysql"
packages = ["."]
revision = "a0583e0143b1624142adab07e0e97fe106d99561"
version = "v1.3"
[[projects]]
branch = "master"
name = "github.com/lib/pq"
packages = [".","oid"]
revision = "8c6ee72f3e6bcb1542298dd5f76cb74af9742cec"
[[projects]]
name = "github.com/mattn/go-sqlite3"
packages = ["."]
revision = "ed69081a91fd053f17672236b0dd52ba7485e1a3"
version = "v1.4.0"
[[projects]]
branch = "master"
name = "github.com/yuin/gopher-lua"
packages = [".","ast","parse","pm"]
revision = "609c9cd2697344dec90fe0543c6493e3b8da3435"
[[projects]]
branch = "master"
name = "golang.org/x/net"
packages = ["context"]
revision = "9dfe39835686865bff950a07b394c12a98ddc811"
[[projects]]
branch = "master"
name = "golang.org/x/text"
packages = ["currency","internal","internal/format","internal/gen","internal/tag","language","unicode/cldr"]
revision = "88f656faf3f37f690df1a32515b479415e1a6769"
[[projects]]
name = "gopkg.in/gcfg.v1"
packages = [".","scanner","token","types"]
revision = "298b7a6a3838f79debfaee8bd3bfb2b8d779e756"
version = "v1.2.1"
[[projects]]
name = "gopkg.in/warnings.v0"
packages = ["."]
revision = "ec4a0fea49c7b46c2aeb0b51aac55779c607e52b"
version = "v0.1.2"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "de6a009267b8a81e29fc30f4bb7431c32ca42650d6cfd458324324f3f63abbff"
solver-name = "gps-cdcl"
solver-version = 1

50
Gopkg.toml Normal file
View File

@ -0,0 +1,50 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
[[constraint]]
name = "github.com/aclindsa/gorp"
branch = "master"
[[constraint]]
name = "github.com/aclindsa/ofxgo"
version = "0.1.0"
[[constraint]]
name = "github.com/go-sql-driver/mysql"
version = "1.3.0"
[[constraint]]
branch = "master"
name = "github.com/lib/pq"
[[constraint]]
name = "github.com/mattn/go-sqlite3"
version = "1.4.0"
[[constraint]]
branch = "master"
name = "github.com/yuin/gopher-lua"
[[constraint]]
name = "gopkg.in/gcfg.v1"
version = "1.2.1"