name: Run CI Tests
on: [push]
env:
  GO_VERSION: 1.18.4
jobs:
  run-tests:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
      - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
        with:
          go-version: ${{env.GO_VERSION}}
      - name: Run Go Vet
        run: |
          go vet ./...
      - name: Run Go Fmt
        run: |
          files=$(go fmt ./...)
          if [ -n "$files" ]; then
            echo "Please run gofmt on these files ..."
            echo "$files"
            exit 1
          fi
      - name: Run Go Test
        run: |
          go test -race -v ./...
