Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 2m25s
mysqladmin may not be in CI runner PATH. Use docker exec mysql mysqladmin ping instead, which works from the Gitea Actions runner. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
42 lines
1.2 KiB
Bash
42 lines
1.2 KiB
Bash
#!/bin/bash
|
|
# M-AI-01-09 真实集成测试 CI Runner
|
|
# 启动真实 MySQL/Redis/API/Worker/Mock AI Provider 并执行集成测试
|
|
set -e
|
|
|
|
echo "=== M-AI-01-09 真实集成测试 ==="
|
|
|
|
DB_URL="${DATABASE_URL:-mysql://zhixi_user:test@127.0.0.1:3306/zhixi_test}"
|
|
REDIS_H="${REDIS_HOST:-127.0.0.1}"
|
|
REDIS_P="${REDIS_PORT:-6379}"
|
|
REDIS_PW="${REDIS_PASSWORD:-}"
|
|
|
|
# 1. Check MySQL (via docker exec since mysqladmin may not be in CI PATH)
|
|
echo "[1/7] Checking MySQL..."
|
|
docker exec mysql mysqladmin ping -u root -p"${MYSQL_ROOT_PASSWORD:-root}" --silent 2>/dev/null || {
|
|
echo "MySQL not reachable via docker; ensure MySQL container is running"
|
|
exit 1
|
|
}
|
|
|
|
# 2. Prisma migration
|
|
echo "[2/7] Running Prisma migration..."
|
|
npx prisma migrate deploy
|
|
|
|
# 3. Build
|
|
echo "[3/7] Building..."
|
|
npm run build --if-present
|
|
|
|
# 4. Start Mock AI Provider is handled internally by the test
|
|
# 5. Run integration tests (test starts its own API/Worker/Mock Provider)
|
|
echo "[4/7] Running real integration tests..."
|
|
npx jest --config test/jest-worker-integration.json --forceExit --verbose 2>&1
|
|
TEST_EXIT=$?
|
|
|
|
echo ""
|
|
if [ $TEST_EXIT -eq 0 ]; then
|
|
echo "=== M-AI-01-09: PASS ==="
|
|
else
|
|
echo "=== M-AI-01-09: FAIL ==="
|
|
fi
|
|
|
|
exit $TEST_EXIT
|