From fdc2d9499ff15b876515b861f69ec3c49069543e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Tue, 6 Oct 2026 14:49:25 +0200 Subject: [PATCH] Dev/win ci (#410) Added CI (wheels + native build for Windows) closes #397 --------- Co-authored-by: Tomas Celko --- .github/workflows/build_wheel.yml | 2 +- .github/workflows/build_windows.yml | 37 +++++++++++++++++++++++++++++ RELEASE.md | 3 +++ include/aare/Cluster.hpp | 6 ++--- include/aare/logger.hpp | 2 +- pyproject.toml | 3 +++ src/Dtype.cpp | 2 +- 7 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build_windows.yml diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 997a19d2..bc4f6683 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -17,7 +17,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest,macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml new file mode 100644 index 00000000..5078cf5e --- /dev/null +++ b/.github/workflows/build_windows.yml @@ -0,0 +1,37 @@ +name: Build and test on Windows + +on: + workflow_dispatch: + push: + pull_request: + +jobs: + build: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install Python dependencies + run: python -m pip install ninja numpy matplotlib pytest pytest-check boost-histogram + + # Puts cl.exe on the path so that CMake can use the Ninja generator + - uses: ilammy/msvc-dev-cmd@v1 + + - name: Configure + run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DAARE_TESTS=ON -DAARE_PYTHON_BINDINGS=ON -DAARE_WARNINGS_AS_ERRORS=ON + + - name: Build + run: cmake --build build + + - name: C++ unit tests + run: ctest --test-dir build --output-on-failure -j4 + + - name: Python unit tests + env: + PYTHONPATH: ${{ github.workspace }}\build + run: python -m pytest python/tests diff --git a/RELEASE.md b/RELEASE.md index 16f2322b..86d00ed2 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -7,6 +7,9 @@ - Added the Python ``xy`` type with ``row`` and ``col`` fields, enabling access to ``RawFile.geometry``, ``RawMasterFile.detector_layout``, and ``RawMasterFile.udp_interfaces_per_module``. It unpacks as ``row, col``. +- Added Windows wheels (``win_amd64``, Python 3.12 to 3.14) to the wheel + build, so releases publish them to PyPI alongside the Linux and macOS + wheels. ## 2026.9.30 diff --git a/include/aare/Cluster.hpp b/include/aare/Cluster.hpp index b08a2878..df67884c 100755 --- a/include/aare/Cluster.hpp +++ b/include/aare/Cluster.hpp @@ -83,7 +83,7 @@ struct Cluster { data[cluster_center_index - ClusterSizeX] + data[cluster_center_index - 1 - ClusterSizeX]; // subcluster top right from center - if (ClusterSizeX > 2) { + if constexpr (ClusterSizeX > 2) { sum_2x2_subcluster[1] = data[cluster_center_index] + data[cluster_center_index + 1] + @@ -91,7 +91,7 @@ struct Cluster { data[cluster_center_index - ClusterSizeX + 1]; } // subcluster bottom left from center - if (ClusterSizeY > 2) { + if constexpr (ClusterSizeY > 2) { sum_2x2_subcluster[2] = data[cluster_center_index] + data[cluster_center_index - 1] + @@ -99,7 +99,7 @@ struct Cluster { data[cluster_center_index + ClusterSizeX - 1]; } // subcluster bottom right from center - if (ClusterSizeX > 2 && ClusterSizeY > 2) { + if constexpr (ClusterSizeX > 2 && ClusterSizeY > 2) { sum_2x2_subcluster[3] = data[cluster_center_index] + data[cluster_center_index + 1] + diff --git a/include/aare/logger.hpp b/include/aare/logger.hpp index 6374aeea..b5504d73 100644 --- a/include/aare/logger.hpp +++ b/include/aare/logger.hpp @@ -160,7 +160,7 @@ class Logger { // TODO! Do we need to keep the runtime option? #define LOG(level) \ - if (level > AARE_LOG_LEVEL) \ + if constexpr (level > AARE_LOG_LEVEL) \ ; \ else if (level > aare::Logger::ReportingLevel()) \ ; \ diff --git a/pyproject.toml b/pyproject.toml index 6054356c..16636a01 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,9 @@ build = "cp{312,313,314}-manylinux_x86_64" build = "cp{312,313,314}-macosx_*" archs = ["arm64"] +[tool.cibuildwheel.windows] +build = "cp{312,313,314}-win_amd64" + [tool.scikit-build] build.verbose = true diff --git a/src/Dtype.cpp b/src/Dtype.cpp index 08098874..9ad6d673 100644 --- a/src/Dtype.cpp +++ b/src/Dtype.cpp @@ -159,7 +159,7 @@ Dtype Dtype::from_bitdepth(uint8_t bitdepth) { std::string Dtype::to_string() const { char ec{}; - if (endian::native == endian::little) + if constexpr (endian::native == endian::little) ec = '<'; else ec = '>';