mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-27 05:52:29 +08:00
feat: add test options
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
parent
ab91f24fd1
commit
a7a880787b
4
.github/workflows/scripts-test.yml
vendored
4
.github/workflows/scripts-test.yml
vendored
@ -61,8 +61,8 @@ jobs:
|
||||
|
||||
- name: Build all services
|
||||
run: |
|
||||
sudo chmod +x ./scripts/build_all_service.sh
|
||||
sudo ./scripts/build_all_service.sh
|
||||
sudo chmod +x ./scripts/build-all-service.sh
|
||||
sudo ./scripts/build-all-service.sh
|
||||
sudo cat logs/openIM.log 2>/dev/null
|
||||
shell: bash
|
||||
|
||||
|
||||
@ -28,4 +28,4 @@ COPY --from=builder ${OPENIM_SERVER_CMDDIR} /openim/openim-server/scripts
|
||||
COPY --from=builder ${SERVER_WORKDIR}/config /openim/openim-server/config
|
||||
COPY --from=builder ${OPENIM_SERVER_BINDIR} /openim/openim-server/_output/bin
|
||||
|
||||
CMD ["bash","-c","${OPENIM_SERVER_CMDDIR}/docker-start-all-all.sh"]
|
||||
CMD ["bash","-c","${OPENIM_SERVER_CMDDIR}/docker-start-all.sh"]
|
||||
|
||||
5
Makefile
5
Makefile
@ -53,6 +53,11 @@ export USAGE_OPTIONS
|
||||
# ==============================================================================
|
||||
# Targets
|
||||
|
||||
## init: Initialize openim server project ✨
|
||||
.PHONY: init
|
||||
init:
|
||||
@$(MAKE) gen.init
|
||||
|
||||
## demo: Run demo get started with Makefiles quickly ✨
|
||||
.PHONY: demo
|
||||
demo:
|
||||
|
||||
@ -32,7 +32,7 @@ scripts/
|
||||
├── advertise.sh # Script for advertisement services
|
||||
├── batch_start-all.sh # Script to start all services in batch
|
||||
├── build.cmd # Windows build command script
|
||||
├── build_all_service.sh # Script to build all services
|
||||
├── build-all-service.sh # Script to build all services
|
||||
├── build_push_k8s_images.sh # Script to build and push images for Kubernetes
|
||||
├── check_all.sh # Script to check status of all services
|
||||
├── common.sh # Contains common functions used by other scripts
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
# WHAT: Directory names to build. If any of these directories has a 'main'
|
||||
# package, the build will produce executable files under $(OUT_DIR)/bin/platforms OR $(OUT_DIR)/bin—tools/platforms.
|
||||
# If not specified, "everything" will be built.
|
||||
# Usage: `scripts/build_all_service.sh`.
|
||||
# Usage: `scripts/build-all-service.sh`.
|
||||
# Example: `hack/build-go.sh WHAT=cmd/kubelet`.
|
||||
|
||||
set -o errexit
|
||||
@ -58,15 +58,15 @@ openim::color::echo $COLOR_CYAN "NOTE: $0 has been replaced by 'make multiarch'
|
||||
echo
|
||||
echo "The equivalent of this invocation is: "
|
||||
echo " make build ${ARGHELP}"
|
||||
echo " ./scripts/build_all_service.sh ${ARGHELP}"
|
||||
echo " ./scripts/build-all-service.sh ${ARGHELP}"
|
||||
echo
|
||||
echo " Example: "
|
||||
echo " Print a single binary:"
|
||||
echo " make build BINS=openim-api"
|
||||
echo " ./scripts/build_all_service.sh BINS=openim-api"
|
||||
echo " ./scripts/build-all-service.sh BINS=openim-api"
|
||||
echo " Print : Enable debugging and logging"
|
||||
echo " make build BINS=openim-api V=1 DEBUG=1"
|
||||
echo " ./scripts/build_all_service.sh BINS=openim-api V=1 DEBUG=1"
|
||||
echo " ./scripts/build-all-service.sh BINS=openim-api V=1 DEBUG=1"
|
||||
echo
|
||||
|
||||
if [ -z "$*" ]; then
|
||||
@ -17,53 +17,13 @@
|
||||
#fixme This scripts is the total startup scripts
|
||||
#fixme The full name of the shell scripts that needs to be started is placed in the need_to_start_server_shell array
|
||||
|
||||
#Include shell font styles and some basic information
|
||||
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
trap 'openim::util::onCtrlC' INT
|
||||
|
||||
#fixme Put the shell scripts name here
|
||||
need_to_start_server_shell=(
|
||||
${SCRIPTS_ROOT}/openim-rpc.sh
|
||||
${SCRIPTS_ROOT}/openim-msggateway.sh
|
||||
${SCRIPTS_ROOT}/openim-push.sh
|
||||
${SCRIPTS_ROOT}/openim-msgtransfer.sh
|
||||
${SCRIPTS_ROOT}/openim-crontask.sh
|
||||
)
|
||||
nohup ${OPENIM_ROOT}/scripts/start-all.sh > ${LOG_FILE} 2>&1 &
|
||||
|
||||
component_check=start_component_check.sh
|
||||
chmod +x $SCRIPTS_ROOT/$component_check
|
||||
$SCRIPTS_ROOT/$component_check
|
||||
if [ $? -ne 0 ]; then
|
||||
# Print error message and exit
|
||||
echo "${BOLD_PREFIX}${RED_PREFIX}Error executing ${component_check}. Exiting...${COLOR_SUFFIX}"
|
||||
exit -1
|
||||
fi
|
||||
nohup ${OPENIM_ROOT}/scripts/check-all.sh > ${LOG_FILE} 2>&1 &
|
||||
|
||||
#fixme The 10 second delay to start the project is for the docker-compose one-click to start openIM when the infrastructure dependencies are not started
|
||||
|
||||
sleep 10
|
||||
time=`date +"%Y-%m-%d %H:%M:%S"`
|
||||
echo "==========================================================">>$OPENIM_ROOT/logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$OPENIM_ROOT/logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$OPENIM_ROOT/logs/openIM.log 2>&1 &
|
||||
echo "==========server start time:${time}===========">>$OPENIM_ROOT/logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$OPENIM_ROOT/logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$OPENIM_ROOT/logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$OPENIM_ROOT/logs/openIM.log 2>&1 &
|
||||
for i in ${need_to_start_server_shell[*]}; do
|
||||
$i
|
||||
done
|
||||
|
||||
sleep 15
|
||||
|
||||
#fixme prevents the openIM service exit after execution in the docker container
|
||||
tail -f /dev/null
|
||||
|
||||
# nohup ./bin/seata-server.sh > ./logs/seata.log.out 2>&1 &
|
||||
|
||||
# # seata注册到nacos的ip和端口,不配置默认获取本机ip(docker容器ip)
|
||||
# echo $SEATA_IP $SEATA_PORT
|
||||
|
||||
# tail -f logs/seata.log.out
|
||||
tail -f ${LOG_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}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -26,7 +26,7 @@ set +o errexit
|
||||
openim::golang::check_openim_binaries
|
||||
if [[ $? -ne 0 ]]; then
|
||||
openim::log::error "OpenIM binaries are not found. Please run 'make build' to build binaries."
|
||||
${OPENIM_ROOT}/scripts/build_all_service.sh
|
||||
${OPENIM_ROOT}/scripts/build-all-service.sh
|
||||
fi
|
||||
set -o errexit
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user