From 9d6e6d07f11cefb39a929459254463355ff6dba1 Mon Sep 17 00:00:00 2001 From: khansameer25 Date: Thu, 20 Feb 2025 16:09:13 -0500 Subject: [PATCH 1/4] GitHub Actions workflow for automated build and test --- .github/workflows/build.yml | 106 ++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..837d4305 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,106 @@ +name: Build and Test ldsCtrlEst + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Cache vcpkg binaries + uses: actions/cache@v3 + with: + path: ${{ runner.os == 'Windows' && 'C:\\Users\\runneradmin\\AppData\\Local\\vcpkg\\' || '~/.cache/vcpkg' }} + key: vcpkg-binary-${{ matrix.os }}-${{ hashFiles('vcpkg.json') }} + restore-keys: | + vcpkg-binary-${{ matrix.os }}- + - name: Cache vcpkg directory + uses: actions/cache@v3 + with: + path: vcpkg + key: vcpkg-${{ matrix.os }}-${{ hashFiles('vcpkg.json') }} + restore-keys: | + vcpkg-${{ matrix.os }}- + - name: Set up vcpkg for Windows + if: runner.os == 'Windows' + shell: pwsh + run: | + if (Test-Path -Path "vcpkg") { + Remove-Item -Recurse -Force "vcpkg" + } + git clone https://github.com/microsoft/vcpkg.git + cd vcpkg + .\bootstrap-vcpkg.bat + .\vcpkg integrate install + - name: Set up vcpkg for macOS/Linux + if: runner.os != 'Windows' + run: | + rm -rf vcpkg + git clone https://github.com/microsoft/vcpkg.git + cd vcpkg + ./bootstrap-vcpkg.sh + ./vcpkg integrate install + - name: Set up dependencies for macOS and Linux + if: runner.os != 'Windows' + run: | + if [ "${{ runner.os }}" == "macOS" ]; then + brew install cmake gfortran curl zip unzip gnu-tar + elif [ "${{ runner.os }}" == "Linux" ]; then + sudo apt-get update + sudo apt-get install -y cmake gfortran pkg-config build-essential + fi + - name: Set up dependencies for Windows + if: runner.os == 'Windows' + run: | + choco install cmake git + - name: Cache build directory + uses: actions/cache@v3 + with: + path: build + key: build-${{ matrix.os }}-${{ hashFiles('CMakeLists.txt') }} + restore-keys: | + build-${{ matrix.os }}- + - name: Configure and build for macOS/Linux + if: runner.os != 'Windows' + run: | + mkdir -p build && cd build + cmake .. -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install + cmake --build . --config Release --parallel + - name: Configure and build for Windows + if: runner.os == 'Windows' + shell: pwsh + run: | + if (Test-Path -Path "build") { + Remove-Item -Recurse -Force "build" + } + mkdir build + cd build + cmake .. -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install + cmake --build . --config Release --parallel + - name: Install (Windows only) + if: runner.os == 'Windows' + run: | + cd build + cmake --install . + - name: Add install directory to PATH (Windows only) + if: runner.os == 'Windows' + run: echo "${{github.workspace}}/install/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - name: Run tests + run: | + cd build + ctest -C Release \ No newline at end of file From fa08fa33b8539c1fc1ba79c446d138902c209886 Mon Sep 17 00:00:00 2001 From: Sameer Khan <94801110+khansameer25@users.noreply.github.com> Date: Fri, 28 Feb 2025 09:30:41 -0500 Subject: [PATCH 2/4] Update .github/workflows/build.yml Change main to master Co-authored-by: Kyle Johnsen --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 837d4305..3cca49e4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ name: Build and Test ldsCtrlEst on: push: branches: + - master - main pull_request: workflow_dispatch: From f202f42dd0eb6b4598d09ee55fcdba6d9c9d504d Mon Sep 17 00:00:00 2001 From: Sameer Khan <94801110+khansameer25@users.noreply.github.com> Date: Fri, 7 Mar 2025 10:40:30 -0500 Subject: [PATCH 3/4] Update build.yml --- .github/workflows/build.yml | 82 ++++++++++++------------------------- 1 file changed, 27 insertions(+), 55 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3cca49e4..fc00a5b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,6 @@ on: push: branches: - master - - main pull_request: workflow_dispatch: @@ -22,52 +21,27 @@ jobs: with: submodules: recursive - - name: Cache vcpkg binaries - uses: actions/cache@v3 - with: - path: ${{ runner.os == 'Windows' && 'C:\\Users\\runneradmin\\AppData\\Local\\vcpkg\\' || '~/.cache/vcpkg' }} - key: vcpkg-binary-${{ matrix.os }}-${{ hashFiles('vcpkg.json') }} - restore-keys: | - vcpkg-binary-${{ matrix.os }}- - - name: Cache vcpkg directory - uses: actions/cache@v3 - with: - path: vcpkg - key: vcpkg-${{ matrix.os }}-${{ hashFiles('vcpkg.json') }} - restore-keys: | - vcpkg-${{ matrix.os }}- - - name: Set up vcpkg for Windows - if: runner.os == 'Windows' - shell: pwsh - run: | - if (Test-Path -Path "vcpkg") { - Remove-Item -Recurse -Force "vcpkg" - } - git clone https://github.com/microsoft/vcpkg.git - cd vcpkg - .\bootstrap-vcpkg.bat - .\vcpkg integrate install - - name: Set up vcpkg for macOS/Linux - if: runner.os != 'Windows' - run: | - rm -rf vcpkg - git clone https://github.com/microsoft/vcpkg.git - cd vcpkg - ./bootstrap-vcpkg.sh - ./vcpkg integrate install - name: Set up dependencies for macOS and Linux if: runner.os != 'Windows' run: | if [ "${{ runner.os }}" == "macOS" ]; then - brew install cmake gfortran curl zip unzip gnu-tar + brew install cmake ninja elif [ "${{ runner.os }}" == "Linux" ]; then sudo apt-get update - sudo apt-get install -y cmake gfortran pkg-config build-essential + sudo apt-get install -y cmake build-essential fi + - name: Set up dependencies for Windows if: runner.os == 'Windows' run: | - choco install cmake git + choco install cmake + + - name: Run vcpkg + uses: lukka/run-vcpkg@v11 + with: + vcpkgJsonGlob: 'vcpkg.json' + runVcpkgInstall: true + - name: Cache build directory uses: actions/cache@v3 with: @@ -75,33 +49,31 @@ jobs: key: build-${{ matrix.os }}-${{ hashFiles('CMakeLists.txt') }} restore-keys: | build-${{ matrix.os }}- + - name: Configure and build for macOS/Linux if: runner.os != 'Windows' - run: | - mkdir -p build && cd build - cmake .. -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install - cmake --build . --config Release --parallel + uses: lukka/run-cmake@v10 + with: + cmakeListsTxtPath: CMakeLists.txt + configurePreset: 'linux-release' + buildPreset: 'linux-release' + - name: Configure and build for Windows if: runner.os == 'Windows' - shell: pwsh - run: | - if (Test-Path -Path "build") { - Remove-Item -Recurse -Force "build" - } - mkdir build - cd build - cmake .. -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install - cmake --build . --config Release --parallel - - name: Install (Windows only) + uses: lukka/run-cmake@v10 + with: + cmakeListsTxtPath: CMakeLists.txt + configurePreset: 'windows-release' + buildPreset: 'windows-release' + + - name: Install and Update PATH (Windows only) if: runner.os == 'Windows' run: | cd build cmake --install . - - name: Add install directory to PATH (Windows only) - if: runner.os == 'Windows' - run: echo "${{github.workspace}}/install/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "${{github.workspace}}/install/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Run tests run: | cd build - ctest -C Release \ No newline at end of file + ctest -C Release From 8c7d8531c72b913711e62d1a80101713b8c51a48 Mon Sep 17 00:00:00 2001 From: Sameer Khan <94801110+khansameer25@users.noreply.github.com> Date: Fri, 7 Mar 2025 10:41:21 -0500 Subject: [PATCH 4/4] Create CMakePresets.json --- CMakePresets.json | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 CMakePresets.json diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..38a6195c --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,42 @@ +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 18, + "patch": 0 + }, + "configurePresets": [ + { + "name": "linux-release", + "hidden": false, + "generator": "Unix Makefiles", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/install" + } + }, + { + "name": "windows-release", + "hidden": false, + "generator": "Visual Studio 17 2022", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/install" + } + } + ], + "buildPresets": [ + { + "name": "linux-release", + "configurePreset": "linux-release", + "hidden": false + }, + { + "name": "windows-release", + "configurePreset": "windows-release", + "hidden": false + } + ] +}