forked from kyma-project/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
98 lines (73 loc) · 2.15 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
.DEFAULT_GOAL := local
ifndef VERSION
VERSION = ${shell git describe --tags --always}
endif
ifeq ($(VERSION),stable)
VERSION = stable-${shell git rev-parse --short HEAD}
endif
FLAGS = -ldflags '-s -w -X github.com/kyma-project/cli/cmd/kyma/version.Version=$(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 build-windows-arm build-linux-arm
.PHONY: build-windows
build-windows:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ./bin/kyma.exe $(FLAGS) ./cmd
.PHONY: build-windows-arm
build-windows-arm:
CGO_ENABLED=0 GOOS=windows GOARCH=arm 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-linux-arm
build-linux-arm:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o ./bin/kyma-linux-arm $(FLAGS) ./cmd
.PHONY: build-darwin
build-darwin:
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ./bin/kyma-darwin $(FLAGS) ./cmd
# .PHONY: build-darwin-arm
# build-darwin-arm:
# CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o ./bin/kyma-darwin-arm $(FLAGS) ./cmd
.PHONY: docs
docs:
rm -f ./docs/gen-docs/*
go run ./cmd/gendocs/gendocs.go
.PHONY: test
test:
go test -race -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:
CGO_ENABLED=0 go build -o ./bin/kyma $(FLAGS) ./cmd
mv ./bin/kyma ${GOPATH}/bin
.PHONY: local
local: validate test install
.PHONY: ci-pr
ci-pr: resolve validate build test integration-test
.PHONY: ci-main
ci-main: resolve validate build test integration-test upload-stable
.PHONY: ci-release
ci-release: resolve validate build test integration-test archive release