From 375faadacc6d8cc4dc31ec75095eb440792463ab Mon Sep 17 00:00:00 2001 From: Samiran Saha Date: Sat, 6 Dec 2025 21:30:20 +0530 Subject: [PATCH] win enable gha --- .github/workflows/test-scripts.yml | 84 +++++++++++++++--------------- win/common-utils.ps1 | 2 +- win/run.ps1 | 3 ++ 3 files changed, 46 insertions(+), 43 deletions(-) diff --git a/.github/workflows/test-scripts.yml b/.github/workflows/test-scripts.yml index 504607c..b38d561 100644 --- a/.github/workflows/test-scripts.yml +++ b/.github/workflows/test-scripts.yml @@ -290,56 +290,56 @@ jobs: ) $overallFailed = $false - $logRoot = Join-Path $env:TEMP "now-tests" - New-Item -ItemType Directory -Force -Path $logRoot | Out-Null - $logPath = Join-Path $logRoot "run_test_app_nodejs.log" - - Write-Host "================================" - Write-Host "Testing: $scriptPath --silent app nodejs" - Write-Host "================================" - - & $scriptPath --silent app nodejs 2>&1 | Tee-Object -FilePath $logPath -Append - $exitCode = $LASTEXITCODE - - if ($exitCode -eq 0) { - Write-Host "✅ app / nodejs completed (exit code: $exitCode)" - } else { - Write-Host "⚠️ app / nodejs exited with code: $exitCode" - if (Test-Path $logPath) { - Write-Host "Log output (last 20 lines):" - Get-Content -Path $logPath -Tail 20 - } - exit 1 - } - # $logRoot = Join-Path $env:TEMP "now-tests" # New-Item -ItemType Directory -Force -Path $logRoot | Out-Null + # $logPath = Join-Path $logRoot "run_test_app_nodejs.log" + + # Write-Host "================================" + # Write-Host "Testing: $scriptPath --silent app nodejs" + # Write-Host "================================" + + # & $scriptPath --silent app nodejs 2>&1 | Tee-Object -FilePath $logPath -Append + # $exitCode = $LASTEXITCODE + + # if ($exitCode -eq 0) { + # Write-Host "✅ app / nodejs completed (exit code: $exitCode)" + # } else { + # Write-Host "⚠️ app / nodejs exited with code: $exitCode" + # if (Test-Path $logPath) { + # Write-Host "Log output (last 20 lines):" + # Get-Content -Path $logPath -Tail 20 + # } + # exit 1 + # } - # foreach ($config in $testConfigs) { - # $testType = $config[0] - # $techStack = $config[1] + $logRoot = Join-Path $env:TEMP "now-tests" + New-Item -ItemType Directory -Force -Path $logRoot | Out-Null - # Write-Host "================================" - # Write-Host "Testing: $scriptPath --silent $testType $techStack" - # Write-Host "================================" + foreach ($config in $testConfigs) { + $testType = $config[0] + $techStack = $config[1] - # $logPath = Join-Path $logRoot "run_test_${testType}_${techStack}.log" + Write-Host "================================" + Write-Host "Testing: $scriptPath --silent $testType $techStack" + Write-Host "================================" - # & $scriptPath --silent $testType $techStack 2>&1 | Tee-Object -FilePath $logPath -Append - # $exitCode = $LASTEXITCODE + $logPath = Join-Path $logRoot "run_test_${testType}_${techStack}.log" - # if ($exitCode -eq 0) { - # Write-Host "✅ $testType / $techStack completed (exit code: $exitCode)" - # } else { - # Write-Host "⚠️ $testType / $techStack exited with code: $exitCode" - # $overallFailed = $true + & $scriptPath --silent $testType $techStack 2>&1 | Tee-Object -FilePath $logPath -Append + $exitCode = $LASTEXITCODE - # if (Test-Path $logPath) { - # Write-Host "Log output (last 20 lines):" - # Get-Content -Path $logPath -Tail 20 - # } - # } - # } + if ($exitCode -eq 0) { + Write-Host "✅ $testType / $techStack completed (exit code: $exitCode)" + } else { + Write-Host "⚠️ $testType / $techStack exited with code: $exitCode" + $overallFailed = $true + + if (Test-Path $logPath) { + Write-Host "Log output (last 20 lines):" + Get-Content -Path $logPath -Tail 20 + } + } + } if ($overallFailed) { Write-Error "One or more configurations failed." diff --git a/win/common-utils.ps1 b/win/common-utils.ps1 index 105bc69..2069cd2 100644 --- a/win/common-utils.ps1 +++ b/win/common-utils.ps1 @@ -169,7 +169,7 @@ function Invoke-External { } $stdoutEvent = Register-ObjectEvent -InputObject $p -EventName OutputDataReceived -Action $stdoutAction -MessageData $LogFile - $stderrEvent = Register-ObjectEvent -InputObject $p -EventName ErrorDataReceived -Action $stderrAction -MessageData $LogFile + $stderrEvent = Register-ObjectEvent -InputObject $p -EventName ErrorDataReceived -Action $stderrAction -MessageData $ERR_LOG [void]$p.Start() $p.BeginOutputReadLine() diff --git a/win/run.ps1 b/win/run.ps1 index 8003d2b..a16e810 100644 --- a/win/run.ps1 +++ b/win/run.ps1 @@ -50,13 +50,16 @@ try { # Setup log file path AFTER selections $logFileName = "{0}_{1}_run_result.log" -f $TEST_TYPE.ToLowerInvariant(), $TECH_STACK.ToLowerInvariant() + $errLogFileName = "{0}_{1}_run_result.err" -f $TEST_TYPE.ToLowerInvariant(), $TECH_STACK.ToLowerInvariant() $logFile = Join-Path $LOG_DIR $logFileName + $errLogFile = Join-Path $env:TEMP $errLogFileName if (!(Test-Path $LOG_DIR)) { New-Item -ItemType Directory -Path $LOG_DIR -Force | Out-Null } '' | Out-File -FilePath $logFile -Encoding UTF8 Set-RunLogFile $logFile $script:GLOBAL_LOG = $logFile + $script:ERR_LOG = $errLogFile $script:WEB_LOG = $logFile $script:MOBILE_LOG = $logFile Log-Line "ℹ️ Log file path: $logFile" $GLOBAL_LOG