Add test check before running the main Python script.
This commit is contained in:
@@ -9,6 +9,11 @@ function Run-PythonScript {
|
|||||||
return $process.ExitCode
|
return $process.ExitCode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Run-Tests {
|
||||||
|
$process = Start-Process -FilePath "powershell" -ArgumentList "-File run_tests.ps1" -PassThru -Wait -NoNewWindow
|
||||||
|
return $process.ExitCode
|
||||||
|
}
|
||||||
|
|
||||||
function Git-Pull {
|
function Git-Pull {
|
||||||
git pull
|
git pull
|
||||||
return $LASTEXITCODE -eq 0
|
return $LASTEXITCODE -eq 0
|
||||||
@@ -17,6 +22,17 @@ function Git-Pull {
|
|||||||
$waitTime = 15
|
$waitTime = 15
|
||||||
while ($true) {
|
while ($true) {
|
||||||
python -m pip install -r requirements.txt
|
python -m pip install -r requirements.txt
|
||||||
|
|
||||||
|
Write-Host "Running tests..."
|
||||||
|
$testExitCode = Run-Tests
|
||||||
|
if ($testExitCode -ne 0) {
|
||||||
|
Write-Host "Tests failed. Waiting $waitTime seconds before next attempt..."
|
||||||
|
Start-Sleep -Seconds $waitTime
|
||||||
|
$waitTime *= 2
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Tests passed. Starting main Python script..."
|
||||||
$exitCode = Run-PythonScript -ScriptPath $PythonFile
|
$exitCode = Run-PythonScript -ScriptPath $PythonFile
|
||||||
|
|
||||||
if (Test-Path -Path ".\.doreboot") {
|
if (Test-Path -Path ".\.doreboot") {
|
||||||
|
|||||||
Reference in New Issue
Block a user