Skip to content

Commit

Permalink
Try it a different way
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmundt committed Mar 4, 2025
1 parent b0ed034 commit 04cd62c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/test_branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,22 @@ jobs:
# Main installation loop
for PKG in $PACKAGES; do
if [[ "${{matrix.TARGET}}" == win ]]; then
# Use PowerShell to run conda install with a timeout
powershell -Command "Start-Process conda -ArgumentList 'install', '-q', '-y', '$PKG' -NoNewWindow -Wait -Timeout 30; if ($LASTEXITCODE -ne 0) { Write-Host 'WARNING: $PKG not available or did not install correctly' }"
powershell -Command "
$process = Start-Process conda -ArgumentList 'install', '-q', '-y', '$PKG' -NoNewWindow -PassThru;
$timeout = 30;
$startTime = Get-Date;
while (-not $process.HasExited) {
Start-Sleep -Seconds 1;
if ((Get-Date) - $startTime -gt [TimeSpan]::FromSeconds($timeout)) {
Stop-Process -Id $process.Id;
Write-Host 'WARNING: $PKG installation timed out';
break;
}
}
if ($process.ExitCode -ne 0) {
Write-Host 'WARNING: $PKG not available or did not install correctly';
}
"
else
# For Linux or other environments
timeout 30 conda install -q -y $PKG || echo "WARNING: $PKG not available or did not install correctly"
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/test_pr_and_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,22 @@ jobs:
# Main installation loop
for PKG in $PACKAGES; do
if [[ "${{matrix.TARGET}}" == win ]]; then
# Use PowerShell to run conda install with a timeout
powershell -Command "Start-Process conda -ArgumentList 'install', '-q', '-y', '$PKG' -NoNewWindow -Wait -Timeout 30; if ($LASTEXITCODE -ne 0) { Write-Host 'WARNING: $PKG not available or did not install correctly' }"
powershell -Command "
$process = Start-Process conda -ArgumentList 'install', '-q', '-y', '$PKG' -NoNewWindow -PassThru;
$timeout = 30;
$startTime = Get-Date;
while (-not $process.HasExited) {
Start-Sleep -Seconds 1;
if ((Get-Date) - $startTime -gt [TimeSpan]::FromSeconds($timeout)) {
Stop-Process -Id $process.Id;
Write-Host 'WARNING: $PKG installation timed out';
break;
}
}
if ($process.ExitCode -ne 0) {
Write-Host 'WARNING: $PKG not available or did not install correctly';
}
"
else
# For Linux or other environments
timeout 30 conda install -q -y $PKG || echo "WARNING: $PKG not available or did not install correctly"
Expand Down

0 comments on commit 04cd62c

Please sign in to comment.