@@ -3,12 +3,13 @@ GO_MODULE_MONOSKOPE ?= github.com/finleap-connect/monoskope
33GO_MODULE ?= github.com/finleap-connect/monoctl
44
55GO ?= go
6+ GOGET ?= $(HACK_DIR ) /goget-wrapper
67
78GINKGO ?= $(TOOLS_DIR ) /ginkgo
89GINKO_VERSION ?= v1.16.4
910
1011LINTER ?= $(TOOLS_DIR ) /golangci-lint
11- LINTER_VERSION ?= v1.36 .0
12+ LINTER_VERSION ?= v1.39 .0
1213
1314MOCKGEN ?= $(TOOLS_DIR ) /mockgen
1415GOMOCK_VERSION ?= v1.5.0
@@ -41,41 +42,35 @@ mod: ## Do go mod tidy, download, verify
4142vet : # # Do go ver
4243 $(GO ) vet ./...
4344
44- lint : # # Do golangci-lint
45- $(LINTER ) run -v --no-config --deadline=5m
46-
4745go : mod vet lint test # # Do go mod / vet / lint /test
4846
4947run : # # run monoctl, use `ARGS="get user"` to pass arguments
5048 $(GO ) run -ldflags " $( LDFLAGS) " cmd/monoctl/* .go $(ARGS )
5149
5250test : # # run all tests
53- @find . -name ' *.coverprofile' -exec rm {} \;
54- $(GINKGO ) -r -v -cover *
55- @echo " mode: set" > ./monoctl.coverprofile
56- @find ./internal -name " *.coverprofile" -exec cat {} \; | grep -v mode: | sort -r >> ./monoctl.coverprofile
57- @find ./internal -name ' *.coverprofile' -exec rm {} \;
51+ # https://onsi.github.io/ginkgo/#running-tests
52+ find . -name '*.coverprofile' -exec rm {} \;
53+ @$(GINKGO) -r -v -cover --failFast -requireSuite -covermode count -outputdir=$(BUILD_PATH) -coverprofile=monoctl.coverprofile
5854
59- coverage : # # show test coverage
60- @find . -name ' *.coverprofile' -exec go tool cover -func {} \;
55+ test-ci : # # run all tests in CICD
56+ # https://onsi.github.io/ginkgo/#running-tests
57+ find . -name '*.coverprofile' -exec rm {} \;
58+ @$(GINKGO) -r -cover --failFast -requireSuite -covermode count -outputdir=$(BUILD_PATH) -coverprofile=monoctl.coverprofile
6159
62- loc : # # show loc statistics
63- @gocloc .
60+ coverage : # # print coverage from coverprofiles
61+ @go tool cover -func monoctl.coverprofile
6462
65- ginkgo-get : # # download ginkgo
66- $(shell $(TOOLS_DIR ) /goget-wrapper github.com/onsi/ginkgo/ginkgo@$(GINKO_VERSION ) )
63+ ginkgo-get $( GINKGO ) :
64+ $(shell $(GOGET ) github.com/onsi/ginkgo/ginkgo@$(GINKO_VERSION ) )
6765
68- golangci-lint-get : # # download golangci-lint
69- $(shell curl -sSfL https://raw.githubusercontent.com/ golangci/golangci -lint/master/install .sh | sh -s -- -b $(TOOLS_DIR ) $(LINTER_VERSION ) )
66+ golangci-lint-get $( LINTER ) :
67+ $(shell $( HACK_DIR ) / golangci-lint.sh -b $(TOOLS_DIR ) $(LINTER_VERSION ) )
7068
7169gomock-get : # # download gomock
7270 $(shell $(TOOLS_DIR ) /goget-wrapper github.com/golang/mock/mockgen@$(GOMOCK_VERSION ) )
7371
74- ginkgo-clean : # # cleanup ginkgo
75- rm -Rf $(TOOLS_DIR ) /ginkgo
76-
77- golangci-lint-clean : # # cleanup golangci-lint
78- rm -Rf $(TOOLS_DIR ) /golangci-lint
72+ lint : $(LINTER ) # # go lint
73+ $(LINTER ) run -v --no-config --deadline=5m
7974
8075tools : golangci-lint-get ginkgo-get gomock-get # # Target to install all required tools into TOOLS_DIR
8176
@@ -107,3 +102,4 @@ rebuild-mocks: ## rebuild go mocks
107102 $(MOCKGEN ) -package domain -destination test/mock/domain/tenant_client.go github.com/finleap-connect/monoskope/pkg/api/domain TenantClient,Tenant_GetAllClient
108103 $(MOCKGEN ) -package domain -destination test/mock/domain/certificate_client.go github.com/finleap-connect/monoskope/pkg/api/domain CertificateClient
109104 $(MOCKGEN ) -package domain -destination test/mock/gateway/cluster_auth_client.go github.com/finleap-connect/monoskope/pkg/api/gateway ClusterAuthClient
105+ $(MOCKGEN ) -package domain -destination test/mock/gateway/api_token_client.go github.com/finleap-connect/monoskope/pkg/api/gateway APITokenClient
0 commit comments