name: Pull Request on: workflow_dispatch: pull_request: branches: - main jobs: test-and-lint: name: Test, Format & Lint runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v6 - name: Set up Go uses: actions/setup-go@v6 with: go-version: "1.25" cache: true - name: Check formatting run: | # Fails if any files are not formatted correctly if [ -n "$(gofmt -l .)" ]; then echo "Go code is not formatted:" gofmt -d . exit 1 fi - name: Run go vet run: go vet ./... - name: Run linter uses: golangci/golangci-lint-action@v9 with: version: latest - name: Run tests run: go test -v ./... -coverprofile=coverage.out - name: Generate coverage report run: go tool cover -html=coverage.out -o coverage.html - name: Upload test coverage uses: actions/upload-artifact@v3 with: name: coverage-report path: coverage.html