language: go
services:
  - mysql
  - mongodb

env:
  - GO15VENDOREXPERIMENT=1 MYSQL_TEST_CONFIG="mysql:user:passwd:localhost" MONGO_TEST_CONFIG="mongo:user:passwd:localhost"

go:
  - 1.6.3
  - 1.7
  - tip

matrix:
  allow_failures:
    - go: tip

before_install:
  - go get -v github.com/golang/lint/golint
  - go install ./cmd/dbinit

install:
  - go version

before_script:
  - dbinit -db_user user -db_password passwd
  - dbinit -db_type mongo -admin_user '' -db_user user -db_password passwd

sudo: false
script:
  - go build -v ./cmd/cashier ./cmd/cashierd
  - go list ./... |grep -v vendor/ |xargs go test
  - gofmt -d $(find -type f -name '*.go' -not -path './vendor/*')
  - go list ./... |grep -v vendor/ |xargs go vet
  - go list ./... |grep -v vendor/ |xargs -L1 golint -set_exit_status
