Skip to content

Commit

Permalink
chore: optimize github_ci (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
ViolaPioggia committed May 8, 2024
1 parent 2ddbf45 commit 5020469
Show file tree
Hide file tree
Showing 51 changed files with 121 additions and 305 deletions.
56 changes: 56 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#### What type of PR is this?
<!--
Add one of the following kinds:
build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
docs: Documentation only changes
feat: A new feature
optimize: A new optimization
fix: A bug fix
perf: A code change that improves performance
refactor: A code change that neither fixes a bug nor adds a feature
style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc)
test: Adding missing tests or correcting existing tests
chore: Changes to the build process or auxiliary tools and libraries such as documentation generation
-->

#### Check the PR title.
<!--
The description of the title will be attached in Release Notes,
so please describe it from user-oriented, what this PR does / why we need it.
Please check your PR title with the below requirements:
-->
- [ ] This PR title match the format: \<type\>(optional scope): \<description\>
- [ ] The description of this PR title is user-oriented and clear enough for others to understand.
- [ ] Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. [User docs repo](https://github.com/cloudwego/cloudwego.github.io)


#### (Optional) Translate the PR title into Chinese.


#### (Optional) More detailed description for this PR(en: English/zh: Chinese).
<!--
Provide more detailed info for review(e.g., it's recommended to provide perf data if this is a perf type PR).
-->
en:
zh(optional):


#### (Optional) Which issue(s) this PR fixes:
<!--
Automatically closes linked issue when PR is merged.
Eg: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

#### (optional) The PR that updates user documentation:
<!--
If the current PR requires user awareness at the usage level, please submit a PR to update user docs. [User docs repo](https://github.com/cloudwego/cloudwego.github.io)
-->


---
zh: 我们需要您为每个新的 example 添加 run.sh 与 test.sh 以便于用户运行和 CI 测试,如果您不知道如何添加,请参考其他 example 的 run.sh 与 test.sh 文件。

en: We need you to add run.sh and test.sh for each new example so that users can run and CI test. If you don't know how to add, please refer to the run.sh and test.sh files of other examples.
```
7 changes: 1 addition & 6 deletions async_call/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="async_call"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

# 启动 server

cd "$REPO_PATH/server" || exit
Expand Down Expand Up @@ -50,7 +45,7 @@ else
fi

# 杀死 server 和 client
kill $server_pid $client_pid
kill -9 $server_pid $client_pid $(lsof -t -i:8888)


# 设置脚本的退出状态
Expand Down
12 changes: 6 additions & 6 deletions basic/example_shop/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="example_shop"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

cd "$REPO_PATH" || exit
docker-compose up -d
cd - > /dev/null || exit
Expand Down Expand Up @@ -65,7 +60,12 @@ else
fi

# 杀死 server 和 client
kill $stock_server_pid $item_server_pid $client_pid
kill -9 $stock_server_pid $item_server_pid $client_pid $(lsof -t -i:8888)

# 停止并删除所有容器
cd "$REPO_PATH" || exit
docker-compose down
cd - > /dev/null || exit


# 设置脚本的退出状态
Expand Down
7 changes: 1 addition & 6 deletions basic/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="basic"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

# 启动 server

cd "$REPO_PATH/server" || exit
Expand Down Expand Up @@ -49,7 +44,7 @@ else
fi

# 杀死 server
kill $server_pid
kill -9 $server_pid $(lsof -t -i:8888)


# 设置脚本的退出状态
Expand Down
12 changes: 6 additions & 6 deletions bizdemo/easy_note/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="easy_note"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

cd "$REPO_PATH" || exit
docker-compose up -d
cd - > /dev/null || exit
Expand Down Expand Up @@ -65,7 +60,12 @@ else
fi

# 杀死 server 和 client
kill $user_server_pid $note_server_pid $server_pid
kill -9 $user_server_pid $note_server_pid $server_pid $(lsof -t -i:8888)

# 停止并删除所有容器
cd "$REPO_PATH" || exit
docker-compose down
cd - > /dev/null || exit


# 设置脚本的退出状态
Expand Down
7 changes: 1 addition & 6 deletions bizdemo/kitex_ent/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="kitex_ent"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

# 启动 server

cd "$REPO_PATH" || exit
Expand All @@ -39,7 +34,7 @@ else
fi

# 杀死 server
kill $server_pid
kill -9 $server_pid $(lsof -t -i:8888)


# 设置脚本的退出状态
Expand Down
7 changes: 1 addition & 6 deletions bizdemo/kitex_gorm/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="kitex_gorm"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

# 启动 server

cd "$REPO_PATH" || exit
Expand All @@ -39,7 +34,7 @@ else
fi

# 杀死 server
kill $server_pid
kill -9 $server_pid $(lsof -t -i:8888)


# 设置脚本的退出状态
Expand Down
7 changes: 1 addition & 6 deletions bizdemo/kitex_gorm_gen/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="kitex_gorm_gen"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

# 启动 server

cd "$REPO_PATH" || exit
Expand All @@ -39,7 +34,7 @@ else
fi

# 杀死 server
kill $server_pid
kill -9 $server_pid $(lsof -t -i:8888)


# 设置脚本的退出状态
Expand Down
7 changes: 1 addition & 6 deletions bizdemo/kitex_zorm/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="kitex_zorm"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

# 启动 server

cd "$REPO_PATH" || exit
Expand All @@ -39,7 +34,7 @@ else
fi

# 杀死 server
kill $server_pid
kill -9 $server_pid $(lsof -t -i:8888)


# 设置脚本的退出状态
Expand Down
7 changes: 1 addition & 6 deletions business_exception/TTHeader/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="business_exception_TTHeader"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

# 启动 server

cd "$REPO_PATH/server" || exit
Expand Down Expand Up @@ -50,7 +45,7 @@ else
fi

# 杀死 server
kill $server_pid
kill -9 $server_pid $(lsof -t -i:8888)


# 设置脚本的退出状态
Expand Down
7 changes: 1 addition & 6 deletions business_exception/gRPC/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="business_exception_gRPC"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

# 启动 server

cd "$REPO_PATH/server" || exit
Expand Down Expand Up @@ -50,7 +45,7 @@ else
fi

# 杀死 server
kill $server_pid
kill -9 $server_pid $(lsof -t -i:8888)


# 设置脚本的退出状态
Expand Down
7 changes: 1 addition & 6 deletions codec/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="codec"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

# 启动 server

cd "$REPO_PATH/server" || exit
Expand Down Expand Up @@ -50,7 +45,7 @@ else
fi

# 杀死 server 和 client
kill $server_pid $client_pid
kill -9 $server_pid $client_pid $(lsof -t -i:8888)


# 设置脚本的退出状态
Expand Down
7 changes: 1 addition & 6 deletions discovery/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="discovery"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

# 启动 server

cd "$REPO_PATH/server" || exit
Expand Down Expand Up @@ -50,7 +45,7 @@ else
fi

# 杀死 server 和 client
kill $server_pid $client_pid
kill -9 $server_pid $client_pid $(lsof -t -i:8888)


# 设置脚本的退出状态
Expand Down
7 changes: 1 addition & 6 deletions frugal/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="frugal"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

# 启动 server

go run . > /dev/null 2>&1 &
Expand Down Expand Up @@ -47,7 +42,7 @@ else
fi

# 杀死 server
kill $server_pid
kill -9 $server_pid $(lsof -t -i:8888)


# 设置脚本的退出状态
Expand Down
7 changes: 1 addition & 6 deletions generic-protobuf/jsonpb-client/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="generic-protobuf"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

# 启动 server 和 client

cd "$REPO_PATH" || exit
Expand All @@ -39,7 +34,7 @@ else
fi

# 杀死 server 和 client
kill $pid
kill -9 $pid $(lsof -t -i:8888)


# 设置脚本的退出状态
Expand Down
7 changes: 1 addition & 6 deletions generic/binary/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ project="generic_binary"
echo "---------------------------------------"
echo "Running project: $project"

# 检查端口是否被占用
if lsof -Pi :8888 -sTCP:LISTEN -t >/dev/null ; then
kill -9 $(lsof -t -i:8888)
fi

# 启动 server

cd "$REPO_PATH/server" || exit
Expand Down Expand Up @@ -50,7 +45,7 @@ else
fi

# 杀死 server 和 client
kill $server_pid $client_pid
kill -9 $server_pid $client_pid $(lsof -t -i:8888)


# 设置脚本的退出状态
Expand Down

0 comments on commit 5020469

Please sign in to comment.