Skip to content

Commit ea595eb

Browse files
committed
win mac merge init commit
1 parent 0609a1e commit ea595eb

File tree

1 file changed

+44
-22
lines changed

1 file changed

+44
-22
lines changed

.github/workflows/test-scripts.yml

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ jobs:
200200
- name: Check PowerShell version
201201
run: |
202202
$PSVersionTable.PSVersion
203-
Write-Host "PowerShell version check complete"
203+
Write-Host "PowerShell version check complete"
204204
205205
- name: Validate PowerShell script syntax
206206
run: |
@@ -209,7 +209,7 @@ jobs:
209209
$null = [System.Management.Automation.PSParser]::Tokenize((Get-Content -Raw $ScriptPath), [ref]$null)
210210
$CommonScriptPath = "common/win/run.ps1"
211211
$null = [System.Management.Automation.PSParser]::Tokenize((Get-Content -Raw $CommonScriptPath), [ref]$null)
212-
Write-Host "win/run.ps1 syntax is valid"
212+
Write-Host "win/run.ps1 syntax is valid"
213213
214214
- name: Validate supporting PowerShell scripts syntax
215215
run: |
@@ -224,7 +224,7 @@ jobs:
224224
)
225225
foreach ($Script in $Scripts) {
226226
$null = [System.Management.Automation.PSParser]::Tokenize((Get-Content -Raw $Script), [ref]$null)
227-
Write-Host "$Script syntax is valid"
227+
Write-Host "$Script syntax is valid"
228228
}
229229
230230
- name: Run PSScriptAnalyzer
@@ -236,7 +236,7 @@ jobs:
236236
237237
Write-Host "Running PSScriptAnalyzer..."
238238
Invoke-ScriptAnalyzer -Path "win" -Recurse -ReportSummary -ErrorAction Continue
239-
Write-Host "PSScriptAnalyzer analysis complete (continuing even if issues are found)"
239+
Write-Host "PSScriptAnalyzer analysis complete (continuing even if issues are found)"
240240
241241
- name: Check script file encoding
242242
run: |
@@ -254,14 +254,14 @@ jobs:
254254
}
255255
256256
Write-Host "Detected encoding (heuristic): $encoding"
257-
Write-Host "Encoding check complete"
257+
Write-Host "Encoding check complete"
258258
259259
- name: Verify required dependencies
260260
run: |
261261
Write-Host "Checking required dependencies..."
262-
if (Get-Command curl.exe -ErrorAction SilentlyContinue) { Write-Host "curl found" } else { Write-Host "⚠️ curl not found" }
263-
if (Get-Command git.exe -ErrorAction SilentlyContinue) { Write-Host "git found" } else { Write-Host "⚠️ git not found" }
264-
Write-Host "PowerShell dependencies verified"
262+
if (Get-Command curl.exe -ErrorAction SilentlyContinue) { Write-Host "curl found" } else { Write-Host "⚠️ curl not found" }
263+
if (Get-Command git.exe -ErrorAction SilentlyContinue) { Write-Host "git found" } else { Write-Host "⚠️ git not found" }
264+
Write-Host "PowerShell dependencies verified"
265265
266266
- name: Integration Test - Silent Mode Execution
267267
if: success()
@@ -284,6 +284,28 @@ jobs:
284284
# Absolute path is safer in CI
285285
$scriptPath = Join-Path $env:GITHUB_WORKSPACE "win\run.ps1"
286286
287+
$logRoot = Join-Path $env:TEMP "now-tests"
288+
New-Item -ItemType Directory -Force -Path $logRoot | Out-Null
289+
$logPath = Join-Path $logRoot "run_test_web_python.log"
290+
291+
Write-Host "================================"
292+
Write-Host "Testing: $scriptPath --silent web python"
293+
Write-Host "================================"
294+
295+
& $scriptPath --silent web python 2>&1 | Tee-Object -FilePath $logPath -Append
296+
$exitCode = $LASTEXITCODE
297+
298+
if ($exitCode -eq 0) {
299+
Write-Host "web / python completed (exit code: $exitCode)"
300+
} else {
301+
Write-Host "web / python exited with code: $exitCode"
302+
if (Test-Path $logPath) {
303+
Write-Host "Log output (last 20 lines):"
304+
Get-Content -Path $logPath -Tail 20
305+
}
306+
exit 1
307+
}
308+
287309
$testConfigs = @(
288310
@("web", "python"),
289311
@("app", "python"),
@@ -314,17 +336,17 @@ jobs:
314336
$exited = $p.WaitForExit(600000)
315337
316338
if (-not $exited) {
317-
Write-Host "⚠️ $testType / $techStack timed out after 600 seconds"
339+
Write-Host "$testType / $techStack timed out after 600 seconds"
318340
$p.Kill()
319341
$exitCode = 124
320342
} else {
321343
$exitCode = $p.ExitCode
322344
}
323345
324346
if ($exitCode -eq 0) {
325-
Write-Host "$testType / $techStack completed (exit code: $exitCode)"
347+
Write-Host "$testType / $techStack completed (exit code: $exitCode)"
326348
} else {
327-
Write-Host "⚠️ $testType / $techStack exited with code: $exitCode"
349+
Write-Host "$testType / $techStack exited with code: $exitCode"
328350
$overallFailed = $true
329351
330352
if (Test-Path $logPath) {
@@ -344,7 +366,7 @@ jobs:
344366
exit 1
345367
}
346368
347-
Write-Host "All integration tests completed successfully"
369+
Write-Host "All integration tests completed successfully"
348370
349371
- name: Sync BrowserStack logs to workspace (Windows)
350372
if: always()
@@ -399,7 +421,7 @@ jobs:
399421
echo "Validating mac/run.sh syntax..."
400422
bash -n mac/run.sh
401423
bash -n common/mac/run.sh
402-
echo "mac/run.sh syntax is valid"
424+
echo "mac/run.sh syntax is valid"
403425
404426
- name: Validate supporting scripts syntax
405427
run: |
@@ -409,7 +431,7 @@ jobs:
409431
bash -n common/mac/env-setup-run.sh
410432
bash -n common/mac/user-interaction.sh
411433
bash -n common/mac/env-prequisite-checks.sh
412-
echo "All supporting scripts are valid"
434+
echo "All supporting scripts are valid"
413435
414436
- name: Check if scripts are executable
415437
run: |
@@ -419,7 +441,7 @@ jobs:
419441
chmod +x common/mac/env-setup-run.sh
420442
chmod +x common/mac/user-interaction.sh
421443
chmod +x common/mac/env-prequisite-checks.sh
422-
echo "All scripts are executable"
444+
echo "All scripts are executable"
423445
424446
- name: Install ShellCheck
425447
run: |
@@ -438,23 +460,23 @@ jobs:
438460
shellcheck -x common/mac/env-setup-run.sh || true
439461
shellcheck -x common/mac/user-interaction.sh || true
440462
shellcheck -x common/mac/env-prequisite-checks.sh || true
441-
echo "ShellCheck analysis complete"
463+
echo "ShellCheck analysis complete"
442464
443465
- name: Verify required dependencies
444466
run: |
445467
echo "Checking required dependencies..."
446-
command -v bash && echo "bash found"
447-
command -v curl && echo "curl found"
448-
command -v git && echo "git found"
449-
command -v bc && echo "bc found"
468+
command -v bash && echo "bash found"
469+
command -v curl && echo "curl found"
470+
command -v git && echo "git found"
471+
command -v bc && echo "bc found"
450472
echo "All required dependencies are available"
451473
452474
- name: Test script sourcing (dry run)
453475
run: |
454476
set -e
455477
echo "Testing script sourcing..."
456-
bash -c "source common/mac/common-utils.sh && echo 'common-utils.sh sourced successfully'"
457-
echo "Script sourcing successful"
478+
bash -c "source common/mac/common-utils.sh && echo 'common-utils.sh sourced successfully'"
479+
echo "Script sourcing successful"
458480
459481
- name: Integration Test - Silent Mode Execution
460482
if: success()

0 commit comments

Comments
 (0)