name: Validate Changes

# Copied partially from https://github.com/ldez/exptostd

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:

  main:
    name: Main Process
    runs-on: ubuntu-latest
    env:
      GO_VERSION: stable
      CGO_ENABLED: 0

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: ${{ env.GO_VERSION }}

      - name: Check and get dependencies
        run: |
          go mod tidy
          git diff --exit-code go.mod
          git diff --exit-code go.sum

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