name: Tests

on:
  push:
  pull_request:

jobs:
  test:
    strategy:
      matrix:
        go: ['1.17','1.18', '1.19']
        platform: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.platform }}

    steps:
    - name: Set up Go
      uses: actions/setup-go@v4
      with:
        go-version: ${{ matrix.go }}
        check-latest: true
        
    - run: go version

    - uses: actions/checkout@v3

    - name: go mod package cache
      uses: actions/cache@v3
      with:
        path: ~/go/pkg/mod
        key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.mod') }}

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