From ac09675f794c81810ad09a76746a6f109b7eeccc Mon Sep 17 00:00:00 2001 From: "Marios S. Kyriakou" Date: Sun, 21 Apr 2024 11:48:43 +0300 Subject: [PATCH 1/3] update cmake version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fdcd7ce..511d6e8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ # CMake is available at https://cmake.org/download/ # -cmake_minimum_required (VERSION 2.8.8) +cmake_minimum_required (VERSION 3.5.2) project(EPANET) From 8bf2334708d9350426e9e19a64788d4dd3704623 Mon Sep 17 00:00:00 2001 From: "Marios S. Kyriakou" Date: Sun, 21 Apr 2024 11:48:49 +0300 Subject: [PATCH 2/3] add macos badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index af873565..4b8b6a20 100755 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ OWA-EPANET [![codecov](https://codecov.io/gh/OpenWaterAnalytics/EPANET/branch/master/graph/badge.svg)](https://codecov.io/gh/OpenWaterAnalytics/EPANET) [![linux](https://github.com/OpenWaterAnalytics/EPANET/actions/workflows/ccpp.yml/badge.svg)](https://github.com/OpenWaterAnalytics/EPANET/actions/workflows/ccpp.yml) +[![macos](https://github.com/OpenWaterAnalytics/EPANET/actions/workflows/macos.yml/badge.svg)](https://github. +com/OpenWaterAnalytics/EPANET/actions/workflows/macos.yml) [![epanet2-win32](https://github.com/OpenWaterAnalytics/EPANET/actions/workflows/win32.yml/badge.svg)](https://github.com/OpenWaterAnalytics/EPANET/actions/workflows/win32.yml) [![epanet2-win64](https://github.com/OpenWaterAnalytics/EPANET/actions/workflows/win64.yml/badge.svg)](https://github.com/OpenWaterAnalytics/EPANET/actions/workflows/win64.yml) From cd242aa8199f5e2d36af1ca37cb1854df54d926e Mon Sep 17 00:00:00 2001 From: "Marios S. Kyriakou" Date: Sun, 21 Apr 2024 11:48:57 +0300 Subject: [PATCH 3/3] add retry build. --- .github/workflows/ccpp.yml | 63 ++++++++++++++++++++++++++----------- .github/workflows/macos.yml | 37 ++++++++++++++++++---- .github/workflows/win32.yml | 20 ++++++++++-- .github/workflows/win64.yml | 25 ++++++++++++--- 4 files changed, 114 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 090c5d6d..b0c7d9b1 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -9,27 +9,52 @@ on: jobs: build: runs-on: ubuntu-latest + strategy: + fail-fast: false steps: - - uses: actions/checkout@v4 - - name: Setup build directory - run: mkdir buildproducts + - uses: actions/checkout@v4 - - name: CMake - working-directory: ./buildproducts - run: cmake .. + - name: Setup build directory + run: mkdir buildproducts - - name: Make - working-directory: ./buildproducts - run: make + - name: CMake + working-directory: ./buildproducts + run: | + retry=0 + max_retries=3 + until cmake ..; do + retry=$((retry+1)) + echo "Retry $retry/$max_retries..." + if [ "$retry" -ge "$max_retries" ]; then + echo "CMake configuration failed after $max_retries attempts." + exit 1 + fi + sleep 10 + done - - name: Copy header files to build directory - run: | - cp include/epanet2.h buildproducts/ - cp include/epanet2_2.h buildproducts/ - cp include/epanet2_enums.h buildproducts/ - - - uses: actions/upload-artifact@v4 - with: - name: libepanet-output - path: buildproducts/ \ No newline at end of file + - name: Make + working-directory: ./buildproducts + run: | + retry=0 + max_retries=3 + until make; do + retry=$((retry+1)) + echo "Retry $retry/$max_retries..." + if [ "$retry" -ge "$max_retries" ]; then + echo "Make build failed after $max_retries attempts." + exit 1 + fi + sleep 10 + done + + - name: Copy header files to build directory + run: | + cp include/epanet2.h buildproducts/ + cp include/epanet2_2.h buildproducts/ + cp include/epanet2_enums.h buildproducts/ + + - uses: actions/upload-artifact@v4 + with: + name: libepanet-output + path: buildproducts/ diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index fa5913e2..78b0e7f6 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -9,26 +9,51 @@ on: jobs: build: runs-on: macos-latest + strategy: + fail-fast: false steps: - uses: actions/checkout@v4 + - name: Setup build directory run: mkdir buildproducts - + - name: CMake working-directory: ./buildproducts - run: cmake .. - + run: | + retry=0 + max_retries=3 + until cmake ..; do + ((retry++)) + echo "Retry $retry/$max_retries..." + if [ "$retry" -ge "$max_retries" ]; then + echo "CMake configuration failed after $max_retries attempts." + exit 1 + fi + sleep 10 + done + - name: Make working-directory: ./buildproducts - run: make - + run: | + retry=0 + max_retries=3 + until make; do + ((retry++)) + echo "Retry $retry/$max_retries..." + if [ "$retry" -ge "$max_retries" ]; then + echo "Make build failed after $max_retries attempts." + exit 1 + fi + sleep 10 + done + - name: Copy header files to build directory run: | cp include/epanet2.h buildproducts/ cp include/epanet2_2.h buildproducts/ cp include/epanet2_enums.h buildproducts/ - + - uses: actions/upload-artifact@v4 with: name: libepanet-output diff --git a/.github/workflows/win32.yml b/.github/workflows/win32.yml index cc9830fa..5c5a761f 100644 --- a/.github/workflows/win32.yml +++ b/.github/workflows/win32.yml @@ -9,6 +9,8 @@ on: jobs: build: runs-on: windows-latest + strategy: + fail-fast: false steps: - name: Checkout repository @@ -19,7 +21,21 @@ jobs: - name: CMake working-directory: ./buildproducts - run: cmake .. -A Win32 && cmake --build . --config Release + shell: pwsh + run: | + $retryCount = 0 + $maxRetries = 3 + do { + cmake .. -A Win32 && 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: | @@ -31,4 +47,4 @@ jobs: - uses: actions/upload-artifact@v4 with: name: epanet2-win32 - path: buildproducts\bin\Release \ No newline at end of file + path: buildproducts\bin\Release diff --git a/.github/workflows/win64.yml b/.github/workflows/win64.yml index 8b498176..0a1ee6ff 100644 --- a/.github/workflows/win64.yml +++ b/.github/workflows/win64.yml @@ -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 \ No newline at end of file + path: buildproducts\bin\Release