vendor_report/verify_build.ps1
2025-11-07 02:42:28 +04:00

56 lines
2.2 KiB
PowerShell

# Comprehensive build verification script
Write-Host "=== Vendor Report API Build Verification ===" -ForegroundColor Cyan
# 1. Verify local file syntax
Write-Host "`n1. Checking local file syntax..." -ForegroundColor Yellow
python -c "import html_generator; print('Local file syntax OK')" 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Host "Local file has syntax errors!" -ForegroundColor Red
exit 1
} else {
Write-Host "Local file syntax OK" -ForegroundColor Green
}
# 2. Check specific lines
Write-Host "`n2. Checking fixed lines..." -ForegroundColor Yellow
$line794 = (Get-Content html_generator.py)[793]
$line1284 = (Get-Content html_generator.py)[1283]
Write-Host "Line 794: $($line794.Substring(0, [Math]::Min(80, $line794.Length)))..."
if ($line794 -match '\\"') {
Write-Host "Line 794 still has backslash!" -ForegroundColor Red
} else {
Write-Host "Line 794 looks correct (no backslash)" -ForegroundColor Green
}
Write-Host "Line 1284: $($line1284.Substring(0, [Math]::Min(80, $line1284.Length)))..."
if ($line1284 -match '\\"') {
Write-Host "Line 1284 still has backslash!" -ForegroundColor Red
} else {
Write-Host "Line 1284 looks correct (no backslash)" -ForegroundColor Green
}
# 3. Build image with --no-cache
Write-Host "`n3. Building Docker image with --no-cache..." -ForegroundColor Yellow
docker build --no-cache -t vendor-report-api-test . 2>&1 | Select-String "Step|COPY|ERROR" | Select-Object -Last 10
# 4. Verify what's in the image
Write-Host "`n4. Verifying Docker image contents..." -ForegroundColor Yellow
Write-Host "Line 794 in image:"
docker run --rm vendor-report-api-test sed -n '794p' /app/html_generator.py 2>&1
Write-Host "`nLine 1284 in image:"
docker run --rm vendor-report-api-test sed -n '1284p' /app/html_generator.py 2>&1
# 5. Test import in Docker
Write-Host "`n5. Testing Python import in Docker container..." -ForegroundColor Yellow
docker run --rm vendor-report-api-test python -c "import html_generator; print('SUCCESS')" 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host "✓ Docker image works!" -ForegroundColor Green
} else {
Write-Host "✗ Docker image still has errors!" -ForegroundColor Red
}
Write-Host "`n=== Verification Complete ===" -ForegroundColor Cyan