name: Test

on:
  push:
    branches:
      - "*"
  pull_request:
    branches:
      - "*"

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        go-version: ["1.20", "1.21.0"]
        os: [ubuntu-latest, macos-latest]
    runs-on: ${{ matrix.os }}

    steps:
      - name: Set up Go
        uses: actions/setup-go@v3
        with:
          go-version: ${{ matrix.go-version }}
        id: go

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

      - name: Run tests
        run: go test -race ./...
