-
Notifications
You must be signed in to change notification settings - Fork 38
/
Makefile
61 lines (48 loc) · 1.3 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
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
.PHONY: help
help:
@echo "fmt re-format source codes."
@echo "build build binary from source code as './bin/ucloud-cli'."
@echo "test run unit test cases."
@echo "test-acc run acc test cases."
@echo "test-cov run unit test cases with coverage reporting."
.PHONY: fmt
fmt:
gofmt -w -s $(GOFMT_FILES)
.PHONY: fmtcheck
fmtcheck:
@bash $(CURDIR)/scripts/gofmtcheck.sh
.PHONY: lint
lint:
go vet ./...
.PHONY: test
test: fmtcheck vet
go test -v ./ucloud/... ./external/... --parallel=16
.PHONY: test-acc
test-acc: fmtcheck vet
go test -v ./tests/... --parallel=32
.PHONY: test-cov
test-cov: fmtcheck
go test -cover -coverprofile=coverage.txt ./ucloud/... --parallel=32
.PHONY: cov-preview
cov-preview:
go tool cover -html=coverage.txt
.PHONY: cyclo
cyclo:
gocyclo -over 15 ucloud/ services/ external/
# UCloud Tools Path
UCLOUD_TEMPLATE_PATH=../ucloud-api-model-v2/apisdk/lang/go/templates
.PHONY: gen
gen: gen-api gen-test
@echo "generate code success"
gen-api:
ucloud-model sdk apis \
--lang go \
--type public \
--template ${UCLOUD_TEMPLATE_PATH}/scripts-api.tpl \
--output ./scripts/gen-apis.sh
gen-test:
ucloud-model sdk tests \
--lang go \
--template ${UCLOUD_TEMPLATE_PATH}/scripts-test.tpl \
--output ./scripts/gen-tests.sh