Skip to content

OWA SWMM 5.2.4 Updates #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Sep 5, 2023
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
120 changes: 120 additions & 0 deletions .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: Build Wheels

# Cross compile wheels only on main branch and tags
on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- v*
workflow_dispatch:

jobs:
build_nrtest_plugin:
name: Build nrtest-swmm plugin
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./nrtest-swmm

steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Build wheel
run: |
pip install wheel
python setup.py bdist_wheel
- uses: actions/upload-artifact@v3
with:
path: nrtest-swmm/dist/*.whl



build_wheels:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-2022, macos-12]
pyver: [cp38, cp39, cp310, cp311]

steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true

- name: Build wheels
uses: pypa/cibuildwheel@v2.15.0
with:
package-dir: ./swmm-toolkit
env:
CIBW_TEST_COMMAND: "pytest {package}/tests"
CIBW_BEFORE_TEST: pip install -r {package}/test-requirements.txt
# mac needs ninja to build
CIBW_BEFORE_BUILD_MACOS: brew install ninja
# configure cibuildwheel to build native archs ('auto'), and some emulated ones
CIBW_ARCHS_LINUX: x86_64
CIBW_ARCHS_WINDOWS: AMD64
CIBW_ARCHS_MACOS: x86_64
# only build current supported python: https://devguide.python.org/versions/
# don't build pypy or musllinux to save build time. TODO: find a good way to support those archs
CIBW_BUILD: ${{matrix.pyver}}-*
CIBW_SKIP: cp36-* cp37-* cp312-* pp* *-musllinux*
# Will avoid testing on emulated architectures
# Skip trying to test arm64 builds on Intel Macs
CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} *-macosx_arm64 *-macosx_universal2:arm64"

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

build_cross_wheels:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest,macos-12]
pyver: [cp38, cp39, cp310, cp311]

steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Build wheels
uses: pypa/cibuildwheel@v2.15.0
with:
package-dir: ./swmm-toolkit
env:
# mac needs ninja to build
CIBW_BEFORE_BUILD_MACOS: brew install ninja
# configure cibuildwheel to build native archs ('auto'), and some emulated ones
CIBW_ARCHS_LINUX: aarch64
CIBW_ARCHS_MACOS: arm64
# only build current supported python: https://devguide.python.org/versions/
# don't build pypy or musllinux to save build time. TODO: find a good way to support those archs
CIBW_BUILD: ${{matrix.pyver}}-*
CIBW_SKIP: cp36-* cp37-* cp312-* pp* *-musllinux*

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
50 changes: 0 additions & 50 deletions .github/workflows/conda-test.yml

This file was deleted.

116 changes: 0 additions & 116 deletions .github/workflows/python-package.yml

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Unit Test

on:
push:
branches-ignore:
- 'master'
tags-ignore:
- v*
pull_request:
branches-ignore:
- 'master'

jobs:
build_and_test:
name: Build and test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./swmm-toolkit

strategy:
fail-fast: false
matrix:
os: [windows-2022, macos-12, ubuntu-latest]
include:
- os: windows-2022
sys_pkgs: choco install swig
activate: ./build-env/Scripts/activate

- os: macos-12
sys_pkgs: brew install swig ninja
activate: source ./build-env/bin/activate

- os: ubuntu-latest
activate: source ./build-env/bin/activate

steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install required system packages
run: ${{matrix.sys_pkgs}}

- name: Build wheel in virtual env
run: |
python -m venv --clear ./build-env
${{matrix.activate}}
python -m pip install -r build-requirements.txt
python setup.py bdist_wheel
deactivate

- name: Test wheel
run: |
pip install -r test-requirements.txt
pip install --no-index --find-links=./dist swmm_toolkit
pytest
17 changes: 5 additions & 12 deletions swmm-toolkit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17)

project(swmm-toolkit
VERSION
0.14.0
0.15.0
)


Expand All @@ -36,17 +36,10 @@ cmake_policy(SET CMP0078 NEW)
cmake_policy(SET CMP0086 NEW)
include(${SWIG_USE_FILE})


# If wheel build on Apple fetch and build OpenMP Library
if (APPLE)
include(./extern/openmp.cmake)
else()
find_package(OpenMP
OPTIONAL_COMPONENTS
C
)
endif()

find_package(OpenMP
OPTIONAL_COMPONENTS
C
)

# Add project subdirectories
add_subdirectory(swmm-solver)
Expand Down
Loading