Repository navigation
Expand file tree
/
Copy pathdeploy-and-test.bat
More file actions
110 lines (96 loc) · 3.33 KB
/
Copy pathdeploy-and-test.bat
File metadata and controls
110 lines (96 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
@echo off
chcp 65001 >nul
echo ╔════════════════════════════════════════════════════════╗
echo ║ VideoCrawler 完整部署和验证脚本 (Windows) ║
echo ╚════════════════════════════════════════════════════════╝
echo.
echo 📋 检查运行环境...
echo.
REM 检查 .NET
where dotnet >nul 2>&1
if %errorlevel% equ 0 (
for /f "tokens=*" %%i in ('dotnet --version') do set DOTNET_VERSION=%%i
echo ✅ .NET SDK: %DOTNET_VERSION%
) else (
echo ❌ .NET SDK 未安装
echo 请安装 .NET 10 SDK: https://dotnet.microsoft.com/download
pause
exit /b 1
)
REM 检查 Node.js
where node >nul 2>&1
if %errorlevel% equ 0 (
for /f "tokens=*" %%i in ('node --version') do set NODE_VERSION=%%i
echo ✅ Node.js: %NODE_VERSION%
) else (
echo ⚠️ Node.js 未安装(前端可选)
)
echo.
echo ═══════════════════════════════════════════════════════
echo.
REM 1. 恢复 NuGet 包
echo 📦 步骤 1: 恢复 NuGet 包...
dotnet restore src\VideoCrawler.Api\VideoCrawler.Api.csproj
if %errorlevel% neq 0 (
echo ❌ NuGet 包恢复失败
pause
exit /b 1
)
echo ✅ NuGet 包恢复完成
echo.
REM 2. 构建后端
echo 🔨 步骤 2: 构建后端项目...
dotnet build src\VideoCrawler.Api\VideoCrawler.Api.csproj --configuration Release --no-restore
if %errorlevel% neq 0 (
echo ❌ 后端构建失败
pause
exit /b 1
)
echo ✅ 后端构建成功
echo.
REM 3. 构建测试项目
echo 🔨 步骤 3: 构建测试项目...
dotnet build tests\VideoCrawler.Test\VideoCrawler.Test.csproj --configuration Release --no-restore
if %errorlevel% neq 0 (
echo ❌ 测试项目构建失败
pause
exit /b 1
)
echo ✅ 测试项目构建成功
echo.
REM 4. 运行集成测试
echo 🧪 步骤 4: 运行集成测试...
echo.
dotnet run --project tests\VideoCrawler.Test\VideoCrawler.Test.csproj --configuration Release --no-build
set TEST_RESULT=%errorlevel%
echo.
echo ═══════════════════════════════════════════════════════
echo.
if %TEST_RESULT% equ 0 (
echo ✅ 所有测试通过!
) else (
echo ❌ 部分测试失败
pause
exit /b 1
)
echo.
echo ═══════════════════════════════════════════════════════
echo.
echo 🎉 部署和验证完成!
echo.
echo 📌 下一步操作:
echo.
echo 1. 启动后端 API:
echo. start-api.bat
echo. 或:dotnet run --project src\VideoCrawler.Api
echo.
echo 2. 启动前端(新终端):
echo. start-web.bat
echo. 或:cd src\VideoCrawler.Web ^&^& npm run dev
echo.
echo 3. 访问应用:
echo. - Swagger API: http://localhost:5000
echo. - 前端页面:http://localhost:5173
echo.
echo ═══════════════════════════════════════════════════════
pause