Optimize CI execution workflow (#3371)

* Optimize CI execution workflow

* fix
This commit is contained in:
YUNSHEN XIE
2025-08-13 18:47:31 +08:00
committed by GitHub
parent be94bdd0b0
commit 1ace375fc3
5 changed files with 243 additions and 171 deletions

View File

@@ -65,11 +65,25 @@ for dir in "${dirs[@]}"; do
echo "Skipping disabled test: $test_file"
continue
fi
python -m coverage run "$test_file"
# TODO: Add a framework to manage unit test execution time
timeout 600 python -m coverage run "$test_file"
if [ $? -ne 0 ]; then
echo "$test_file" >> "$failed_tests_file"
fail=$((fail + 1))
PORTS=($FLASK_PORT $FD_API_PORT $FD_ENGINE_QUEUE_PORT $FD_METRICS_PORT)
echo "==== PORT CLEAN AFTER UT FAILED ===="
for port in "${PORTS[@]}"; do
PIDS=$(lsof -t -i :$port)
if [ -n "$PIDS" ]; then
echo "Port $port is occupied by PID(s): $PIDS"
echo "$PIDS" | xargs -r kill -9
echo "Port $port cleared"
else
echo "Port $port is free"
fi
done
else
success=$((success + 1))
fi