name: "CI"
on: ["push", "pull_request"]

jobs:
  test:
    name: "Run unit tests"
    strategy:
      matrix:
        os: ["windows-latest", "ubuntu-latest", "macOS-latest"]
        go: ["1.12.x", "1.13.x"]
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v1
      with:
        fetch-depth: 1
    - uses: actions/setup-go@v1
      with:
        go-version: ${{ matrix.go }}
    - run: "go test ./..."

  lint:
    name: "Run static analysis"
    runs-on: "ubuntu-latest"
    steps:
    - uses: actions/setup-go@v1
      with:
        go-version: "1.13.x"
    - run: "GO111MODULE=on go get honnef.co/go/tools/cmd/staticcheck"
    - uses: actions/checkout@v1
      with:
        fetch-depth: 1
    - run: "go vet ./..."
    - run: "$(go env GOPATH)/bin/staticcheck -go 1.11 ./..."
