stages:
  - test

Unit tests:
  stage: test
  tags:
    - golang
    - mongo  # Require an available mongo service
    - strong # Disable this build on small runners
  services:
    - "lesterpig/mongo:latest" # Use this light version of mongo
    - "lesterpig/postfix:latest"
  #artifacts: # Waiting GitLab 8.2.1...
  #  paths:
  #    - "coverage.html"
  script:
    - "go get gopkg.in/mgo.v2"
    - "go test -coverprofile auth.part -v ./auth"
    - "go test -coverprofile mgdb.part -v ./mgdb"
    - "go test -coverprofile mails.part -v ./mails"
    - "echo 'mode: set' *part > c.out"
    - "grep -h -v 'mode: set' *part >> c.out"
    - "go tool cover -html=c.out -o coverage.html"

ARM tests:
  stage: test
  tags:
    - arm
  script:
    - "go get gopkg.in/mgo.v2"
    - "go test -cover -short -v ./auth"
    - "go test -cover -short -v ./mgdb"

Code lint:
  stage: test
  allow_failure: True
  tags:
    - golang
    - lint
  script:
    - "go get github.com/alecthomas/gometalinter"
    - "go get gopkg.in/mgo.v2"
    - "gometalinter --install"
    - "gometalinter -t --deadline=100s -j1 ./..."
