mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-06 18:15:59 +08:00
feat: set openim lint
Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
+58
-58
@@ -14,9 +14,9 @@
|
||||
# limitations under the License.
|
||||
|
||||
# Description:
|
||||
# This script automates the process of building and releasing OpenIM,
|
||||
# This script automates the process of building and releasing OpenIM,
|
||||
# including tasks like setting up the environment, verifying prerequisites,
|
||||
# building commands, packaging tarballs, uploading tarballs, creating GitHub
|
||||
# building commands, packaging tarballs, uploading tarballs, creating GitHub
|
||||
# releases, and generating changelogs.
|
||||
#
|
||||
# Usage:
|
||||
@@ -35,12 +35,12 @@
|
||||
# This script can also be executed via the 'make release' command as an alternative.
|
||||
#
|
||||
# Dependencies:
|
||||
# This script depends on external scripts found in the 'scripts' directory and
|
||||
# assumes the presence of necessary tools and permissions for building and
|
||||
# This script depends on external scripts found in the 'scripts' directory and
|
||||
# assumes the presence of necessary tools and permissions for building and
|
||||
# releasing software.
|
||||
#
|
||||
# Note:
|
||||
# The script uses standard bash script practices with error handling,
|
||||
# The script uses standard bash script practices with error handling,
|
||||
# and it defaults to executing all steps if no specific option is provided.
|
||||
#
|
||||
# Build a OpenIM release. This will build the binaries, create the Docker
|
||||
@@ -58,17 +58,17 @@ OPENIM_RELEASE_RUN_TESTS=${OPENIM_RELEASE_RUN_TESTS-y}
|
||||
|
||||
# Function to show help message
|
||||
show_help() {
|
||||
echo "Usage: $(basename $0) [options]"
|
||||
echo "Options:"
|
||||
echo " -h, --help Show this help message"
|
||||
echo " -se, --setup-env Execute setup environment"
|
||||
echo " -vp, --verify-prereqs Execute prerequisites verification"
|
||||
echo " -bc, --build-command Execute build command"
|
||||
echo " -bi, --build-image Execute build image (default: not executed)"
|
||||
echo " -pt, --package-tarballs Execute package tarballs"
|
||||
echo " -ut, --upload-tarballs Execute upload tarballs"
|
||||
echo " -gr, --github-release Execute GitHub release"
|
||||
echo " -gc, --generate-changelog Execute generate changelog"
|
||||
echo "Usage: $(basename $0) [options]"
|
||||
echo "Options:"
|
||||
echo " -h, --help Show this help message"
|
||||
echo " -se, --setup-env Execute setup environment"
|
||||
echo " -vp, --verify-prereqs Execute prerequisites verification"
|
||||
echo " -bc, --build-command Execute build command"
|
||||
echo " -bi, --build-image Execute build image (default: not executed)"
|
||||
echo " -pt, --package-tarballs Execute package tarballs"
|
||||
echo " -ut, --upload-tarballs Execute upload tarballs"
|
||||
echo " -gr, --github-release Execute GitHub release"
|
||||
echo " -gc, --generate-changelog Execute generate changelog"
|
||||
}
|
||||
|
||||
# Initialize all actions to false
|
||||
@@ -83,57 +83,57 @@ perform_generate_changelog=false
|
||||
|
||||
# Process command-line arguments
|
||||
while getopts "hsevpbciptutgrgc-" opt; do
|
||||
case "${opt}" in
|
||||
h) show_help; exit 0 ;;
|
||||
se) perform_setup_env=true ;;
|
||||
vp) perform_verify_prereqs=true ;;
|
||||
bc) perform_build_command=true ;;
|
||||
bi) perform_build_image=true ;; # Handling new option
|
||||
pt) perform_package_tarballs=true ;;
|
||||
ut) perform_upload_tarballs=true ;;
|
||||
gr) perform_github_release=true ;;
|
||||
gc) perform_generate_changelog=true ;;
|
||||
--) case "${OPTARG}" in
|
||||
help) show_help; exit 0 ;;
|
||||
setup-env) perform_setup_env=true ;;
|
||||
verify-prereqs) perform_verify_prereqs=true ;;
|
||||
build-command) perform_build_command=true ;;
|
||||
build-image) perform_build_image=true ;; # Handling new long option
|
||||
package-tarballs) perform_package_tarballs=true ;;
|
||||
upload-tarballs) perform_upload_tarballs=true ;;
|
||||
github-release) perform_github_release=true ;;
|
||||
generate-changelog) perform_generate_changelog=true ;;
|
||||
*) echo "Invalid option: --${OPTARG}"; show_help; exit 1 ;;
|
||||
esac ;;
|
||||
*) show_help; exit 1 ;;
|
||||
esac
|
||||
case "${opt}" in
|
||||
h) show_help; exit 0 ;;
|
||||
se) perform_setup_env=true ;;
|
||||
vp) perform_verify_prereqs=true ;;
|
||||
bc) perform_build_command=true ;;
|
||||
bi) perform_build_image=true ;; # Handling new option
|
||||
pt) perform_package_tarballs=true ;;
|
||||
ut) perform_upload_tarballs=true ;;
|
||||
gr) perform_github_release=true ;;
|
||||
gc) perform_generate_changelog=true ;;
|
||||
--) case "${OPTARG}" in
|
||||
help) show_help; exit 0 ;;
|
||||
setup-env) perform_setup_env=true ;;
|
||||
verify-prereqs) perform_verify_prereqs=true ;;
|
||||
build-command) perform_build_command=true ;;
|
||||
build-image) perform_build_image=true ;; # Handling new long option
|
||||
package-tarballs) perform_package_tarballs=true ;;
|
||||
upload-tarballs) perform_upload_tarballs=true ;;
|
||||
github-release) perform_github_release=true ;;
|
||||
generate-changelog) perform_generate_changelog=true ;;
|
||||
*) echo "Invalid option: --${OPTARG}"; show_help; exit 1 ;;
|
||||
esac ;;
|
||||
*) show_help; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Enable all actions by default if no options are provided
|
||||
if [ "$#" -eq 0 ]; then
|
||||
perform_setup_env=true
|
||||
perform_verify_prereqs=true
|
||||
perform_build_command=true
|
||||
perform_package_tarballs=true
|
||||
perform_upload_tarballs=true
|
||||
perform_github_release=true
|
||||
perform_generate_changelog=true
|
||||
# TODO: Not enabling build_image by default
|
||||
# perform_build_image=true
|
||||
perform_setup_env=true
|
||||
perform_verify_prereqs=true
|
||||
perform_build_command=true
|
||||
perform_package_tarballs=true
|
||||
perform_upload_tarballs=true
|
||||
perform_github_release=true
|
||||
perform_generate_changelog=true
|
||||
# TODO: Not enabling build_image by default
|
||||
# perform_build_image=true
|
||||
fi
|
||||
|
||||
# Function to perform actions
|
||||
perform_action() {
|
||||
local flag=$1
|
||||
local message=$2
|
||||
local command=$3
|
||||
|
||||
if [ "$flag" == true ]; then
|
||||
openim::log::info "## $message..."
|
||||
if ! $command; then
|
||||
openim::log::errexit "Error in $message"
|
||||
fi
|
||||
local flag=$1
|
||||
local message=$2
|
||||
local command=$3
|
||||
|
||||
if [ "$flag" == true ]; then
|
||||
openim::log::info "## $message..."
|
||||
if ! eval "$command"; then
|
||||
openim::log::errexit "Error in $message"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Starting script execution..."
|
||||
|
||||
Reference in New Issue
Block a user