Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions .github/workflows/python-build.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/python-stylecheck.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
29 changes: 17 additions & 12 deletions .github/workflows/python-unittests.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -17,30 +12,40 @@ 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:
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

- name: Build
run: |
pip install -v .[dev]
pip install .

- name: Test with unittest
run: python -m unittest discover -v -s tests
11 changes: 8 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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":
Expand All @@ -57,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)}",
Expand Down
11 changes: 8 additions & 3 deletions tools/cmake_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import subprocess
import os
import shutil
import sysconfig

import pybind11
import amulet.pybind11_extensions
Expand All @@ -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)
Expand All @@ -33,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'))}",
Expand Down