blob: c41445c038659fb24b1995b3d4b7aca899cc22f0 [file] [log] [blame]
Abhay Kumara61c5222025-11-10 07:32:50 +00001default: fmt get update test lint
2
3GO := go
4GOBIN := $(shell pwd)/bin
5GOBUILD := CGO_ENABLED=0 $(GO) build $(BUILD_FLAG)
6
7GOTESTSUM := $(GOBIN)/gotestsum
8GOTESTSUM_VERSION := v1.13.0
9$(GOTESTSUM):
10 GOBIN=$(GOBIN) go install gotest.tools/gotestsum@$(GOTESTSUM_VERSION)
11
12TESTSTAT := $(GOBIN)/teststat
13TESTSTAT_VERSION := v0.1.26
14$(TESTSTAT):
15 GOBIN=$(GOBIN) go install github.com/vearutop/teststat@$(TESTSTAT_VERSION)
16
17FILES := $(shell find . -name '*.go' -type f -not -name '*.pb.go' -not -name '*_generated.go' -not -name '*_test.go')
18TESTS := $(shell find . -name '*.go' -type f -not -name '*.pb.go' -not -name '*_generated.go' -name '*_test.go')
19
20get:
21 $(GO) get ./...
22 $(GO) mod verify
23 $(GO) mod tidy
24
25update:
26 $(GO) get -u -v ./...
27 $(GO) mod verify
28 $(GO) mod tidy
29
30fmt:
31 gofmt -s -l -w $(FILES) $(TESTS)
32
33lint:
34 GOFLAGS="-tags=functional" golangci-lint run
35
36test: $(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
43test_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