-
Notifications
You must be signed in to change notification settings - Fork 490
319 lines (284 loc) · 12.5 KB
/
Copy pathintegration-tests.yml
File metadata and controls
319 lines (284 loc) · 12.5 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
name: MPP Coding Agent Integration
on:
push:
branches: [ main, develop ]
paths:
- 'mpp-core/**'
- 'mpp-ui/**'
- '.github/workflows/integration-tests.yml'
pull_request:
branches: [ main, develop ]
paths:
- 'mpp-core/**'
- 'mpp-ui/**'
workflow_dispatch:
inputs:
test_category:
description: 'Test category to run'
required: false
default: 'all'
type: choice
options:
- all
- simple
- business
- errors
- performance
- custom
pass_threshold:
description: 'Pass rate threshold (0-100%)'
required: false
default: '80'
type: string
keep_test_projects:
description: 'Keep test projects for debugging'
required: false
default: false
type: boolean
jobs:
integration-tests:
runs-on: ubuntu-latest
timeout-minutes: 60 # 增加超时时间以适应新的测试框架
strategy:
matrix:
node-version: [21.x] # 简化为单一版本以减少 CI 时间
test-category:
- ${{ github.event.inputs.test_category || 'all' }}
fail-fast: false
env:
# 配置 DeepSeek API
DEEPSEEK_TOKEN: ${{ secrets.DEEPSEEK_TOKEN }}
# 测试框架配置
CI: true
NODE_ENV: test
DEBUG: false
KEEP_TEST_PROJECTS: ${{ github.event.inputs.keep_test_projects || 'false' }}
PASS_THRESHOLD: ${{ github.event.inputs.pass_threshold || '80' }}
# 增加超时时间
TEST_TIMEOUT: 1200000 # 20分钟
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Cache npm dependencies
uses: actions/cache@v3
with:
path: mpp-ui/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('mpp-ui/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Workaround for git:// protocol in treesitter dependencies
run: |
echo "📦 Pre-creating build/js directory with cached yarn.lock"
mkdir -p build/js
if [ -f kotlin-js-store/yarn.lock ]; then
cp kotlin-js-store/yarn.lock build/js/yarn.lock
echo "✅ Copied pre-cached yarn.lock from kotlin-js-store"
else
echo "⚠️ No pre-cached yarn.lock found, will proceed without it"
fi
# Configure git to use https:// instead of git://
git config --global url."https://github.com/".insteadOf git://github.com/
echo "✅ Configured git to rewrite git:// URLs to https://"
- name: Install mpp-ui dependencies
working-directory: mpp-ui
run: npm install
- name: Build mpp-core
run: ./gradlew :mpp-core:jsNodeProductionLibraryDistribution
- name: Build mpp-ui
working-directory: mpp-ui
run: npm run build:ts
- name: Create test results directory
run: mkdir -p test-results
- name: Setup AutoDev config for CI
run: |
mkdir -p ~/.autodev
cat > ~/.autodev/config.yaml << EOF
active: ci-deepseek
configs:
- name: ci-deepseek
provider: deepseek
apiKey: ${{ secrets.DEEPSEEK_TOKEN }}
model: deepseek-chat
EOF
echo "✅ AutoDev config created for CI environment"
- name: Validate test framework
working-directory: mpp-ui
run: npm run test:framework
- name: Run integration tests v2
working-directory: mpp-ui
run: |
echo "🚀 Running CodingAgent Integration Tests v2"
echo "Category: ${{ matrix.test-category }}"
echo "Pass Threshold: ${PASS_THRESHOLD}%"
echo "Keep Test Projects: ${KEEP_TEST_PROJECTS}"
echo ""
npm run test:integration-v2
timeout-minutes: 45
- name: Generate detailed test report
if: always()
working-directory: mpp-ui
run: |
echo "📊 Generating detailed test report..."
# 创建测试报告目录
mkdir -p test-results/reports
# 生成测试摘要
echo "## 🤖 CodingAgent Integration Tests v2 Report" > test-results/reports/summary.md
echo "" >> test-results/reports/summary.md
echo "- **Test Category**: ${{ matrix.test-category }}" >> test-results/reports/summary.md
echo "- **Node Version**: ${{ matrix.node-version }}" >> test-results/reports/summary.md
echo "- **Timestamp**: $(date)" >> test-results/reports/summary.md
echo "- **Pass Threshold**: ${PASS_THRESHOLD}%" >> test-results/reports/summary.md
echo "- **Status**: ${{ job.status }}" >> test-results/reports/summary.md
echo "" >> test-results/reports/summary.md
# 如果有测试结果文件,添加详细信息
if [ -d "test-results" ] && [ "$(find test-results -name '*.json' -o -name '*.xml' | head -1)" ]; then
echo "### 📈 Test Results Found" >> test-results/reports/summary.md
echo "Detailed test results are available in the artifacts." >> test-results/reports/summary.md
else
echo "### ⚠️ No detailed test results found" >> test-results/reports/summary.md
fi
echo "Test report generated successfully"
- name: Generate GitHub Actions summary
if: always()
env:
TEST_CATEGORY: ${{ matrix.test-category }}
NODE_VERSION: ${{ matrix.node-version }}
JOB_STATUS: ${{ job.status }}
run: |
echo "📊 生成 GitHub Actions 摘要..."
node .github/scripts/generate-test-summary.cjs
- name: Upload test results and reports
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-v2-${{ matrix.node-version }}-${{ matrix.test-category }}
path: |
mpp-ui/test-results/
mpp-ui/coverage/
retention-days: 14
- name: Upload test projects (for debugging)
uses: actions/upload-artifact@v4
if: failure() || env.KEEP_TEST_PROJECTS == 'true'
with:
name: test-projects-${{ matrix.node-version }}-${{ matrix.test-category }}
path: |
/tmp/agent-test-*
/tmp/autodev-test-*
retention-days: 7
- name: Comment PR with test results
uses: actions/github-script@v7
if: github.event_name == 'pull_request' && always()
with:
script: |
const fs = require('fs');
const path = require('path');
// 创建详细的测试结果评论
let comment = `## 🤖 CodingAgent Integration Tests v2 Results\n\n`;
comment += `### 📊 Test Configuration\n`;
comment += `- **Node.js Version:** ${{ matrix.node-version }}\n`;
comment += `- **Test Category:** ${{ matrix.test-category }}\n`;
comment += `- **Pass Threshold:** ${{ env.PASS_THRESHOLD }}%\n`;
comment += `- **Status:** ${{ job.status }}\n`;
comment += `- **Timestamp:** ${new Date().toISOString()}\n\n`;
// 读取测试报告摘要
try {
const summaryPath = 'mpp-ui/test-results/reports/summary.md';
if (fs.existsSync(summaryPath)) {
const summary = fs.readFileSync(summaryPath, 'utf8');
comment += `### 📈 Test Summary\n\n${summary}\n\n`;
}
} catch (error) {
console.log('Could not read test summary:', error.message);
}
if ('${{ job.status }}' === 'success') {
comment += `### ✅ Test Results\n\n`;
comment += `🎉 **All integration tests passed successfully!**\n\n`;
comment += `The CodingAgent demonstrates robust performance with:\n`;
comment += `- ✅ **Prompt Effectiveness**: System prompts correctly guide agent behavior\n`;
comment += `- ✅ **Tool Usage**: Accurate and efficient tool selection and usage\n`;
comment += `- ✅ **Code Quality**: Generated code meets quality standards\n`;
comment += `- ✅ **Task Completion**: All required functionality implemented\n\n`;
comment += `### 📊 Framework Features Validated\n`;
comment += `- 🎯 **Multi-dimensional Analysis**: Prompt effects, tool calls, code quality\n`;
comment += `- 📈 **Standardized Scoring**: Consistent evaluation metrics\n`;
comment += `- 🔧 **Detailed Reporting**: Comprehensive test insights\n`;
} else {
comment += `### ❌ Test Results\n\n`;
comment += `⚠️ **Some integration tests failed or encountered issues.**\n\n`;
comment += `**Next Steps:**\n`;
comment += `1. 📋 Check the detailed test logs in the Actions tab\n`;
comment += `2. 📁 Download test artifacts for detailed analysis\n`;
comment += `3. 🔍 Review specific test failures and error messages\n`;
comment += `4. 🛠️ Use the new test framework's detailed reports for debugging\n\n`;
comment += `**Available Artifacts:**\n`;
comment += `- \`test-results-v2-${{ matrix.node-version }}-${{ matrix.test-category }}\`: Detailed test results and reports\n`;
if ('${{ env.KEEP_TEST_PROJECTS }}' === 'true') {
comment += `- \`test-projects-${{ matrix.node-version }}-${{ matrix.test-category }}\`: Test project files for debugging\n`;
}
}
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
test-summary:
runs-on: ubuntu-latest
needs: integration-tests
if: always()
steps:
- name: Generate test summary
run: |
echo "# 🧪 CodingAgent Integration Test Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ needs.integration-tests.result }}" = "success" ]; then
echo "✅ **All integration tests passed successfully!**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "The CodingAgent demonstrates robust performance across all tested scenarios:" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Simple robustness tests" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Business scenario implementations" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Error recovery mechanisms" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Code quality standards" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Some integration tests failed**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Please review the test logs and artifacts for detailed information." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Common issues to check:" >> $GITHUB_STEP_SUMMARY
echo "- System resource constraints" >> $GITHUB_STEP_SUMMARY
echo "- Network connectivity issues" >> $GITHUB_STEP_SUMMARY
echo "- Environment configuration problems" >> $GITHUB_STEP_SUMMARY
echo "- CodingAgent system prompt effectiveness" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Test Categories" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Category | Description | Complexity |" >> $GITHUB_STEP_SUMMARY
echo "|----------|-------------|------------|" >> $GITHUB_STEP_SUMMARY
echo "| Simple | Basic tool usage validation | Low |" >> $GITHUB_STEP_SUMMARY
echo "| Video Support | BlogPost entity enhancement | Medium |" >> $GITHUB_STEP_SUMMARY
echo "| JWT Auth | Security implementation | High |" >> $GITHUB_STEP_SUMMARY
echo "| Spring Upgrade | Version upgrade with error handling | Very High |" >> $GITHUB_STEP_SUMMARY
echo "| GraphQL API | Modern API implementation | High |" >> $GITHUB_STEP_SUMMARY