| Abhay Kumar | a61c522 | 2025-11-10 07:32:50 +0000 | [diff] [blame] | 1 | default: fmt get update test lint |
| 2 | |
| 3 | GO := go |
| 4 | GOBIN := $(shell pwd)/bin |
| 5 | GOBUILD := CGO_ENABLED=0 $(GO) build $(BUILD_FLAG) |
| 6 | |
| 7 | GOTESTSUM := $(GOBIN)/gotestsum |
| 8 | GOTESTSUM_VERSION := v1.13.0 |
| 9 | $(GOTESTSUM): |
| 10 | GOBIN=$(GOBIN) go install gotest.tools/gotestsum@$(GOTESTSUM_VERSION) |
| 11 | |
| 12 | TESTSTAT := $(GOBIN)/teststat |
| 13 | TESTSTAT_VERSION := v0.1.26 |
| 14 | $(TESTSTAT): |
| 15 | GOBIN=$(GOBIN) go install github.com/vearutop/teststat@$(TESTSTAT_VERSION) |
| 16 | |
| 17 | FILES := $(shell find . -name '*.go' -type f -not -name '*.pb.go' -not -name '*_generated.go' -not -name '*_test.go') |
| 18 | TESTS := $(shell find . -name '*.go' -type f -not -name '*.pb.go' -not -name '*_generated.go' -name '*_test.go') |
| 19 | |
| 20 | get: |
| 21 | $(GO) get ./... |
| 22 | $(GO) mod verify |
| 23 | $(GO) mod tidy |
| 24 | |
| 25 | update: |
| 26 | $(GO) get -u -v ./... |
| 27 | $(GO) mod verify |
| 28 | $(GO) mod tidy |
| 29 | |
| 30 | fmt: |
| 31 | gofmt -s -l -w $(FILES) $(TESTS) |
| 32 | |
| 33 | lint: |
| 34 | GOFLAGS="-tags=functional" golangci-lint run |
| 35 | |
| 36 | test: $(GOTESTSUM) $(TESTSTAT) $(TPARSE) |
| 37 | @$(GOTESTSUM) $(if ${CI},--format github-actions,--format testdox) --jsonfile _test/unittests.json --junitfile _test/unittests.xml \ |
| 38 | --rerun-fails --packages="./..." \ |
| 39 | -- -v -race -coverprofile=profile.out -covermode=atomic -timeout 2m |
| 40 | @$(TESTSTAT) _test/unittests.json |
| 41 | |
| 42 | .PHONY: test_functional |
| 43 | test_functional: $(GOTESTSUM) $(TESTSTAT) $(TPARSE) |
| 44 | @$(GOTESTSUM) $(if ${CI},--format github-actions,--format testdox) --jsonfile _test/fvt.json --junitfile _test/fvt.xml \ |
| 45 | --rerun-fails --packages="./..." \ |
| 46 | -- -v -race -coverprofile=profile.out -covermode=atomic -timeout 15m -tags=functional |
| 47 | @$(TESTSTAT) _test/fvt.json |