Skip to content

Commit 3fb9b17

Browse files
authored
Merge pull request #119 from pyswmm/dev
2 parents 7d00e9d + a352ade commit 3fb9b17

File tree

16 files changed

+282
-241
lines changed

16 files changed

+282
-241
lines changed

.github/workflows/build_wheel.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Build Wheels
2+
3+
# Cross compile wheels only on main branch and tags
4+
on:
5+
pull_request:
6+
branches:
7+
- master
8+
push:
9+
branches:
10+
- master
11+
tags:
12+
- v*
13+
workflow_dispatch:
14+
15+
jobs:
16+
build_nrtest_plugin:
17+
name: Build nrtest-swmm plugin
18+
runs-on: ubuntu-latest
19+
defaults:
20+
run:
21+
working-directory: ./nrtest-swmm
22+
23+
steps:
24+
- name: Checkout repo
25+
uses: actions/checkout@v3
26+
with:
27+
submodules: true
28+
29+
- name: Install Python
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: 3.7
33+
34+
- name: Build wheel
35+
run: |
36+
pip install wheel
37+
python setup.py bdist_wheel
38+
- uses: actions/upload-artifact@v3
39+
with:
40+
path: nrtest-swmm/dist/*.whl
41+
42+
43+
44+
build_wheels:
45+
runs-on: ${{ matrix.os }}
46+
strategy:
47+
fail-fast: true
48+
matrix:
49+
os: [ubuntu-latest, windows-2022, macos-12]
50+
pyver: [cp38, cp39, cp310, cp311]
51+
52+
steps:
53+
- name: Checkout repo
54+
uses: actions/checkout@v3
55+
with:
56+
submodules: true
57+
58+
- name: Build wheels
59+
uses: pypa/cibuildwheel@v2.15.0
60+
with:
61+
package-dir: ./swmm-toolkit
62+
env:
63+
CIBW_TEST_COMMAND: "pytest {package}/tests"
64+
CIBW_BEFORE_TEST: pip install -r {package}/test-requirements.txt
65+
# mac needs ninja to build
66+
CIBW_BEFORE_BUILD_MACOS: brew install ninja
67+
# configure cibuildwheel to build native archs ('auto'), and some emulated ones
68+
CIBW_ARCHS_LINUX: x86_64
69+
CIBW_ARCHS_WINDOWS: AMD64
70+
CIBW_ARCHS_MACOS: x86_64
71+
# only build current supported python: https://devguide.python.org/versions/
72+
# don't build pypy or musllinux to save build time. TODO: find a good way to support those archs
73+
CIBW_BUILD: ${{matrix.pyver}}-*
74+
CIBW_SKIP: cp36-* cp37-* cp312-* pp* *-musllinux*
75+
# Will avoid testing on emulated architectures
76+
# Skip trying to test arm64 builds on Intel Macs
77+
CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} *-macosx_arm64 *-macosx_universal2:arm64"
78+
79+
- uses: actions/upload-artifact@v3
80+
with:
81+
path: ./wheelhouse/*.whl
82+
83+
build_cross_wheels:
84+
runs-on: ${{ matrix.os }}
85+
strategy:
86+
fail-fast: true
87+
matrix:
88+
os: [ubuntu-latest,macos-12]
89+
pyver: [cp38, cp39, cp310, cp311]
90+
91+
steps:
92+
- name: Checkout repo
93+
uses: actions/checkout@v3
94+
with:
95+
submodules: true
96+
97+
- name: Set up QEMU
98+
if: runner.os == 'Linux'
99+
uses: docker/setup-qemu-action@v2
100+
with:
101+
platforms: all
102+
103+
- name: Build wheels
104+
uses: pypa/cibuildwheel@v2.15.0
105+
with:
106+
package-dir: ./swmm-toolkit
107+
env:
108+
# mac needs ninja to build
109+
CIBW_BEFORE_BUILD_MACOS: brew install ninja
110+
# configure cibuildwheel to build native archs ('auto'), and some emulated ones
111+
CIBW_ARCHS_LINUX: aarch64
112+
CIBW_ARCHS_MACOS: arm64
113+
# only build current supported python: https://devguide.python.org/versions/
114+
# don't build pypy or musllinux to save build time. TODO: find a good way to support those archs
115+
CIBW_BUILD: ${{matrix.pyver}}-*
116+
CIBW_SKIP: cp36-* cp37-* cp312-* pp* *-musllinux*
117+
118+
- uses: actions/upload-artifact@v3
119+
with:
120+
path: ./wheelhouse/*.whl

.github/workflows/conda-test.yml

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

.github/workflows/python-package.yml

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

.github/workflows/unit_test.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Unit Test
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'master'
7+
tags-ignore:
8+
- v*
9+
pull_request:
10+
branches-ignore:
11+
- 'master'
12+
13+
jobs:
14+
build_and_test:
15+
name: Build and test on ${{ matrix.os }}
16+
runs-on: ${{ matrix.os }}
17+
defaults:
18+
run:
19+
working-directory: ./swmm-toolkit
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os: [windows-2022, macos-12, ubuntu-latest]
25+
include:
26+
- os: windows-2022
27+
sys_pkgs: choco install swig
28+
activate: ./build-env/Scripts/activate
29+
30+
- os: macos-12
31+
sys_pkgs: brew install swig ninja
32+
activate: source ./build-env/bin/activate
33+
34+
- os: ubuntu-latest
35+
activate: source ./build-env/bin/activate
36+
37+
steps:
38+
- name: Checkout repo
39+
uses: actions/checkout@v3
40+
with:
41+
submodules: true
42+
43+
- name: Install Python
44+
uses: actions/setup-python@v4
45+
with:
46+
python-version: "3.11"
47+
48+
- name: Install required system packages
49+
run: ${{matrix.sys_pkgs}}
50+
51+
- name: Build wheel in virtual env
52+
run: |
53+
python -m venv --clear ./build-env
54+
${{matrix.activate}}
55+
python -m pip install -r build-requirements.txt
56+
python setup.py bdist_wheel
57+
deactivate
58+
59+
- name: Test wheel
60+
run: |
61+
pip install -r test-requirements.txt
62+
pip install --no-index --find-links=./dist swmm_toolkit
63+
pytest

swmm-toolkit/CMakeLists.txt

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17)
1515

1616
project(swmm-toolkit
1717
VERSION
18-
0.14.0
18+
0.15.0
1919
)
2020

2121

@@ -36,17 +36,10 @@ cmake_policy(SET CMP0078 NEW)
3636
cmake_policy(SET CMP0086 NEW)
3737
include(${SWIG_USE_FILE})
3838

39-
40-
# If wheel build on Apple fetch and build OpenMP Library
41-
if (APPLE)
42-
include(./extern/openmp.cmake)
43-
else()
44-
find_package(OpenMP
45-
OPTIONAL_COMPONENTS
46-
C
47-
)
48-
endif()
49-
39+
find_package(OpenMP
40+
OPTIONAL_COMPONENTS
41+
C
42+
)
5043

5144
# Add project subdirectories
5245
add_subdirectory(swmm-solver)

0 commit comments

Comments
 (0)