forked from redhat-developer/odo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
210 lines (168 loc) · 6.91 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
PROJECT := github.com/openshift/odo
GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
PKGS := $(shell go list ./... | grep -v $(PROJECT)/vendor | grep -v $(PROJECT)/tests )
COMMON_FLAGS := -X $(PROJECT)/pkg/odo/cli/version.GITCOMMIT=$(GITCOMMIT)
BUILD_FLAGS := -ldflags="-w $(COMMON_FLAGS)"
DEBUG_BUILD_FLAGS := -ldflags="$(COMMON_FLAGS)"
FILES := odo dist
TIMEOUT ?= 1800s
# Env variable TEST_EXEC_NODES is used to pass spec execution type
# (parallel or sequential) for ginkgo tests. To run the specs sequentially use
# TEST_EXEC_NODES=1, otherwise by default the specs are run in parallel on 4 ginkgo test node.
# NOTE: Any TEST_EXEC_NODES value greater than one runs the spec in parallel
# on the same number of ginkgo test nodes.
TEST_EXEC_NODES ?= 4
# Slow spec threshold for ginkgo tests. After this time (in second), ginkgo marks test as slow
SLOW_SPEC_THRESHOLD := 120
default: bin
.PHONY: debug
debug:
go build ${DEBUG_BUILD_FLAGS} cmd/odo/odo.go
.PHONY: bin
bin:
go build ${BUILD_FLAGS} cmd/odo/odo.go
.PHONY: install
install:
go install ${BUILD_FLAGS} ./cmd/odo/
# 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
go get -u github.com/onsi/ginkgo/ginkgo
# 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 windows/amd64" -output="dist/bin/{{.OS}}-{{.Arch}}/odo" $(BUILD_FLAGS) ./cmd/odo/
.PHONY: generate-cli-structure
generate-cli-structure:
go run cmd/cli-doc/cli-doc.go structure
.PHONY: generate-cli-reference
generate-cli-reference:
go run cmd/cli-doc/cli-doc.go reference > docs/cli-reference.adoc
# 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: configure-installer-tests-cluster
configure-installer-tests-cluster:
. ./scripts/configure-installer-tests-cluster.sh
.PHONY: test
test:
go test -race $(PKGS)
# -randomizeAllSpecs - If set, ginkgo will randomize all specs together.
# By default, ginkgo only randomizes the top level Describe, Context and When groups.
# Run generic integration tests
.PHONY: test-generic
test-generic:
go test -v github.com/openshift/odo/tests/integration --ginkgo.focus="odo generic" -ginkgo.slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -ginkgo.v -timeout $(TIMEOUT)
# Run json outout tests
.PHONY: test-json-format-output
test-json-format-output:
ginkgo -v -nodes=$(TEST_EXEC_NODES) -focus="odojsonoutput" slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -randomizeAllSpecs tests/integration/ -timeout $(TIMEOUT)
# Run component e2e tests
.PHONY: test-cmp-e2e
test-cmp-e2e:
ginkgo -v -nodes=$(TEST_EXEC_NODES) -focus="odoCmpE2e" slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -randomizeAllSpecs tests/integration/ -timeout $(TIMEOUT)
# Run component subcommands e2e tests
.PHONY: test-cmp-sub-e2e
test-cmp-sub-e2e:
ginkgo -v -nodes=$(TEST_EXEC_NODES) -focus="odoCmpE2e" slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -randomizeAllSpecs tests/integration/ -timeout $(TIMEOUT)
# Run java e2e tests
.PHONY: test-java-e2e
test-java-e2e:
go test -v github.com/openshift/odo/tests/integration --ginkgo.focus="odoJavaE2e" -ginkgo.slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -ginkgo.v -timeout $(TIMEOUT)
# Run source e2e tests
.PHONY: test-source-e2e
test-source-e2e:
go test -v github.com/openshift/odo/tests/integration --ginkgo.focus="odoSourceE2e" -ginkgo.slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -ginkgo.v -timeout $(TIMEOUT)
# Run service catalog e2e tests
.PHONY: test-service-e2e
test-service-e2e:
go test -v github.com/openshift/odo/tests/integration --ginkgo.focus="odoServiceE2e" -ginkgo.slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -ginkgo.v -timeout $(TIMEOUT)
# Run link e2e tests
.PHONY: test-link-e2e
test-link-e2e:
go test -v github.com/openshift/odo/tests/integration --ginkgo.focus="odoLinkE2e" -ginkgo.slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -ginkgo.v -timeout $(TIMEOUT)
# Run watch e2e tests
.PHONY: test-watch-e2e
test-watch-e2e:
ginkgo -v -nodes=$(TEST_EXEC_NODES) -focus="odoWatchE2e" slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -randomizeAllSpecs tests/integration/ -timeout $(TIMEOUT)
# Run storage command integration tests
.PHONY: test-cmd-storage
test-cmd-storage:
ginkgo -v -nodes=$(TEST_EXEC_NODES) -focus="odo storage command" slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -randomizeAllSpecs tests/integration/ -timeout $(TIMEOUT)
# Run odo app cmd tests
.PHONY: test-cmd-app
test-cmd-app:
ginkgo -v -nodes=$(TEST_EXEC_NODES) -focus="odoCmdApp" slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -randomizeAllSpecs tests/integration/ -timeout $(TIMEOUT)
# Run login e2e tests
.PHONY: test-odo-login-e2e
test-odo-login-e2e:
go test -v github.com/openshift/odo/tests/integration --ginkgo.focus="odoLoginE2e" -ginkgo.slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -ginkgo.v -timeout $(TIMEOUT)
# Run config tests
.PHONY: test-odo-config
test-odo-config:
go test -v github.com/openshift/odo/tests/integration --ginkgo.focus="odo config test" -ginkgo.slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -ginkgo.v -timeout $(TIMEOUT)
# Run all integration tests
.PHONY: test-integration
test-integration:
go test -v github.com/openshift/odo/tests/integration -ginkgo.slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -ginkgo.v -timeout $(TIMEOUT)
# Run e2e test scenarios
.PHONY: test-e2e-scenarios
test-e2e-scenarios:
go test -v github.com/openshift/odo/tests/e2escenarios -ginkgo.slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -ginkgo.v -timeout $(TIMEOUT)
# this test shouldn't be in paralel - it will effect the results
.PHONY: test-benchmark
test-benchmark:
go test -v github.com/openshift/odo/tests/benchmark -timeout $(TIMEOUT)
# 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
.PHONY: openshiftci-presubmit-e2e
openshiftci-presubmit-e2e:
./scripts/openshiftci-presubmit-e2e.sh
.PHONY: openshiftci-presubmit-unittests
openshiftci-presubmit-unittests:
./scripts/openshiftci-presubmit-unittests.sh