generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
48 lines (36 loc) · 1.42 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
ifndef VERSION
VERSION = ${shell git rev-parse --abbrev-ref HEAD}-${shell git rev-parse --short HEAD}
endif
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
GOLANG_CI_LINT = $(LOCALBIN)/golangci-lint
GOLANG_CI_LINT_VERSION ?= v1.60.3
lint:
GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANG_CI_LINT_VERSION)
$(LOCALBIN)/golangci-lint run --verbose -c .golangci.yaml
FLAGS = -ldflags '-s -w -X github.com/kyma-project/modulectl/cmd/modulectl/version.Version=$(VERSION)'
validate-docs:
./hack/verify-generated-docs.sh
build: build-linux build-darwin build-linux-arm build-darwin-arm
build-darwin:
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ./bin/modulectl-darwin $(FLAGS) ./cmd
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./bin/modulectl-linux $(FLAGS) ./cmd
build-darwin-arm:
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o ./bin/modulectl-darwin-arm $(FLAGS) ./cmd
build-linux-arm:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o ./bin/modulectl-linux-arm $(FLAGS) ./cmd
.PHONY: docs
docs:
rm -f ./docs/gen-docs/*
go run ./scripts/gendocs/gendocs.go
test:
go test `go list ./... | grep -v /tests/e2e` -race -coverprofile=cover.out
@echo "Total test coverage: $$(go tool cover -func=cover.out | grep total | awk '{print $$3}')"
@rm cover.out