From c95bf0c13e0acb7f268f2a54b3e8a8e90dd3fb10 Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 18:55:42 +0000 Subject: [PATCH 01/19] ci: add GitHub Actions workflow for continuous integration --- .github/workflows/ci.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..00caafd --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,22 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: + name: ubuntu:22.04-release + runs-on: ubuntu-22.04 + steps: + - name: install dependencies + run: | + apt-get update + apt-get install -y \ + build-essential \ + clang-format \ + cmake \ + ninja-build + - name: checkout repository + uses: actions/checkout@v4 + - name: compile + run: | + cmake -B build -S . From def5ff6d87f959bfc7315d1a5ac46e961777d57e Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 18:58:28 +0000 Subject: [PATCH 02/19] ci: update CI workflow to use Ninja generator and fix dependency installation using sudo --- .github/workflows/ci.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 00caafd..633be14 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,11 +6,14 @@ jobs: build: name: ubuntu:22.04-release runs-on: ubuntu-22.04 + env: + CMAKE_GENERATOR: Ninja + DEBIAN_FRONTEND: noninteractive steps: - name: install dependencies run: | - apt-get update - apt-get install -y \ + sudo apt update + sudo apt install -y \ build-essential \ clang-format \ cmake \ From 0097dcaef1734f0315655f5ad120961063732d7c Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 19:06:13 +0000 Subject: [PATCH 03/19] ci: enhance CI workflow with separate configure, build, test, and install steps --- .github/workflows/ci.yaml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 633be14..bac4c06 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,6 +20,17 @@ jobs: ninja-build - name: checkout repository uses: actions/checkout@v4 - - name: compile + - name: configure run: | - cmake -B build -S . + cmake -S . -B build \ + -DCMAKE_BUILD_TYPE=Release + - name: build + run: | + cmake --build build + - name: test + run: | + cd build + ctest --output-on-failure + - name: install + run: | + sudo cmake --install build From 986f98faede0a4532442f1c7c5c8bfb9445d14e5 Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 19:10:39 +0000 Subject: [PATCH 04/19] ci: set default shell to bash with strict error handling in CI workflow --- .github/workflows/ci.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bac4c06..68a1afd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,6 +9,9 @@ jobs: env: CMAKE_GENERATOR: Ninja DEBIAN_FRONTEND: noninteractive + defaults: + run: + shell: bash -e -o pipefail {0} steps: - name: install dependencies run: | From e13c339f80cc7550a63fa0514be860b01855bf46 Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 19:32:20 +0000 Subject: [PATCH 05/19] ci: add Windows build job to CI workflow for Windows 2022 --- .github/workflows/ci.yaml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 68a1afd..d94e416 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,8 +3,8 @@ name: CI on: [push, pull_request] jobs: - build: - name: ubuntu:22.04-release + build-linux: + name: ubuntu-22.04-release runs-on: ubuntu-22.04 env: CMAKE_GENERATOR: Ninja @@ -37,3 +37,20 @@ jobs: - name: install run: | sudo cmake --install build + build-windows: + name: windows-2022-release + runs-on: windows-2022 + defaults: + run: + shell: msys2 {0} + steps: + - name: checkout repository + uses: actions/checkout@v4 + - name: configure + run: | + cmake -S . -B build \ + -DCMAKE_BUILD_TYPE=Release \ + -G Ninja + - name: build + run: | + cmake --build build \ No newline at end of file From 26e8cf19f1e9aaaf9f75834bd7044bd2abaab01a Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 19:37:05 +0000 Subject: [PATCH 06/19] ci: comment out Linux build job for now and update Windows shell to msys2bash --- .github/workflows/ci.yaml | 70 +++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d94e416..efffce0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,46 +3,46 @@ name: CI on: [push, pull_request] jobs: - build-linux: - name: ubuntu-22.04-release - runs-on: ubuntu-22.04 - env: - CMAKE_GENERATOR: Ninja - DEBIAN_FRONTEND: noninteractive - defaults: - run: - shell: bash -e -o pipefail {0} - steps: - - name: install dependencies - run: | - sudo apt update - sudo apt install -y \ - build-essential \ - clang-format \ - cmake \ - ninja-build - - name: checkout repository - uses: actions/checkout@v4 - - name: configure - run: | - cmake -S . -B build \ - -DCMAKE_BUILD_TYPE=Release - - name: build - run: | - cmake --build build - - name: test - run: | - cd build - ctest --output-on-failure - - name: install - run: | - sudo cmake --install build + # build-linux: + # name: ubuntu-22.04-release + # runs-on: ubuntu-22.04 + # env: + # CMAKE_GENERATOR: Ninja + # DEBIAN_FRONTEND: noninteractive + # defaults: + # run: + # shell: bash -e -o pipefail {0} + # steps: + # - name: install dependencies + # run: | + # sudo apt update + # sudo apt install -y \ + # build-essential \ + # clang-format \ + # cmake \ + # ninja-build + # - name: checkout repository + # uses: actions/checkout@v4 + # - name: configure + # run: | + # cmake -S . -B build \ + # -DCMAKE_BUILD_TYPE=Release + # - name: build + # run: | + # cmake --build build + # - name: test + # run: | + # cd build + # ctest --output-on-failure + # - name: install + # run: | + # sudo cmake --install build build-windows: name: windows-2022-release runs-on: windows-2022 defaults: run: - shell: msys2 {0} + shell: msys2bash {0} steps: - name: checkout repository uses: actions/checkout@v4 From b0633eaf1c75782ceb3bb0261ff2280f90d8884a Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 19:38:08 +0000 Subject: [PATCH 07/19] try fix msys shell --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index efffce0..1f259e5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,7 +42,7 @@ jobs: runs-on: windows-2022 defaults: run: - shell: msys2bash {0} + shell: C:\msys64 {0} steps: - name: checkout repository uses: actions/checkout@v4 From 26555baddb574e9f8effa27b7a3cda569e5b3644 Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 19:39:48 +0000 Subject: [PATCH 08/19] ci: update Windows shell path to use bash executable --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1f259e5..09ad8cd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,7 +42,7 @@ jobs: runs-on: windows-2022 defaults: run: - shell: C:\msys64 {0} + shell: C:\msys64\usr\bin\bash.exe {0} steps: - name: checkout repository uses: actions/checkout@v4 From 943fee4fc956089b36a0fbe06069bd7a0afa0104 Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 19:40:40 +0000 Subject: [PATCH 09/19] ci: remove Ninja generator from CMake configuration --- .github/workflows/ci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 09ad8cd..ec1a65e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -49,8 +49,7 @@ jobs: - name: configure run: | cmake -S . -B build \ - -DCMAKE_BUILD_TYPE=Release \ - -G Ninja + -DCMAKE_BUILD_TYPE=Release - name: build run: | cmake --build build \ No newline at end of file From c18db213b8740f66c5cb827b4d2b2fe20f817e4f Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 19:47:26 +0000 Subject: [PATCH 10/19] ci: update C++ compiler flags for MSVC to use warning level 3 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e6f68f..2ee189e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) if(MSVC) - set(CMAKE_CXX_FLAGS "/EHsc /Wall") + set(CMAKE_CXX_FLAGS "/EHsc /W3") set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS 1) set(CMAKE_CXX_FLAGS_RELEASE "/O2") add_compile_definitions(_USE_MATH_DEFINES) From 837222e419f6c7c46e1d6279b4e0b5e5ebd8ae2a Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 19:50:29 +0000 Subject: [PATCH 11/19] ci: remove unnecessary _USE_MATH_DEFINES definition from Math.hpp and odrSpiral.cpp --- include/Math.hpp | 1 - src/Geometries/Spiral/odrSpiral.cpp | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/Math.hpp b/include/Math.hpp index 97ab855..c409e73 100644 --- a/include/Math.hpp +++ b/include/Math.hpp @@ -1,5 +1,4 @@ #pragma once -#define _USE_MATH_DEFINES #include #include #include diff --git a/src/Geometries/Spiral/odrSpiral.cpp b/src/Geometries/Spiral/odrSpiral.cpp index 2d21fb0..18e341d 100644 --- a/src/Geometries/Spiral/odrSpiral.cpp +++ b/src/Geometries/Spiral/odrSpiral.cpp @@ -35,9 +35,8 @@ */ /* ====== INCLUSIONS ====== */ -#include -#define _USE_MATH_DEFINES #include +#include namespace odr { From f849d56b63693a148e5688bf363082d71382fcc5 Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 19:51:00 +0000 Subject: [PATCH 12/19] ci: add testing and installation steps to CI workflow for windows-2022 --- .github/workflows/ci.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ec1a65e..1830fbd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -52,4 +52,11 @@ jobs: -DCMAKE_BUILD_TYPE=Release - name: build run: | - cmake --build build \ No newline at end of file + cmake --build build + - name: test + run: | + cd build + ctest --output-on-failure + - name: install + run: | + sudo cmake --install build \ No newline at end of file From 0cc22e16c1f626fa637dfd2dae9642e1819309f2 Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 19:56:34 +0000 Subject: [PATCH 13/19] ci: remove sudo from cmake install command in CI workflow --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1830fbd..2f1356e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -59,4 +59,4 @@ jobs: ctest --output-on-failure - name: install run: | - sudo cmake --install build \ No newline at end of file + cmake --install build \ No newline at end of file From 6aaf34c96306d138471f3257cd5124abb87195ff Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 19:58:35 +0000 Subject: [PATCH 14/19] ci: restore and update CI workflow for Linux build on ubuntu-22.04, don't set ninja generator --- .github/workflows/ci.yaml | 57 ++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2f1356e..dc8cdad 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,40 +3,29 @@ name: CI on: [push, pull_request] jobs: - # build-linux: - # name: ubuntu-22.04-release - # runs-on: ubuntu-22.04 - # env: - # CMAKE_GENERATOR: Ninja - # DEBIAN_FRONTEND: noninteractive - # defaults: - # run: - # shell: bash -e -o pipefail {0} - # steps: - # - name: install dependencies - # run: | - # sudo apt update - # sudo apt install -y \ - # build-essential \ - # clang-format \ - # cmake \ - # ninja-build - # - name: checkout repository - # uses: actions/checkout@v4 - # - name: configure - # run: | - # cmake -S . -B build \ - # -DCMAKE_BUILD_TYPE=Release - # - name: build - # run: | - # cmake --build build - # - name: test - # run: | - # cd build - # ctest --output-on-failure - # - name: install - # run: | - # sudo cmake --install build + build-linux: + name: ubuntu-22.04-release + runs-on: ubuntu-22.04 + defaults: + run: + shell: bash -e -o pipefail {0} + steps: + - name: checkout repository + uses: actions/checkout@v4 + - name: configure + run: | + cmake -S . -B build \ + -DCMAKE_BUILD_TYPE=Release + - name: build + run: | + cmake --build build + - name: test + run: | + cd build + ctest --output-on-failure + - name: install + run: | + sudo cmake --install build build-windows: name: windows-2022-release runs-on: windows-2022 From 2c649b9e55a0962cfed5ed4bb3799f18f09a850d Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 20:08:25 +0000 Subject: [PATCH 15/19] ci: streamline CI workflow by consolidating cmake commands and adding configuration options for Windows build --- .github/workflows/ci.yaml | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dc8cdad..78338f8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,19 +13,13 @@ jobs: - name: checkout repository uses: actions/checkout@v4 - name: configure - run: | - cmake -S . -B build \ - -DCMAKE_BUILD_TYPE=Release + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release - name: build - run: | - cmake --build build + run: cmake --build build - name: test - run: | - cd build - ctest --output-on-failure + run: ctest --test-dir build --output-on-failure - name: install - run: | - sudo cmake --install build + run: sudo cmake --install build build-windows: name: windows-2022-release runs-on: windows-2022 @@ -36,16 +30,10 @@ jobs: - name: checkout repository uses: actions/checkout@v4 - name: configure - run: | - cmake -S . -B build \ - -DCMAKE_BUILD_TYPE=Release + run: cmake -S . -B build -G "Visual Studio 17 2022" - name: build - run: | - cmake --build build + run: cmake --build build --config Release - name: test - run: | - cd build - ctest --output-on-failure + run: ctest --test-dir build --output-on-failure --config Release - name: install - run: | - cmake --install build \ No newline at end of file + run: cmake --install build --config Release \ No newline at end of file From 0b80726d4dcce9fe881af2fa05623a8bed933019 Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 20:12:01 +0000 Subject: [PATCH 16/19] ci: remove wrong --config option from test command in CI workflow --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 78338f8..ed6042a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -34,6 +34,6 @@ jobs: - name: build run: cmake --build build --config Release - name: test - run: ctest --test-dir build --output-on-failure --config Release + run: ctest --test-dir build --output-on-failure - name: install run: cmake --install build --config Release \ No newline at end of file From 1239e9142b38cea62779be7be9d0ff765d9e4647 Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 20:35:12 +0000 Subject: [PATCH 17/19] ci: enhance format-files script with error handling and check mode --- format-files.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/format-files.sh b/format-files.sh index aa6e98d..8fb62dd 100755 --- a/format-files.sh +++ b/format-files.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +set -euo pipefail + +MODE="${1:-default}" + PROJ_ROOT=$(dirname $0) if ! type -p clang-format >/dev/null; then @@ -21,7 +25,13 @@ else exit 1 fi +EXTRA_FLAGS="" +if [[ "$MODE" == "check" ]]; then + echo "check mode enabled, not formatting files, only checking" + EXTRA_FLAGS="--dry-run --Werror" +fi + find "${PROJ_ROOT}" -type f \ \( -name "*.cpp" -o -name "*.c" -o -name "*.hpp" -o -name "*.h" \) \ -not -path "${PROJ_ROOT}/build/*" \ - -print -exec clang-format --style=file -i '{}' \; \ No newline at end of file + -print0 | xargs -0 clang-format $EXTRA_FLAGS --style=file --verbose -i \ No newline at end of file From 076ee6eaa6ba4000b201e9f4dbe6d889aed62fba Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 20:36:05 +0000 Subject: [PATCH 18/19] ci: add format check step to CI workflow for consistency --- .github/workflows/ci.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ed6042a..45fde09 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,6 +12,8 @@ jobs: steps: - name: checkout repository uses: actions/checkout@v4 + - name: check format + run: ./format-files.sh check - name: configure run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release - name: build @@ -29,6 +31,8 @@ jobs: steps: - name: checkout repository uses: actions/checkout@v4 + - name: check format + run: ./format-files.sh check - name: configure run: cmake -S . -B build -G "Visual Studio 17 2022" - name: build From 25cea93ad9acffdbd922667e0a052e59a109fcf4 Mon Sep 17 00:00:00 2001 From: Sebastian Pagel Date: Sun, 19 Jan 2025 21:15:09 +0000 Subject: [PATCH 19/19] ci: remove format check step from CI workflow --- .github/workflows/ci.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 45fde09..42df0ad 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,8 +31,6 @@ jobs: steps: - name: checkout repository uses: actions/checkout@v4 - - name: check format - run: ./format-files.sh check - name: configure run: cmake -S . -B build -G "Visual Studio 17 2022" - name: build