Makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. default: fmt get update test lint
  2. GO := go
  3. GOBIN := $(shell pwd)/bin
  4. GOBUILD := CGO_ENABLED=0 $(GO) build $(BUILD_FLAG)
  5. GOTEST := $(GO) test -v -race -coverprofile=profile.out -covermode=atomic
  6. FILES := $(shell find . -name '*.go' -type f -not -name '*.pb.go' -not -name '*_generated.go' -not -name '*_test.go')
  7. TESTS := $(shell find . -name '*.go' -type f -not -name '*.pb.go' -not -name '*_generated.go' -name '*_test.go')
  8. $(GOBIN)/tparse:
  9. GOBIN=$(GOBIN) go install github.com/mfridman/tparse@v0.11.1
  10. get:
  11. $(GO) get ./...
  12. $(GO) mod verify
  13. $(GO) mod tidy
  14. update:
  15. $(GO) get -u -v ./...
  16. $(GO) mod verify
  17. $(GO) mod tidy
  18. fmt:
  19. gofmt -s -l -w $(FILES) $(TESTS)
  20. lint:
  21. GOFLAGS="-tags=functional" golangci-lint run
  22. test: $(GOBIN)/tparse
  23. $(GOTEST) -timeout 2m -json ./... \
  24. | tee output.json | $(GOBIN)/tparse -follow -all
  25. [ -z "$${GITHUB_STEP_SUMMARY}" ] \
  26. || NO_COLOR=1 $(GOBIN)/tparse -format markdown -file output.json -all >"$${GITHUB_STEP_SUMMARY:-/dev/null}"
  27. .PHONY: test_functional
  28. test_functional: $(GOBIN)/tparse
  29. $(GOTEST) -timeout 15m -tags=functional -json ./... \
  30. | tee output.json | $(GOBIN)/tparse -follow -all
  31. [ -z "$${GITHUB_STEP_SUMMARY:-}" ] \
  32. || NO_COLOR=1 $(GOBIN)/tparse -format markdown -file output.json -all >"$${GITHUB_STEP_SUMMARY:-/dev/null}"