name: Go

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  test:
    name: Build
    strategy:
      matrix:
        go-version: [1.13.x, 1.15.x, 1.16.x, 1.17.x, 1.18.x]
        platform: [ubuntu-20.04]
    runs-on: ${{ matrix.platform }}
    steps:
      - name: Install Go
        uses: actions/setup-go@v3
        with:
          go-version: ${{ matrix.go-version }}

      - name: Check out code into the Go module directory
        uses: actions/checkout@v3

      - name: Build
        run: go build -v ./...

      - name: Test
        run: go test -v ./...

  lint:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v3
      - uses: golangci/golangci-lint-action@v3.1.0
        with:
          # must be specified without patch version
          version: v1.41
