add retry build.

This commit is contained in:
Marios S. Kyriakou
2024-04-21 11:48:57 +03:00
parent 8bf2334708
commit cd242aa819
4 changed files with 114 additions and 31 deletions

View File

@@ -9,6 +9,8 @@ on:
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
steps:
- name: Checkout repository
@@ -19,16 +21,31 @@ jobs:
- name: CMake
working-directory: ./buildproducts
run: cmake .. -A x64 && cmake --build . --config Release
shell: pwsh
run: |
$retryCount = 0
$maxRetries = 3
do {
cmake .. -A x64 # Specify architecture for 64-bit
cmake --build . --config Release
if ($LASTEXITCODE -eq 0) { break }
Write-Host "Retry $($retryCount + 1)/$maxRetries..."
Start-Sleep -Seconds 10
$retryCount++
} while ($retryCount -lt $maxRetries)
if ($retryCount -eq $maxRetries) {
Write-Host "CMake build failed after $maxRetries attempts."
exit 1
}
- name: Copy header files to build directory
run: |
copy include\epanet2.h buildproducts\bin\Release
copy include\epanet2_2.h buildproducts\bin\Release
copy include\epanet2_enums.h buildproducts\bin\Release
shell: cmd
- uses: actions/upload-artifact@v4
with:
name: epanet2-win64
path: buildproducts\bin\Release
path: buildproducts\bin\Release