From 3b34df62731b67738ae72efb7b9a6d5f751578c5 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 9 Apr 2026 14:39:00 +0100 Subject: [PATCH 1/3] Update workflows and add Win Arm64 --- .github/workflows/python-build.yml | 24 +++++++++++--------- .github/workflows/python-stylecheck.yml | 14 ++++-------- .github/workflows/python-unittests.yml | 29 +++++++++++++++---------- 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/.github/workflows/python-build.yml b/.github/workflows/python-build.yml index eb5bd7a..c9b298f 100644 --- a/.github/workflows/python-build.yml +++ b/.github/workflows/python-build.yml @@ -1,6 +1,3 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - name: Build on: @@ -12,22 +9,29 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ '3.11', '3.12' ] - os: [ macos-15, macos-15-intel, windows-2025 ] - - runs-on: ${{ matrix.os }} + cfg: + - { os: windows-2025, python-version: '3.11', architecture: x64 } + - { os: windows-2025, python-version: '3.12', architecture: x64 } + - { os: windows-11-arm, python-version: '3.11', architecture: arm64 } + - { os: windows-11-arm, python-version: '3.12', architecture: arm64 } + - { os: macos-15, python-version: '3.11', architecture: arm64 } + - { os: macos-15, python-version: '3.12', architecture: arm64 } + + runs-on: ${{ matrix.cfg.os }} + timeout-minutes: 45 defaults: run: shell: bash steps: - name: Clone - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ matrix.cfg.python-version }} + architecture: ${{ matrix.cfg.architecture }} - name: Setup cmake uses: jwlawson/actions-setup-cmake@v2 diff --git a/.github/workflows/python-stylecheck.yml b/.github/workflows/python-stylecheck.yml index b2a92a1..a326557 100644 --- a/.github/workflows/python-stylecheck.yml +++ b/.github/workflows/python-stylecheck.yml @@ -1,33 +1,27 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - name: Stylecheck on: push: branches: - - master - - main - '[0-9]+.[0-9]+' - '[0-9]+.[0-9]+.[0-9]+' pull_request: jobs: stylecheck: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - name: Clone - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: - python-version: 3.12 + python-version: '3.12' - name: Install dependencies run: | - python -m pip install --upgrade pip pip install black - name: run stylecheck diff --git a/.github/workflows/python-unittests.yml b/.github/workflows/python-unittests.yml index bc265ea..8c46d62 100644 --- a/.github/workflows/python-unittests.yml +++ b/.github/workflows/python-unittests.yml @@ -1,13 +1,8 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - name: Unittests on: push: branches: - - master - - main - '[0-9]+.[0-9]+' - '[0-9]+.[0-9]+.[0-9]+' pull_request: @@ -17,10 +12,19 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ '3.11', '3.12' ] - os: [ macos-15, macos-15-intel, windows-2025, ubuntu-24.04 ] + cfg: + - { os: windows-2025, python-version: '3.11', architecture: x64 } + - { os: windows-2025, python-version: '3.12', architecture: x64 } + - { os: windows-11-arm, python-version: '3.11', architecture: arm64 } + - { os: windows-11-arm, python-version: '3.12', architecture: arm64 } + - { os: macos-15-intel, python-version: '3.11', architecture: x64 } + - { os: macos-15-intel, python-version: '3.12', architecture: x64 } + - { os: macos-15, python-version: '3.11', architecture: arm64 } + - { os: macos-15, python-version: '3.12', architecture: arm64 } + - { os: ubuntu-24.04, python-version: '3.11', architecture: x64 } + - { os: ubuntu-24.04, python-version: '3.12', architecture: x64 } - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.cfg.os }} timeout-minutes: 45 defaults: run: @@ -28,19 +32,20 @@ jobs: steps: - name: Clone - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ matrix.cfg.python-version }} + architecture: ${{ matrix.cfg.architecture }} - name: Setup cmake uses: jwlawson/actions-setup-cmake@v2 - name: Build run: | - pip install -v .[dev] + pip install . - name: Test with unittest run: python -m unittest discover -v -s tests From 005620730817e2176b9e5ea6e1777525c0c81f81 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 9 Apr 2026 14:46:43 +0100 Subject: [PATCH 2/3] Fix platform args --- setup.py | 9 +++++++-- tools/cmake_generate.py | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 9d3ddee..379c714 100644 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ import platform from tempfile import TemporaryDirectory from typing import TypeAlias, TYPE_CHECKING, Mapping +import sysconfig from setuptools import setup, Extension, Command from setuptools.command.build_ext import build_ext @@ -39,10 +40,14 @@ def build_extension(self, ext: Extension) -> None: platform_args = [] if sys.platform == "win32": platform_args.extend(["-G", "Visual Studio 17 2022"]) - if sys.maxsize > 2**32: + if sysconfig.get_platform() == "win-amd64": platform_args.extend(["-A", "x64"]) - else: + elif sysconfig.get_platform() == "win32": platform_args.extend(["-A", "Win32"]) + elif sysconfig.get_platform() == "win-arm64": + platform_args.extend(["-A", "ARM64"]) + else: + raise RuntimeError(f"Unsupported platform: {sysconfig.get_platform()}") platform_args.extend(["-T", "v143"]) elif sys.platform == "darwin": if platform.machine() == "arm64": diff --git a/tools/cmake_generate.py b/tools/cmake_generate.py index e001ceb..cde6a85 100644 --- a/tools/cmake_generate.py +++ b/tools/cmake_generate.py @@ -2,6 +2,7 @@ import subprocess import os import shutil +import sysconfig import pybind11 import amulet.pybind11_extensions @@ -18,10 +19,14 @@ def main() -> None: platform_args = [] if sys.platform == "win32": platform_args.extend(["-G", "Visual Studio 17 2022"]) - if sys.maxsize > 2**32: + if sysconfig.get_platform() == "win-amd64": platform_args.extend(["-A", "x64"]) - else: + elif sysconfig.get_platform() == "win32": platform_args.extend(["-A", "Win32"]) + elif sysconfig.get_platform() == "win-arm64": + platform_args.extend(["-A", "ARM64"]) + else: + raise RuntimeError(f"Unsupported platform: {sysconfig.get_platform()}") platform_args.extend(["-T", "v143"]) os.chdir(RootDir) From 945ff8e87178d36a8739f957e56be60fe1ed2bcf Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 10 Apr 2026 09:25:10 +0100 Subject: [PATCH 3/3] Fix python finding --- setup.py | 2 +- tools/cmake_generate.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 379c714..5b3844b 100644 --- a/setup.py +++ b/setup.py @@ -62,7 +62,7 @@ def build_extension(self, ext: Extension) -> None: [ "cmake", *platform_args, - f"-DPython3_ROOT_DIR={sys.base_prefix}", + f"-DPython3_EXECUTABLE={fix_path(sys.executable)}", f"-Dpybind11_DIR={fix_path(pybind11.get_cmake_dir())}", f"-Damulet_pybind11_extensions_DIR={fix_path(amulet.pybind11_extensions.__path__[0])}", f"-Damulet_rocksdb_DIR={fix_path(rocksdb_src_dir)}", diff --git a/tools/cmake_generate.py b/tools/cmake_generate.py index cde6a85..33c39bd 100644 --- a/tools/cmake_generate.py +++ b/tools/cmake_generate.py @@ -38,7 +38,7 @@ def main() -> None: [ "cmake", *platform_args, - f"-DPython3_ROOT_DIR={sys.base_prefix}", + f"-DPython3_EXECUTABLE={fix_path(sys.executable)}", f"-Dpybind11_DIR={fix_path(pybind11.get_cmake_dir())}", f"-Damulet_pybind11_extensions_DIR={fix_path(amulet.pybind11_extensions.__path__[0])}", f"-Damulet_rocksdb_DIR={fix_path(os.path.join(RootDir, 'src', 'amulet', 'rocksdb'))}",