---
kind: pipeline
name: testing

steps:
- name: fetch-tags
  pull: default
  image: docker:git
  commands:
    - git fetch --tags --force
  when:
    event:
      exclude:
        - pull_request

- name: test
  pull: always
  image: golang:1.13
  commands:
  - export PATH=$PATH:/go:/srv/app/bin
  - go vet ./...
  - go test -race ./...
  environment:
    GOPATH: /srv/app
  when:
    event:
    - push
    - tag
    - pull_request