-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
101 lines (80 loc) · 3.81 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
include Makefile.defs
.PHONY: lint-golang
lint-golang:
$(QUIET) scripts/check-go-fmt.sh
$(QUIET) $(GO_VET) ./framework/...
$(QUIET) golangci-lint run
.PHONY: lint-markdown-format
lint-markdown-format:
@$(CONTAINER_ENGINE) container run --rm \
--entrypoint sh -v $(ROOT_DIR):/workdir ghcr.io/igorshubovych/markdownlint-cli:latest \
-c '/usr/local/bin/markdownlint -c /workdir/.github/markdownlint.yaml -p /workdir/.github/markdownlintignore /workdir/' ; \
if (($$?==0)) ; then echo "congratulations ,all pass" ; else echo "error, pealse refer <https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md> " ; fi
.PHONY: fix-markdown-format
fix-markdown-format:
@$(CONTAINER_ENGINE) container run --rm \
--entrypoint sh -v $(ROOT_DIR):/workdir ghcr.io/igorshubovych/markdownlint-cli:latest \
-c '/usr/local/bin/markdownlint -f -c /workdir/.github/markdownlint.yaml -p /workdir/.github/markdownlintignore /workdir/'
.PHONY: lint-yaml
lint-yaml:
@$(CONTAINER_ENGINE) container run --rm \
--entrypoint sh -v $(ROOT_DIR):/data cytopia/yamllint \
-c '/usr/bin/yamllint -c /data/.github/yamllint-conf.yml /data' ; \
if (($$?==0)) ; then echo "congratulations ,all pass" ; else echo "error, pealse refer <https://yamllint.readthedocs.io/en/stable/rules.html> " ; fi
.PHONY: lint-markdown-spell
lint-markdown-spell:
if which mdspell &>/dev/null ; then \
mdspell -r --en-us --ignore-numbers --target-relative .github/.spelling --ignore-acronyms '**/*.md' '!vendor/**/*.md' ; \
else \
$(CONTAINER_ENGINE) container run --rm \
--entrypoint bash -v $(ROOT_DIR):/workdir weizhoulan/spellcheck:latest \
-c "cd /workdir ; mdspell -r --en-us --ignore-numbers --target-relative .github/.spelling --ignore-acronyms '**/*.md' '!vendor/**/*.md' " ; \
fi
.PHONY: lint-markdown-spell-colour
lint-markdown-spell-colour:
if which mdspell &>/dev/null ; then \
mdspell -r --en-us --ignore-numbers --target-relative .github/.spelling --ignore-acronyms '**/*.md' '!vendor/**/*.md' ; \
else \
$(CONTAINER_ENGINE) container run --rm -it \
--entrypoint bash -v $(ROOT_DIR):/workdir weizhoulan/spellcheck:latest \
-c "cd /workdir ; mdspell -r --en-us --ignore-numbers --target-relative .github/.spelling --ignore-acronyms '**/*.md' '!vendor/**/*.md' " ; \
fi
.PHONY: lint-code-spell
lint-code-spell:
$(QUIET) if ! which codespell &> /dev/null ; then \
echo "try to install codespell" ; \
if ! pip3 install codespell ; then \
echo "error, miss tool codespell, install it: pip3 install codespell" ; \
exit 1 ; \
fi \
fi ;\
codespell --config .github/codespell-config
.PHONY: fix-code-spell
fix-code-spell:
$(QUIET) if ! which codespell &> /dev/null ; then \
echo "try to install codespell" ; \
if ! pip3 install codespell ; then \
echo "error, miss tool codespell, install it: pip3 install codespell" ; \
exit 1 ;\
fi \
fi; \
codespell --config .github/codespell-config --write-changes
.PHONY: unitest-tests
unitest-tests:
@echo "run unitest-tests"
docker images
$(QUIET) $(ROOT_DIR)/scripts/ginkgo.sh \
--cover --coverprofile=./coverage.out --covermode set \
--json-report unitestreport.json \
-randomize-suites -randomize-all --keep-going --timeout=1h -p --slow-spec-threshold=120s \
-vv -r ./framework
$(QUIET) go tool cover -html=./coverage.out -o coverage-all.html
.PHONY: check_test_label
check_test_label:
@ALL_TEST_FILE=` find ./ -name "*_test.go" -not -path "./vendor/*" ` ; FAIL="false" ; \
for ITEM in $$ALL_TEST_FILE ; do \
[[ "$$ITEM" == *_suite_test.go ]] && continue ; \
! grep 'Label(' $${ITEM} &>/dev/null && FAIL="true" && echo "error, miss Label in $${ITEM}" ; \
done ; \
[ "$$FAIL" == "true" ] && echo "error, label check fail" && exit 1 ; \
echo "each test.go is labeled right"