File tree Expand file tree Collapse file tree 4 files changed +329
-1028
lines changed
Expand file tree Collapse file tree 4 files changed +329
-1028
lines changed Original file line number Diff line number Diff line change 1+ name : Test Build
2+
3+ on :
4+ pull_request :
5+ branches : [master, main, develop]
6+ push :
7+ branches : [feature/stats-ui-demo]
8+
9+ jobs :
10+ test-build :
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ # 1. 检出代码
15+ - name : Checkout code
16+ uses : actions/checkout@v4
17+
18+ # 2. 设置 Node.js 环境
19+ - name : Setup Node.js
20+ uses : actions/setup-node@v4
21+ with :
22+ node-version : ' 18'
23+ cache : ' npm'
24+ cache-dependency-path : web/package-lock.json
25+
26+ # 3. 安装前端依赖
27+ - name : Install Frontend Dependencies
28+ run : |
29+ cd web
30+ npm ci --production=false
31+
32+ # 4. 构建前端
33+ - name : Build Frontend
34+ run : |
35+ cd web
36+ npm run build
37+ env :
38+ VITE_SHORT_BASE : " https://example.com"
39+ VITE_API_BASE : " https://api.example.com"
40+
41+ # 5. 设置 Java 环境
42+ - name : Setup Java
43+ uses : actions/setup-java@v4
44+ with :
45+ distribution : ' temurin'
46+ java-version : ' 17'
47+ cache : ' maven'
48+
49+ # 6. 运行后端测试
50+ - name : Run Backend Tests
51+ run : mvn clean test
52+ env :
53+ APP_DOMAIN : " https://example.com"
54+ DB_PASSWORD : " test"
55+ JWT_SECRET : " test-secret"
56+ REDIS_PASSWORD : " test-redis"
57+
58+ # 7. 简单编译检查(不实际打包)
59+ - name : Compile Backend
60+ run : mvn compile -q
61+ env :
62+ APP_DOMAIN : " https://example.com"
63+ DB_PASSWORD : " test"
64+ JWT_SECRET : " test-secret"
65+ REDIS_PASSWORD : " test-redis"
66+
67+ # 8. 验证构建产物
68+ - name : Verify Build Output
69+ run : |
70+ echo "✅ 前端构建验证"
71+ ls -la web/dist/
72+ echo "✅ 后端编译验证"
73+ ls -la target/classes/
You can’t perform that action at this time.
0 commit comments