Skip to content

Commit

Permalink
github action #120
Browse files Browse the repository at this point in the history
  • Loading branch information
yousefvand committed Nov 26, 2024
1 parent 2a55785 commit 08fbfea
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,34 @@ jobs:
while (-not $success -and $retryCount -lt $maxRetries) {
try {
Invoke-WebRequest -Uri $bisonUrl -OutFile $bisonZip -UseBasicParsing -MaximumRedirection 5
# Validate content type
$fileType = Get-Content $bisonZip -TotalCount 1
if ($fileType -match "html|error") {
throw "Downloaded file is not a valid archive"
}
$success = $true
} catch {
$retryCount++
Write-Host "Download failed. Retrying ($retryCount/$maxRetries)..."
Start-Sleep -Seconds 5
}
}
# Verify if the download is successful
# Ensure the ZIP file exists and is valid
if (-not (Test-Path $bisonZip) -or (Get-Item $bisonZip).Length -lt 100000) {
Write-Host "Error: bison ZIP file is invalid or incomplete. Exiting."
exit 1
}
# Extract the ZIP archive using 7-Zip
$sevenZipPath = "C:\Program Files\7-Zip\7z.exe"
if (-not (Test-Path $sevenZipPath)) {
choco install 7zip -y
}
Start-Process -FilePath $sevenZipPath -ArgumentList "x `"$bisonZip`" -o`"$bisonDir`" -y" -NoNewWindow -Wait
# Ensure extraction succeeded
if (-not (Test-Path "$bisonDir\bin\bison.exe")) {
Write-Host "Error: bison could not be extracted. Exiting."
Expand Down

0 comments on commit 08fbfea

Please sign in to comment.