go.yml 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # This workflow will build a golang project
  2. # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
  3. name: Go
  4. on:
  5. push:
  6. branches: [ "main" ]
  7. pull_request:
  8. branches: [ "main" ]
  9. jobs:
  10. build:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - uses: actions/checkout@v5
  14. - name: Set up Go
  15. uses: actions/setup-go@v6
  16. with:
  17. go-version: '1.26.2'
  18. - name: Go Format
  19. run: |
  20. gofmt -s -l .
  21. if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
  22. - name: GolangCI-Lint
  23. uses: golangci/golangci-lint-action@v8
  24. with:
  25. version: v2.12.2
  26. - name: Go Vet
  27. run: go vet ./...
  28. - name: Build
  29. run: go build -v ./...
  30. - name: Test
  31. run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
  32. - name: Upload coverage reports to Codecov
  33. uses: codecov/codecov-action@v5
  34. with:
  35. token: ${{ secrets.CODECOV_TOKEN }}