Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Test Build

on:
pull_request:
branches: [master, main, develop]
push:
branches: [feature/stats-ui-demo]

jobs:
test-build:
runs-on: ubuntu-latest

steps:
# 1. 检出代码
- name: Checkout code
uses: actions/checkout@v4

# 2. 设置 Node.js 环境
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: web/package-lock.json

# 3. 安装前端依赖
- name: Install Frontend Dependencies
run: |
cd web
npm ci --production=false

# 4. 构建前端
- name: Build Frontend
run: |
cd web
npm run build
env:
VITE_SHORT_BASE: "https://example.com"
VITE_API_BASE: "https://api.example.com"

# 5. 设置 Java 环境
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'

# 6. 运行后端测试
- name: Run Backend Tests
run: mvn clean test
env:
APP_DOMAIN: "https://example.com"
DB_PASSWORD: "test"
JWT_SECRET: "test-secret"
REDIS_PASSWORD: "test-redis"

# 7. 简单编译检查(不实际打包)
- name: Compile Backend
run: mvn compile -q
env:
APP_DOMAIN: "https://example.com"
DB_PASSWORD: "test"
JWT_SECRET: "test-secret"
REDIS_PASSWORD: "test-redis"

# 8. 验证构建产物
- name: Verify Build Output
run: |
echo "✅ 前端构建验证"
ls -la web/dist/
echo "✅ 后端编译验证"
ls -la target/classes/
Loading
Loading