forked from redhat-developer/odo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
133 lines (110 loc) · 3.28 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
PROJECT := github.com/redhat-developer/odo
GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
PKGS := $(shell go list ./... | grep -v $(PROJECT)/vendor)
BUILD_FLAGS := -ldflags="-w -X $(PROJECT)/cmd.GITCOMMIT=$(GITCOMMIT)"
FILES := odo dist
default: bin
.PHONY: bin
bin:
go build ${BUILD_FLAGS} -o odo main.go
.PHONY: install
install:
go install ${BUILD_FLAGS}
# run all validation tests
.PHONY: validate
validate: gofmt check-vendor vet validate-vendor-licenses #lint
.PHONY: gofmt
gofmt:
./scripts/check-gofmt.sh
.PHONY: check-vendor
check-vendor:
./scripts/check-vendor.sh
.PHONY: validate-vendor-licenses
validate-vendor-licenses:
wwhrd check -q
# golint errors are only recommendations
.PHONY: lint
lint:
golint $(PKGS)
.PHONY: vet
vet:
go vet $(PKGS)
.PHONY: clean
clean:
@rm -rf $(FILES)
# install tools used for building, tests and validations
.PHONY: goget-tools
goget-tools:
go get -u github.com/Masterminds/glide
# go get -u golang.org/x/lint/golint
go get -u github.com/mitchellh/gox
go get github.com/frapposelli/wwhrd
# Run unit tests and collect coverage
.PHONY: test-coverage
test-coverage:
./scripts/generate-coverage.sh
# compile for multiple platforms
.PHONY: cross
cross:
gox -osarch="darwin/amd64 linux/amd64 linux/arm windows/amd64" -output="dist/bin/{{.OS}}-{{.Arch}}/odo" $(BUILD_FLAGS)
.PHONY: generate-cli-structure
generate-cli-structure:
go run scripts/cli-structure/generate-cli-structure.go
.PHONY: generate-cli-reference
generate-cli-reference:
go run scripts/cli-reference/generate-cli-reference.go > docs/cli-reference.md
# create gzipped binaries in ./dist/release/
# for uploading to GitHub release page
# run make cross before this!
.PHONY: prepare-release
prepare-release: cross
./scripts/prepare-release.sh
.PHONY: test
test:
go test -race $(PKGS)
# Run main e2e tests
.PHONY: test-main-e2e
test-main-e2e:
ifdef TIMEOUT
go test -v github.com/redhat-developer/odo/tests/e2e --ginkgo.focus="odoe2e" -ginkgo.v -timeout $(TIMEOUT)
else
go test -v github.com/redhat-developer/odo/tests/e2e --ginkgo.focus="odoe2e" -ginkgo.v
endif
# Run component e2e tests
.PHONY: test-cmp-e2e
test-cmp-e2e:
ifdef TIMEOUT
go test -v github.com/redhat-developer/odo/tests/e2e --ginkgo.focus="odoCmpE2e" -ginkgo.v -timeout $(TIMEOUT)
else
go test -v github.com/redhat-developer/odo/tests/e2e --ginkgo.focus="odoCmpE2e" -ginkgo.v
endif
# Run service catalog e2e tests
.PHONY: test-service-e2e
test-service-e2e:
ifdef TIMEOUT
go test -v github.com/redhat-developer/odo/tests/e2e --ginkgo.focus="odoServiceE2e" -ginkgo.v -timeout $(TIMEOUT)
else
go test -v github.com/redhat-developer/odo/tests/e2e --ginkgo.focus="odoServiceE2e" -ginkgo.v
endif
# Run all e2e tests
.PHONY: test-e2e
test-e2e:
ifdef TIMEOUT
go test -v github.com/redhat-developer/odo/tests/e2e -ginkgo.v -timeout $(TIMEOUT)
else
go test -v github.com/redhat-developer/odo/tests/e2e -ginkgo.v
endif
# create deb and rpm packages using fpm in ./dist/pkgs/
# run make cross before this!
.PHONY: packages
packages:
./scripts/create-packages.sh
# upload packages greated by 'make packages' to bintray repositories
# run 'make cross' and 'make packages' before this!
.PHONY: upload-packages
upload-packages:
./scripts/upload-packages.sh
# Update vendoring
.PHONY: vendor-update
vendor-update:
glide update --strip-vendor