forked from kyma-project/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
84 lines (62 loc) · 1.69 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
.DEFAULT_GOAL := local
ifndef KYMA_VERSION
KYMA_VERSION = latest
endif
ifndef VERSION
VERSION = ${shell git describe --tags --always}
endif
FLAGS = -ldflags '-s -w -X github.com/kyma-project/cli/cmd/kyma/version.Version=$(VERSION) -X github.com/kyma-project/cli/cmd/kyma/install.DefaultKymaVersion=$(KYMA_VERSION)'
.PHONY: resolve
resolve:
go mod tidy
.PHONY: validate
validate:
./hack/verify-lint.sh
./hack/verify-generated-docs.sh
.PHONY: build
build: build-windows build-linux build-darwin
.PHONY: build-windows
build-windows:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ./bin/kyma.exe $(FLAGS) ./cmd
.PHONY: build-linux
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./bin/kyma-linux $(FLAGS) ./cmd
.PHONY: build-darwin
build-darwin:
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ./bin/kyma-darwin $(FLAGS) ./cmd
.PHONY: docs
docs:
go run ./cmd/gendocs/gendocs.go
.PHONY: test
test:
go test -coverprofile=cover.out ./...
@echo "Total test coverage: $$(go tool cover -func=cover.out | grep total | awk '{print $$3}')"
@rm cover.out
.PHONY: integration-test
integration-test:
./bin/kyma-linux help
.PHONY: archive
archive:
cp -r bin/* $(ARTIFACTS)
.PHONY: upload-stable
upload-stable:
ifdef STABLE
gsutil cp bin/* $(KYMA_CLI_STABLE_BUCKET)
endif
.PHONY: release
release:
./hack/release.sh
.PHONY: clean
clean:
rm -rf bin
.PHONY: install
install:
go install $(FLAGS) ./cmd
.PHONY: local
local: validate test install
.PHONY: ci-pr
ci-pr: resolve validate build test integration-test
.PHONY: ci-master
ci-master: resolve validate build test integration-test upload-stable
.PHONY: ci-release
ci-release: resolve validate build test integration-test archive release