name: Go

on: [push, pull_request]

jobs:

  build:
    name: Build
    strategy:
      matrix:
        go-version: [1.17.x, 1.18.x]
        platform: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.platform }}
    steps:
      - name: Set up Go 1.x
        uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.go-version }}
        id: go

      - name: Check out code into the Go module directory
        uses: actions/checkout@v2
        with:
          submodules: true

      - name: Get dependencies
        run: go get -v -t -d ./...

      - name: Build
        run: go build -v .

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