Skip to content

Commit 029150a

Browse files
committed
Fix run-command-for-every-tests-project.ps1
1 parent bb43b8f commit 029150a

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

.github/actions/project-build/run-command-for-every-tests-project.ps1

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,23 @@ Get-ChildItem -Path $testsFolderPath -Directory -Recurse `
2222
| ForEach-Object {
2323
$testsProjectName = $_.Name
2424
$testsProjectPath = Join-Path -Path $testsFolderPath -ChildPath $testsProjectName
25-
Write-Output "Tests project found: $testsProjectPath. Executing a command: $commandToExecute"
26-
bash -c "PROJECT_PATH=$testsProjectPath && $commandToExecute"
27-
if ($LASTEXITCODE -ne 0) {
28-
$global:exitCode = $LASTEXITCODE
25+
Write-Host "Tests project found: $testsProjectPath. Executing a command: $commandToExecute"
26+
try {
27+
bash -c "PROJECT_PATH=$testsProjectPath && $commandToExecute"
28+
if ($LASTEXITCODE -ne 0) {
29+
Write-Host "Command failed with exit code $LASTEXITCODE"
30+
$global:exitCode = $LASTEXITCODE
31+
}
2932
}
33+
catch {
34+
Write-Host "Exception while running command in: $testsProjectPath"
35+
$global:exitCode = 1
36+
}
37+
}
38+
39+
if ($global:exitCode -ne 0) {
40+
Write-Host "`nOne or more test commands failed."
41+
exit $global:exitCode
42+
} else {
43+
Write-Host "`nAll test projects executed successfully."
3044
}

0 commit comments

Comments
 (0)