From 105ddce9043d023b353d4868c5a3a328b5e8530c Mon Sep 17 00:00:00 2001 From: vimiix Date: Sun, 17 Dec 2023 22:59:13 +0800 Subject: [PATCH] chore(Makefile):add test target --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index c7fc0b7..49f0bc5 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ LDFLAGS += -X "$(REPO)/ssx/version.Revision=$(COMMIT)" LDFLAGS += -X "$(REPO)/ssx/version.BuildDate=$(BUILDDATE)" LDFLAGS += $(EXTRA_LDFLAGS) FILES := $$(find . -name "*.go") +TEST_FILES := $$(go list ./...) .PHONY: help help: ## print help info @@ -34,6 +35,10 @@ lint: tidy fmt ## lint code with golangci-lint $([[ command -v golangci-lint ]] || go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1) @golangci-lint run -v +.PHONY: test +test: ## run all unit tests + $(GO) test -gcflags=all=-l $(TEST_FILES) -coverprofile dist/cov.out -covermode count + .PHONY: ssx ssx: lint ## build ssx binary $(GO) build -ldflags '$(LDFLAGS)' -gcflags '-N -l' -o dist/ssx ./cmd/ssx/main.go