Skip to content

Commit

Permalink
add choco wrapper with retries
Browse files Browse the repository at this point in the history
  • Loading branch information
akashchi committed Jan 31, 2024
1 parent e40e5b8 commit 316869e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
32 changes: 32 additions & 0 deletions .github/utils/ChocoHelper.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
function Choco-Install {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[string] $PackageName,
[string[]] $ArgumentList,
[int] $RetryCount = 5
)

process {
$count = 1
while($true)
{
Write-Host "Running [#$count]: choco install $packageName -y $argumentList"
choco install $packageName -y @argumentList

$pkg = choco list --localonly $packageName --exact --all --limitoutput
if ($pkg) {
Write-Host "Package installed: $pkg"
break
}
else {
$count++
if ($count -ge $retryCount) {
Write-Host "Could not install $packageName after $count attempts"
exit 1
}
Start-Sleep -Seconds 30
}
}
}
}
5 changes: 4 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ jobs:
version: "v0.7.5"

- name: Install build dependencies
run: choco install --no-progress ninja
run: |
# Source script with `choco` wrapper that provides the retrying mechanism
. ${{ env.OPENVINO_REPO }}/.github/utils/ChocoHelper.ps1
Choco-Install -PackageName ninja
#
# Build
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/windows_conditional_compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ jobs:
version: "v0.5.4"

- name: Install build dependencies
run: choco install --no-progress ninja
run: |
# Source script with `choco` wrapper that provides the retrying mechanism
. ${{ env.OPENVINO_REPO }}/.github/utils/ChocoHelper.ps1
Choco-Install -PackageName ninja
- name: Install python dependencies
run: |
Expand Down

0 comments on commit 316869e

Please sign in to comment.