feat: add test options

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
Xinwei Xiong(cubxxw-openim)
2023-08-17 17:20:04 +08:00
parent ab91f24fd1
commit a7a880787b
10 changed files with 41 additions and 59 deletions
+17
View File
@@ -22,38 +22,52 @@
# Makefile helper functions for generate necessary files
#
## gen.init: Initialize openim server project ✨
.PHONY: gen.init
gen.init:
@echo "===========> Initializing openim server project"
@${ROOT_DIR}/scripts/init-config.sh
## gen.run: Generate necessary files and docs ✨
.PHONY: gen.run
#gen.run: gen.errcode gen.docgo
gen.run: gen.clean gen.errcode gen.docgo.doc
## gen.errcode: Generate necessary files and docs ✨
.PHONY: gen.errcode
gen.errcode: gen.errcode.code gen.errcode.doc
## gen.errcode.code: Generate openim error code go source files ✨
.PHONY: gen.errcode.code
gen.errcode.code: tools.verify.codegen
@echo "===========> Generating openim error code go source files"
@codegen -type=int ${ROOT_DIR}/internal/pkg/code
## gen.errcode.doc: Generate openim error code markdown documentation ✨
.PHONY: gen.errcode.doc
gen.errcode.doc: tools.verify.codegen
@echo "===========> Generating error code markdown documentation"
@codegen -type=int -doc \
-output ${ROOT_DIR}/docs/guide/zh-CN/api/error_code_generated.md ${ROOT_DIR}/internal/pkg/code
## gen.docgo: Generate missing doc.go for go packages ✨
.PHONY: gen.ca.%
gen.ca.%:
$(eval CA := $(word 1,$(subst ., ,$*)))
@echo "===========> Generating CA files for $(CA)"
@${ROOT_DIR}/scripts/gencerts.sh generate-openim-cert $(OUTPUT_DIR)/cert $(CA)
## gen.ca: Generate CA files for all certificates ✨
.PHONY: gen.ca
gen.ca: $(addprefix gen.ca., $(CERTIFICATES))
## gen.docgo: Generate missing doc.go for go packages ✨
.PHONY: gen.docgo.doc
gen.docgo.doc:
@echo "===========> Generating missing doc.go for go packages"
@${ROOT_DIR}/scripts/gendoc.sh
## gen.docgo.check: Check if there are untracked doc.go files ✨
.PHONY: gen.docgo.check
gen.docgo.check: gen.docgo.doc
@n="$$(git ls-files --others '*/doc.go' | wc -l)"; \
@@ -63,14 +77,17 @@ gen.docgo.check: gen.docgo.doc
false ; \
fi
## gen.docgo.add: Add untracked doc.go files to git index ✨
.PHONY: gen.docgo.add
gen.docgo.add:
@git ls-files --others '*/doc.go' | $(XARGS) -- git add
## gen.docgo: Generate missing doc.go for go packages ✨
.PHONY: gen.defaultconfigs
gen.defaultconfigs:
@${ROOT_DIR}/scripts/gen_default_config.sh
## gen.docgo: Generate missing doc.go for go packages ✨
.PHONY: gen.clean
gen.clean:
@rm -rf ./api/client/{clientset,informers,listers}
+3 -3
View File
@@ -205,12 +205,12 @@ go.format: tools.verify.golines tools.verify.goimports
@$(FIND) -type f -name '*.go' -not -name '*pb*' | $(XARGS) $(TOOLS_DIR)/golines -w --max-len=200 --reformat-tags --shorten-comments --ignore-generated .
@$(GO) mod edit -fmt
## imports: task to automatically handle import packages in Go files using goimports tool
## go.imports: task to automatically handle import packages in Go files using goimports tool
.PHONY: go.imports
go.imports: tools.verify.goimports
@$(TOOLS_DIR)/goimports -l -w $(SRC)
## verify: execute all verity scripts.
## go.verify: execute all verity scripts.
.PHONY: go.verify
go.verify:
@echo "Starting verification..."
@@ -234,7 +234,7 @@ go.clean:
@-rm -vrf $(TMP_DIR) $(BIN_DIR) $(BIN_TOOLS_DIR) $(LOGS_DIR)
@echo "===========> End clean..."
## copyright.help: Show copyright help
## go.help: Show go tools help
.PHONY: go.help
go.help: scripts/make-rules/golang.mk
$(call smallhelp)
+3 -3
View File
@@ -60,11 +60,11 @@ endif
# - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
# - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> then the export will fail)
# To properly provided solutions that supports more than one platform you should use this option.
## Build and push docker image for the manager for cross-platform support
## image.docker-buildx: Build and push docker image for the manager for cross-platform support
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
.PHONY: docker-buildx
docker-buildx:
.PHONY: image.docker-buildx
image.docker-buildx:
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- $(CONTAINER_TOOL) buildx create --name project-v3-builder
$(CONTAINER_TOOL) buildx use project-v3-builder