name: Tests

on:
  push:
    branches:
    - master
  pull_request:
    branches:
    - master

jobs:
  test:
    strategy:
      matrix:
        # Minimum supported version (1.12) and the latest few versions
        go-version: [1.12, 1.15, 1.16, 1.17]
        platform: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.platform }}

    steps:
    - name: Install Go
      uses: actions/setup-go@v2
      with:
        go-version: ${{ matrix.go-version }}

    - name: Checkout code
      uses: actions/checkout@v2

    - name: Check formatting
      if: matrix.go-version == '1.17' && matrix.platform == 'ubuntu-latest'
      run: diff -u <(echo -n) <(go fmt $(go list ./...))

    - name: Check module vendoring
      if: matrix.go-version == '1.17' && matrix.platform == 'ubuntu-latest'
      run: |
        go mod tidy
        go mod vendor
        git diff --exit-code || exit 1

    - name: Run unit tests
      run: go test -v ./...

name: Tests

on:
  push:
    branches:
    - master
  pull_request:
    branches:
    - master

jobs:
  test:
    strategy:
      matrix:
        # Minimum supported version (1.12) and the latest two
        go-version: [1.12, 1.17, 1.18]
        platform: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.platform }}

    steps:
    - name: Install Go
      uses: actions/setup-go@v2
      with:
        go-version: ${{ matrix.go-version }}

    - name: Checkout code
      uses: actions/checkout@v2

    - name: Check formatting
      if: matrix.go-version == '1.18' && matrix.platform == 'ubuntu-latest'
      run: diff -u <(echo -n) <(go fmt $(go list ./...))

    - name: Check module vendoring
      if: matrix.go-version == '1.18' && matrix.platform == 'ubuntu-latest'
      run: |
        go mod tidy
        go mod vendor
        git diff --exit-code || exit 1

    - name: Run unit tests
      run: go test -v ./...

Update CI to Go 1.18
Update CI to Go 1.18

Also only test on the minimum supported version (currently Go 1.12) and
the latest two versions supported by the Go project.
