image: lyda/golang:1.7

variables:
  MYSQL_ROOT_PASSWORD: "password"
  MYSQL_ALLOW_EMPTY_PASSWORD: "1"
  MYSQL_TEST: "true"

before_script:
  - cat /etc/hosts
  - for i in 1 2 3; do mysql -uroot -p$MYSQL_ROOT_PASSWORD -hmysql < db/seed.sql && break || true; sleep 3; done

services:
  - mysql

test:
  type: test
  script:
    - pwd
    - ls
    - mkdir -p /go/src/github.com/nsheridan
    - ln 
    - go install -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
