feat: migrate the original main branch code

Signed-off-by: kubbot & kubecub <3293172751ysy@gmail.com>
This commit is contained in:
kubbot & kubecub
2023-06-30 09:56:10 +08:00
parent e8ff01790b
commit 6f3d17b927
15 changed files with 568 additions and 73 deletions
+29 -10
View File
@@ -17,7 +17,7 @@
# Why download to the tools directory, thinking we might often switch Go versions using gvm.
#
# sealer build use BUILD_TOOLS
# openim build use BUILD_TOOLS
BUILD_TOOLS ?= golangci-lint goimports addlicense deepcopy-gen conversion-gen ginkgo go-junit-report go-gitlint
# Code analysis tools
ANALYSIS_TOOLS = golangci-lint goimports golines go-callvis kube-score
@@ -25,16 +25,18 @@ ANALYSIS_TOOLS = golangci-lint goimports golines go-callvis kube-score
GENERATION_TOOLS = deepcopy-gen conversion-gen protoc-gen-go cfssl rts codegen
# Testing tools
TEST_TOOLS = ginkgo go-junit-report gotests
# tenxun cos tools
COS_TOOLS = coscli coscmd
# Version control tools
VERSION_CONTROL_TOOLS = addlicense go-gitlint git-chglog github-release gsemver
# Utility tools
UTILITY_TOOLS = go-mod-outdated mockgen gothanks richgo kubeconform
# All tools
ALL_TOOLS ?= $(ANALYSIS_TOOLS) $(GENERATION_TOOLS) $(TEST_TOOLS) $(VERSION_CONTROL_TOOLS) $(UTILITY_TOOLS)
ALL_TOOLS ?= $(ANALYSIS_TOOLS) $(GENERATION_TOOLS) $(TEST_TOOLS) $(VERSION_CONTROL_TOOLS) $(UTILITY_TOOLS) $(COS_TOOLS)
## tools.install: Install a must tools
.PHONY: tools.install
tools.install: $(addprefix tools.install., $(BUILD_TOOLS))
tools.install: $(addprefix tools.verify., $(BUILD_TOOLS))
## tools.install-all: Install all tools
.PHONY: tools.install-all
@@ -59,8 +61,8 @@ tools.verify.%:
@if [ ! -f $(TOOLS_DIR)/$* ]; then GOBIN=$(TOOLS_DIR) $(MAKE) tools.install.$*; fi
@echo "===========> $* is install in $(TOOLS_DIR)/$*"
.PHONY:
## install.golangci-lint: Install golangci-lint
.PHONY: install.golangci-lint
install.golangci-lint:
@$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@@ -69,7 +71,6 @@ install.golangci-lint:
install.goimports:
@$(GO) install golang.org/x/tools/cmd/goimports@latest
# Actions path: https://github.com/sealerio/sealer/tree/main/.github/workflows/go.yml#L37-L50
## install.addlicense: Install addlicense, used to add license header to source files
.PHONY: install.addlicense
install.addlicense:
@@ -129,6 +130,29 @@ install.git-chglog:
install.github-release:
@$(GO) install github.com/github-release/github-release@latest
## install.coscli: Install coscli, used to upload files to cos
# example: ./coscli cp/sync -r /home/off-line/docker-off-line/ cos://openim-1306374445/openim/image/amd/off-line/off-line/ -e cos.ap-guangzhou.myqcloud.com
# https://cloud.tencent.com/document/product/436/71763
.PHONY: install.coscli
install.coscli:
@wget -q https://ghproxy.com/https://github.com/tencentyun/coscli/releases/download/v0.13.0-beta/coscli-linux -O ${TOOLS_DIR}/coscli
@chmod +x ${TOOLS_DIR}/coscli
## install.coscmd: Install coscmd, used to upload files to cos
.PHONY: install.coscmd
install.coscmd:
@if which pip &>/dev/null; then pip install coscmd; else pip3 install coscmd; fi
## install.delve: Install delve, used to debug go program
.PHONY: install.delve
install.delve:
@$(GO) install github.com/go-delve/delve/cmd/dlv@latest
## install.air: Install air, used to hot reload go program
.PHONY: install.air
install.air:
@$(GO) install github.com/cosmtrek/air@latest
## install.gvm: Install gvm, gvm is a Go version manager, built on top of the official go tool.
# github: https://github.com/moovweb/gvm
.PHONY: install.gvm
@@ -192,11 +216,6 @@ install.richgo:
install.rts:
@$(GO) install github.com/galeone/rts/cmd/rts@latest
## install.codegen: Install code generator, used to generate code
.PHONY: install.codegen
install.codegen:
@$(GO) install ${ROOT_DIR}/tools/codegen/codegen.go
## tools.help: Display help information about the tools package
.PHONY: tools.help
tools.help: script/make-rules/tools.mk