mvp-factory-openhands/test-scripts/execute-build-test.js

52 lines
1.9 KiB
JavaScript

const { execSync } = require('child_process');
console.log('🚀 BAM Test Repository - Build and Test Process');
console.log('================================================');
console.log('Repository: bam/test-repo');
console.log('Branch: main');
console.log('Latest commit: Fix');
console.log('');
try {
// Initialize git
console.log('🔧 Initializing Git Repository:');
console.log('================================');
execSync('git init', { stdio: 'inherit', cwd: '/home/bam' });
execSync('git branch -M main', { stdio: 'inherit', cwd: '/home/bam' });
execSync('git add .', { stdio: 'inherit', cwd: '/home/bam' });
execSync('git commit -m "Fix"', { stdio: 'inherit', cwd: '/home/bam' });
console.log('✅ Git repository initialized successfully\n');
// Run build
console.log('🔨 Building Project:');
console.log('====================');
execSync('npm run build', { stdio: 'inherit', cwd: '/home/bam' });
console.log('');
// Run tests
console.log('🧪 Running Tests:');
console.log('================');
execSync('npm test', { stdio: 'inherit', cwd: '/home/bam' });
console.log('');
// Show git info
console.log('📜 Git Information:');
console.log('==================');
console.log('Current branch:');
const branch = execSync('git branch', { encoding: 'utf8', cwd: '/home/bam' });
console.log(branch);
console.log('Recent commits:');
const log = execSync('git log --oneline -3', { encoding: 'utf8', cwd: '/home/bam' });
console.log(log);
console.log('🎉 Build and Test Process Completed!');
console.log('✅ Repository: bam/test-repo on branch main');
console.log('✅ Latest commit: Fix');
console.log('✅ Build completed successfully');
console.log('✅ All tests passed');
} catch (error) {
console.error('❌ Error during build and test process:', error.message);
process.exit(1);
}