Skip to content

Commit d6d73d4

Browse files
committed
CI/CD Overhaul
- implement stable abi (>=3.9) - migrate to scikit-build-core - update cibuildwheel to use native builds for all archs - move shared libs into package dir
1 parent e741e6d commit d6d73d4

7 files changed

Lines changed: 108 additions & 258 deletions

File tree

.github/workflows/build_wheel.yml

Lines changed: 12 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Install Python
2828
uses: actions/setup-python@v5
2929
with:
30-
python-version: '3.10'
30+
python-version: "3.10"
3131

3232
- name: Build wheel
3333
run: |
@@ -46,12 +46,11 @@ jobs:
4646
strategy:
4747
fail-fast: false
4848
matrix:
49-
os: [ubuntu-latest, windows-latest, macos-latest]
50-
pyver: [cp39, cp310, cp311, cp312, cp313]
49+
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-latest]
5150

5251
steps:
5352
- name: Checkout repo
54-
uses: actions/checkout@v3
53+
uses: actions/checkout@v5
5554
with:
5655
submodules: true
5756

@@ -63,65 +62,25 @@ jobs:
6362
MACOSX_DEPLOYMENT_TARGET: "11.0"
6463
CIBW_TEST_COMMAND: "pytest {package}/tests"
6564
CIBW_BEFORE_TEST: pip install -r {package}/test-requirements.txt
66-
# mac needs ninja to build
67-
CIBW_BEFORE_BUILD_MACOS: brew install ninja
65+
66+
CIBW_ENVIRONMENT_MACOS: |
67+
MACOSX_DEPLOYMENT_TARGET=11.0
68+
6869
# remove system swig (cmake bug doesn't respect python venv)
6970
# https://github.com/swig/swig/issues/2481#issuecomment-1949573105
7071
CIBW_BEFORE_BUILD_LINUX: rm -f $(which swig) && rm -f $(which swig4.0)
71-
# configure cibuildwheel to build native archs ('auto'), and some emulated ones
72-
CIBW_ARCHS_LINUX: x86_64
73-
CIBW_ARCHS_WINDOWS: AMD64
74-
CIBW_ARCHS_MACOS: x86_64 arm64
75-
# only build current supported python: https://devguide.python.org/versions/
76-
# don't build pypy or musllinux to save build time. TODO: find a good way to support those archs
77-
CIBW_BUILD: ${{matrix.pyver}}-*
78-
CIBW_SKIP: cp38-* pp* *-musllinux*
72+
# skip 3.8 and any free threaded variants
73+
CIBW_SKIP: cp38-* cp3??t-*
74+
CIBW_ARCHS: native
7975
# Will avoid testing on emulated architectures
8076
# Skip trying to test arm64 builds on Intel Macs
8177
CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} *-macosx_universal2:arm64"
8278
CIBW_BUILD_VERBOSITY: 1
8379

