This repository was archived by the owner on Mar 3, 2026. It is now read-only.
forked from SIDRePUJ/eBDIBESA
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-github-actions.ps1
More file actions
124 lines (109 loc) · 4.61 KB
/
Copy pathtest-github-actions.ps1
File metadata and controls
124 lines (109 loc) · 4.61 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
# 🚀 Test GitHub Actions para eBDIBESA
# Script para simular el comportamiento del workflow antes del deploy
Write-Host "🚀 Simulando GitHub Actions para eBDIBESA" -ForegroundColor Cyan
Write-Host "=========================================" -ForegroundColor Cyan
Write-Host ""
# Step 1: Verificar configuración Maven
Write-Host "📋 Step 1: Verificar configuración Maven" -ForegroundColor Yellow
if (Test-Path "~/.m2/settings.xml") {
Write-Host "✅ Configuración Maven OK" -ForegroundColor Green
} else {
Write-Host "❌ Configuración Maven faltante" -ForegroundColor Red
exit 1
}
Write-Host ""
# Step 2: Verificar estructura del proyecto
Write-Host "📋 Step 2: Verificar estructura inicial" -ForegroundColor Yellow
Write-Host "📁 Contenido del directorio:" -ForegroundColor Gray
Write-Host ""
Get-ChildItem -Name
Write-Host ""
# Step 3: Verificar disponibilidad de KernelBESA
Write-Host "📋 Step 3: Verificar disponibilidad de KernelBESA" -ForegroundColor Yellow
Write-Host "Probando resolución de dependencias con github-packages..." -ForegroundColor Gray
try {
$env:MAVEN_OPTS = "-Dorg.slf4j.simpleLogger.defaultLogLevel=WARN"
$result = & mvn dependency:resolve -P github-packages -B -q 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host "✅ KernelBESA encontrado en GitHub Packages" -ForegroundColor Green
$strategy = "github-packages"
$kernelAvailable = $true
} else {
Write-Host "⚠️ KernelBESA no disponible en GitHub Packages" -ForegroundColor Yellow
Write-Host "🔄 Usaríamos estrategia de fallback (local-dev)" -ForegroundColor Yellow
$strategy = "local-dev"
$kernelAvailable = $false
}
} catch {
Write-Host "⚠️ Error verificando KernelBESA" -ForegroundColor Yellow
$strategy = "local-dev"
$kernelAvailable = $false
}
Write-Host ""
# Step 4: Build
Write-Host "📋 Step 4: Build con $strategy" -ForegroundColor Yellow
Write-Host "🔨 Ejecutando: mvn clean compile package -P $strategy -B" -ForegroundColor Gray
try {
$result = & mvn clean compile package -P $strategy -B -q 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host "✅ Build exitoso" -ForegroundColor Green
} else {
Write-Host "❌ Build falló" -ForegroundColor Red
Write-Host $result
exit 1
}
} catch {
Write-Host "❌ Error durante el build" -ForegroundColor Red
exit 1
}
Write-Host ""
# Step 5: Verificar artefactos
Write-Host "📋 Step 5: Verificar artefactos generados" -ForegroundColor Yellow
if (Test-Path "target") {
Write-Host "📁 Contenido del directorio target:" -ForegroundColor Gray
Write-Host ""
Get-ChildItem target | Format-Table Name, Length -AutoSize
Write-Host ""
$jarFiles = Get-ChildItem target -Filter "*.jar"
if ($jarFiles.Count -gt 0) {
Write-Host "✅ Archivos JAR encontrados:" -ForegroundColor Green
foreach ($jar in $jarFiles) {
$sizeKB = [math]::Round($jar.Length / 1KB, 2)
Write-Host " 📦 $($jar.Name) ($sizeKB KB)" -ForegroundColor White
}
} else {
Write-Host "❌ No se encontraron archivos JAR" -ForegroundColor Red
exit 1
}
} else {
Write-Host "❌ Directorio target no encontrado" -ForegroundColor Red
exit 1
}
Write-Host ""
# Step 6: Estrategia de deploy
Write-Host "📋 Step 6: Estrategia de deploy" -ForegroundColor Yellow
if ($kernelAvailable) {
Write-Host "🚀 Se ejecutaría: mvn deploy -P github-packages -DskipTests -B" -ForegroundColor Green
} else {
Write-Host "🚀 Se ejecutaría: mvn deploy -P local-dev -DskipTests -B" -ForegroundColor Green
}
Write-Host "✅ Deploy se ejecutaría exitosamente" -ForegroundColor Green
Write-Host ""
# Resumen
Write-Host "🎯 RESUMEN DE SIMULACIÓN" -ForegroundColor Cyan
Write-Host "========================" -ForegroundColor Cyan
Write-Host "Build exitoso: ✅" -ForegroundColor Green
Write-Host "Artefactos generados: ✅" -ForegroundColor Green
Write-Host "Estrategia usada: $strategy" -ForegroundColor White
Write-Host "Deploy habilitado: ✅" -ForegroundColor Green
Write-Host ""
Write-Host "🔮 PREDICCIÓN GITHUB ACTIONS:" -ForegroundColor Cyan
if ($kernelAvailable) {
Write-Host "✅ GitHub Actions ejecutará con KernelBESA desde GitHub Packages" -ForegroundColor Green
} else {
Write-Host "✅ GitHub Actions ejecutará con build local de KernelBESA" -ForegroundColor Green
}
Write-Host "✅ Deploy se realizará a GitHub Packages" -ForegroundColor Green
Write-Host ""
Write-Host "=============================================" -ForegroundColor Cyan
Write-Host "🏁 Simulación completada exitosamente" -ForegroundColor Green