feat: add Woodpecker CI configuration for tiered testing
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
console.log('🔍 验证Woodpecker CI配置...');
|
||||
|
||||
const configFiles = [
|
||||
'.woodpecker/test-tiered.yml',
|
||||
'.woodpecker/test-tiered-simple.yml',
|
||||
];
|
||||
|
||||
let allValid = true;
|
||||
|
||||
for (const configFile of configFiles) {
|
||||
const filePath = path.join(__dirname, '..', configFile);
|
||||
|
||||
if (!fs.existsSync(filePath)) {
|
||||
console.log(`❌ 配置文件不存在: ${configFile}`);
|
||||
allValid = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
const content = fs.readFileSync(filePath, 'utf-8');
|
||||
|
||||
if (content.includes('when:') && content.includes('pipeline:')) {
|
||||
console.log(`✅ ${configFile} - 配置格式正确`);
|
||||
} else {
|
||||
console.log(`❌ ${configFile} - 配置格式错误`);
|
||||
allValid = false;
|
||||
}
|
||||
|
||||
if (content.includes('TEST_TIER')) {
|
||||
console.log(`✅ ${configFile} - 包含分层测试环境变量`);
|
||||
} else {
|
||||
console.log(`❌ ${configFile} - 缺少分层测试环境变量`);
|
||||
allValid = false;
|
||||
}
|
||||
|
||||
if (content.includes('depends_on')) {
|
||||
console.log(`✅ ${configFile} - 包含任务依赖配置`);
|
||||
} else {
|
||||
console.log(`⚠️ ${configFile} - 未配置任务依赖`);
|
||||
}
|
||||
}
|
||||
|
||||
const reportScript = path.join(__dirname, '..', 'e2e/scripts/generate-report.js');
|
||||
if (fs.existsSync(reportScript)) {
|
||||
console.log(`✅ 测试报告脚本存在`);
|
||||
} else {
|
||||
console.log(`❌ 测试报告脚本不存在`);
|
||||
allValid = false;
|
||||
}
|
||||
|
||||
if (allValid) {
|
||||
console.log('\n✅ 所有配置验证通过');
|
||||
process.exit(0);
|
||||
} else {
|
||||
console.log('\n❌ 部分配置验证失败');
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user