Skip to content

feat: add wescale wesql cluster workflow #23

feat: add wescale wesql cluster workflow

feat: add wescale wesql cluster workflow #23

name: "Ubuntu Docker Cluster"
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
setup:
name: "Ubuntu Docker Cluster"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Start MySQL Server
run: |
cd ./examples/wesql-server && ./start_mysql_server.sh
- name: Install MySQL client
run: |
sudo apt-get update && sudo apt-get install -y mysql-client
docker logs mysql-server
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.20.1
- name: Compile source
timeout-minutes: 30
run: |
pwd
chmod 777 ./examples/wesql-server/vtdataroot
make failpoint-enable
make build
make failpoint-disable
- name: Start WeScale
run: |
cd ./examples/wesql-server
# 在一个终端会话中运行初始化脚本并通过 tee 输出日志
./init_single_node_cluster.sh 2>&1 | tee init_script_logs.txt &
INIT_PID=$!
# 实时显示日志文件内容
tail -f init_script_logs.txt &
TAIL_PID=$!
echo "Waiting for WeScale to be ready..."
if timeout 10 bash -c 'until nc -z localhost 15306; do sleep 2; echo "Waiting for port 15306..."; done'; then
echo "Port 15306 is now available"
# 停止 tail
kill $TAIL_PID
wait $INIT_PID
echo "Initialization completed successfully"
else
echo "Timeout waiting for port 15306"
# 停止 tail 和初始化脚本
kill $TAIL_PID
kill $INIT_PID
echo "=== Final logs ==="
cat init_script_logs.txt
exit 1
fi
- name: Check Vitess Tablets
if: always()
run: |
# Attempt to connect and execute command, display logs if failed
if ! mysql -h127.0.0.1 -P15306 -uroot -ppasswd -e "show vitess_tablets"; then
echo "Failed to execute MySQL command"
echo "=== Initialization Script Logs ==="
cat ./examples/wesql-server/init_script_logs.txt
exit 1
fi