name: Go

on:
  push:
  pull_request:
  schedule:
    - cron: '5 10 * * SUN'

jobs:

  build:
    strategy:
      matrix:
        # We test back to 1.11 as we need to support old, EOL'd Go versions
        # to build PPA packages for older versions of Ubuntu.
        go-version: [1.11.x, 1.12.x, 1.13.x, 1.14.x, 1.15.x]
        platform: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.platform }}
    name: "Build ${{ matrix.go-version }} test 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

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

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

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