后端资源超时时间允许最小20ms #2115
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: ["main", "dev_icy"] | |
pull_request: | |
branches: ["main"] | |
env: | |
CARGO_TERM_COLOR: always | |
redis: localhost:56810 | |
redis_with_slave: localhost:56812 | |
counterservice: localhost:9302 | |
mc: localhost:9301 | |
phantom: localhost:9303 | |
mysql: localhost:3306 | |
vector: localhost:3308 | |
mq: localhost:56815 | |
min_key: 1 | |
max_key: 10000 | |
socks_dir: /home/runner/work/breeze/socks | |
RUSTFLAGS: "-D warnings" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Mysql start and init | |
run: | | |
docker run --rm --name breeze_ci_mysql4623 -p 4623:3306 -d parabala/mysqlci_with_schema:v0.0.2 | |
docker run --rm --name breeze_ci_mysql4624 -p 4624:3306 -d parabala/mysqlci_with_schema:v0.0.2 | |
- name: Prepare Vintage_MC_Redis | |
run: docker run -d -v /home/runner/work/breeze:/data1/resource/breeze --net="host" --name breeze_github_ci hustfisher/breeze:githubci115 | |
- uses: actions/checkout@v3 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Build | |
run: cargo build | |
- name: Check Vintage | |
run: | | |
docker ps -a | |
curl http://127.0.0.1:8080/config/cloud/redis/testbreeze/redismeshtest | |
curl http://127.0.0.1:8080/config/v1/cache.service.testbreeze.pool.yf/all | |
sleep 1 | |
curl http://127.0.0.1:8080/config/cloud/counterservice/testbreeze/meshtest | |
curl http://127.0.0.1:8080/config/cloud/phantom/testbreeze/phantomtest | |
sleep 1 | |
curl http://127.0.0.1:8080/config/cloud/mq/testbreeze/mcqmeshtest_1 | |
curl http://127.0.0.1:8080/config/cloud/kv/testbreeze/kvmeshtest | |
sleep 1 | |
curl http://127.0.0.1:8080/config/cloud/vector/testbreeze/vectortest | |
- name: Create Socks | |
run: | | |
#ps -aux|grep breeze | |
mkdir -p /home/runner/work/breeze/logs | |
mkdir -p /home/runner/work/breeze/snapshot | |
mkdir -p /home/runner/work/breeze/socks | |
touch /home/runner/work/breeze/socks/127.0.0.1:8080+config+cloud+redis+testbreeze+redismeshtest@redis:56810@rs | |
touch /home/runner/work/breeze/socks/127.0.0.1:8080+config+cloud+redis+testbreeze+redismeshtestm@redis:56812@rs | |
touch /home/runner/work/breeze/socks/127.0.0.1:8080+config+v1+cache.service.testbreeze.pool.yf+all:meshtest@mc:9301@cs | |
touch /home/runner/work/breeze/socks/127.0.0.1:8080+config+cloud+counterservice+testbreeze+meshtest@redis:9302@rs | |
touch /home/runner/work/breeze/socks/127.0.0.1:8080+config+cloud+phantom+testbreeze+phantomtest@phantom:9303@pt | |
touch /home/runner/work/breeze/socks/127.0.0.1:8080+config+cloud+kv+testbreeze+kvmeshtest@kv:3306@kv | |
touch /home/runner/work/breeze/socks/127.0.0.1:8080+config+cloud+vector+testbreeze+vectortest@vector:3308@vector | |
touch /home/runner/work/breeze/socks/127.0.0.1:8080+config+cloud+mq+testbreeze+mcqmeshtest_1@msgque:56815@mq | |
ls -all /home/runner/work/breeze/snapshot | |
ls -all /home/runner/work/breeze/socks | |
ls -all /home/runner/work/breeze/logs | |
ls -all ./target/debug/agent | |
- name: Run | |
run: nohup ./target/debug/agent --discovery vintage://127.0.0.1:8080 --snapshot /home/runner/work/breeze/snapshot --service-path /home/runner/work/breeze/socks --log-dir /home/runner/work/breeze/logs --port 9984 --metrics-probe 8.8.8.8:53 --log-level info --idc-path 127.0.0.1:8080/3/config/breeze/idc_region --key-path=.github/workflows/private_key.pem > /home/runner/work/breeze/logs/log.file 2>&1 & | |
- name: Check Status | |
run: | | |
sleep 6s | |
netstat -nat|grep LISTEN | |
#ps -aux|grep breeze | |
ls -all /home/runner/work/breeze/snapshot | |
ls -all /home/runner/work/breeze/socks | |
ls -all /home/runner/work/breeze/logs | |
tail -10 /home/runner/work/breeze/logs/log.file | |
tail -10 /home/runner/work/breeze/logs/breeze.log | |
#cat /home/runner/work/breeze/logs/log.file | |
#cat /home/runner/work/breeze/logs/breeze.log | |
#- name: Run cargo-tarpaulin | |
# uses: actions-rs/[email protected] | |
# with: | |
# version: "0.22.0" | |
# args: "--features=github_workflow --features=console-api -- --test-threads 1" | |
- name: Run unit tests | |
run: cargo test -p tests --features github_workflow -p endpoint | |
- name: wait until 2 mins | |
run: | | |
port_list=(56810 56812 9302 9301 9303 3306 3308) # 端口列表 | |
start=$(date +%s) # 获取当前时间戳 | |
while true; do | |
now=$(date +%s) # 获取当前时间戳 | |
diff=$((now - start)) # 计算时间差 | |
if [ $diff -lt 120 ]; then # 如果时间差小于120秒 | |
all_listened=true | |
for port in "${port_list[@]}"; do | |
if ! netstat -an | grep -q ":$port.*LISTEN"; then | |
echo "Port $port is not being listened to. Sleeping for 5 seconds..." | |
all_listened=false | |
sleep 5 # 等待5秒 | |
break | |
fi | |
done | |
if $all_listened; then | |
echo "All ports are being listened to. Exiting loop." | |
break # 退出循环 | |
fi | |
else | |
echo "Two minutes have passed. Exiting loop." | |
break # 退出循环 | |
fi | |
done | |
- name: Run ci tests | |
run: cargo test -p tests_integration --features github_workflow | |
- name: Output log | |
if: failure() | |
run: | | |
cat /home/runner/work/breeze/logs/log.file | |
cat /home/runner/work/breeze/logs/breeze.log |