name: 🔨 Build Test

on:
  pull_request:
    paths:
      - '**.go'
      - '**.mod'
  workflow_dispatch:

jobs:  
  build:
    name: Test Builds
    strategy:
      matrix:
        go-version: [1.21.x]
        os: [ubuntu-latest, windows-latest, macOS-latest]
    
    runs-on: ${{ matrix.os }}
    steps:
      - name: Set up Go
        uses: actions/setup-go@v3
        with:
          go-version: ${{ matrix.go-version }}

      - name: Check out code
        uses: actions/checkout@v3

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

      - name: Run Example
        run: go run .
        working-directory: examples/basic