name: 🔨 Build Test

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

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

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

      - name: Build
        run: go build

      - name: Test
        run: go test
        working-directory: .

      - name: Running example
        run: go run .
        working-directory: example/