8480
- uses: actions/upload-artifact@v4
8581
with:
86-
name: wheels-${{ matrix.os }}-${{ matrix.pyver }}
82+
name: wheelhouse_${{ matrix.os }}
8783
path: ./wheelhouse/*.whl
8884

89-
build_cross_wheels:
90-
runs-on: ubuntu-latest
91-
strategy:
92-
fail-fast: false
93-
matrix:
94-
pyver: [cp39, cp310, cp311, cp312, cp313]
95-
96-
steps:
97-
- name: Checkout repo
98-
uses: actions/checkout@v5
99-
with:
100-
submodules: true
101-
102-
- name: Set up QEMU
103-
if: runner.os == 'Linux'
104-
uses: docker/setup-qemu-action@v2
105-
with:
106-
platforms: all
10785

108-
- name: Build wheels
109-
uses: pypa/cibuildwheel@v3.1.4
110-
with:
111-
package-dir: ./swmm-toolkit
112-
env:
113-
# remove system swig (cmake bug doesn't respect python venv)
114-
# https://github.com/swig/swig/issues/2481#issuecomment-1949573105
115-
CIBW_BEFORE_BUILD_LINUX: rm -f $(which swig) && rm -f $(which swig4.0)
116-
# configure cibuildwheel to build native archs ('auto'), and some emulated ones
117-
CIBW_ARCHS_LINUX: aarch64
118-
# only build current supported python: https://devguide.python.org/versions/
119-
# don't build pypy or musllinux to save build time. TODO: find a good way to support those archs
120-
CIBW_BUILD: ${{matrix.pyver}}-*
121-
CIBW_SKIP: cp-*38 pp* *-musllinux*
122-
CIBW_BUILD_VERBOSITY: 1
123-
124-
- uses: actions/upload-artifact@v4
125-
with:
126-
name: wheels-linux-aarch64-${{ matrix.pyver }}
127-
path: ./wheelhouse/*.whl
86+

.github/workflows/unit_test.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ jobs:
4141
- name: Install Python
4242
uses: actions/setup-python@v5
4343
with:
44-
python-version: "3.10"
44+
python-version: "3.12"
4545

46-
- name: Build wheel in virtual env
47-
env:
48-
MACOSX_DEPLOYMENT_TARGET: "11.0"
46+
- name: Build wheel
4947
run: |
50-
python -m venv --clear ./build-env
51-
${{matrix.activate}}
52-
python -m pip install -r build-requirements.txt
53-
python setup.py bdist_wheel
54-
deactivate
48+
pip install build
49+
python -m build
50+
- name: Upload Wheel
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: swmm_toolkit_${{ matrix.os }}
54+
path: ./swmm-toolkit/dist/*.whl
5555

5656
- name: Test wheel
5757
run: |

swmm-toolkit/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ project(swmm-toolkit
2323
set(Python_FIND_VIRTUALENV FIRST)
2424
#set(CMAKE_FIND_DEBUG_MODE TRUE)
2525
if(NOT MSVC)
26-
find_package (Python3 ${PYTHON_VERSION_STRING} COMPONENTS Interpreter Development.Module REQUIRED)
26+
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
2727
else()
28-
find_package (Python3 ${PYTHON_VERSION_STRING} COMPONENTS Interpreter Development REQUIRED)
28+
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
2929
endif()
3030
#set(CMAKE_FIND_DEBUG_MODE FALSE)
3131

swmm-toolkit/pyproject.toml

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,53 @@
11
[build-system]
22
requires = [
3-
"wheel>=0.38.1",
4-
"setuptools>=42",
5-
"scikit-build>=0.13",
6-
"cmake>=3.21",
73
"swig",
8-
"ninja==1.11.1 ; sys_platform == 'darwin'",
4+
"scikit-build-core>=0.4.3",
95
]
10-
build-backend = "setuptools.build_meta"
6+
build-backend = "scikit_build_core.build"
7+
8+
[project]
9+
name = "swmm-toolkit"
10+
version = "0.15.5"
11+
description = "PySWMM SWMM Python Toolkit"
12+
readme = { file = "README.md", content-type = "text/markdown" }
13+
license = { text = "CC0" }
14+
authors = [{ name = "See AUTHORS" }]
15+
maintainers = [{ email = "bemcdonnell@gmail.com" }]
16+
keywords = ["swmm5", "swmm", "stormwater", "hydraulics", "hydrology"]
17+
classifiers = [
18+
"Topic :: Scientific/Engineering",
19+
"Operating System :: Microsoft :: Windows",
20+
"Operating System :: POSIX :: Linux",
21+
"Operating System :: MacOS",
22+
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
23+
"Programming Language :: Python :: 3.9",
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: 3.13",
28+
"Programming Language :: C",
29+
"Development Status :: 5 - Production/Stable",
30+
]
31+
requires-python = ">=3.9"
32+
dependencies = ["aenum==3.1.11"]
33+
urls = { Homepage = "https://github.com/pyswmm/swmm-python" }
34+
35+
[[tool.scikit-build.overrides]]
36+
if.platform-system = "win32"
37+
cmake.args = ["-GVisual Studio 17 2022", "-Ax64"]
38+
39+
[[tool.scikit-build.overrides]]
40+
if.platform-system = "darwin"
41+
cmake.args = ["-GXcode", "-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=11.0"]
42+
43+
[[tool.scikit-build.overrides]]
44+
if.platform-system = "linux"
45+
cmake.args = ["-GUnix Makefiles"]
46+
47+
[tool.scikit-build.wheel]
48+
packages = ["src/swmm/toolkit"]
49+
py-api = "cp39"
50+
exclude = ["**/*runswmm*", "**/*.exe", "**/*.cmake", "**/*.h", "**/*.lib", "**/*.i", "**/CMakeLists.txt","toolkit/*", "lib/*", "bin/*", "build-env/*"]
51+
52+
[tool.scikit-build.sdist]
53+
exclude = ["build-env/*"]

swmm-toolkit/setup.py

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)