name: 🔨 Build Test

on:
  pull_request:
    paths:
      - '**.go'
      - '**.mod'
  workflow_dispatch:
  push:
    branches:
      - main

jobs:
  build:
    name: Test Builds
    strategy:
      matrix:
        go-version: [1.21.x]
        os: [ubuntu-latest]

    runs-on: ${{ matrix.os }}
    steps:
      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version: ${{ matrix.go-version }}

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

      - name: Go Mod hygiene
        run: |
          go clean -modcache
          go mod tidy

      - name: Run Tests
        run: go test -v ./...
        