Skip to content

Open SWMM Version 6.0.0 Debut Release #52

Open SWMM Version 6.0.0 Debut Release

Open SWMM Version 6.0.0 Debut Release #52

Workflow file for this run

name: Unit Testing
on:
push:
branches: [master, main, develop]
pull_request:
branches: [master, main, develop]
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
OMP_NUM_THREADS: 1
jobs:
# ──────────────────────────────────────────────────────────────────────
# C / C++ Engine — build, unit test, and package
# ──────────────────────────────────────────────────────────────────────
engine:
name: "C++ Engine (${{ matrix.alias }})"
permissions:
contents: read
actions: write
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
alias: Linux-x64
cmake_preset: Linux
shell_ext: .sh
vcpkg_triplet: x64-linux
cmake_osx_arch: ""
# - os: macos-latest
# alias: macOS-arm64
# cmake_preset: Darwin
# shell_ext: .sh
# vcpkg_triplet: arm64-osx
# cmake_osx_arch: arm64
# - os: macos-15-intel
# alias: macOS-x64
# cmake_preset: Darwin
# shell_ext: .sh
# vcpkg_triplet: x64-osx
# cmake_osx_arch: x86_64
# - os: windows-latest
# alias: Windows-x64
# cmake_preset: Windows
# shell_ext: .bat
# vcpkg_triplet: x64-windows
# cmake_osx_arch: ""
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Checkout vcpkg
uses: actions/checkout@v5
with:
repository: microsoft/vcpkg
ref: 2025.02.14
path: vcpkg
- name: Install OpenMP (macOS)
if: runner.os == 'macOS'
run: brew install libomp
- name: Install Ninja (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y ninja-build
- name: Bootstrap vcpkg (Windows)
if: runner.os == 'Windows'
working-directory: ${{ env.VCPKG_ROOT }}
run: |
.\bootstrap-vcpkg${{ matrix.shell_ext }}
.\vcpkg.exe integrate install
- name: Bootstrap vcpkg (Unix)
if: runner.os != 'Windows'
working-directory: ${{ env.VCPKG_ROOT }}
run: |
./bootstrap-vcpkg${{ matrix.shell_ext }}
chmod +x vcpkg
- name: Export GitHub Actions cache variables
uses: actions/github-script@v8
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Configure
run: >
cmake
--preset=${{ matrix.cmake_preset }}-debug
-B build-${{ matrix.vcpkg_triplet }}
-DOPENSWMM_BUILD_TESTS=OFF
-DOPENSWMM_BUILD_UNIT_TESTS=ON
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.cmake_osx_arch }}
- name: Build
run: cmake --build build-${{ matrix.vcpkg_triplet }} --config Debug
- name: Unit tests
run: ctest --test-dir build-${{ matrix.vcpkg_triplet }} -C Debug -L unit --output-on-failure
- name: Package
run: cmake --build build-${{ matrix.vcpkg_triplet }} --target package
- name: Upload build artifacts
if: always()
uses: actions/upload-artifact@v5
with:
name: engine-${{ matrix.vcpkg_triplet }}
path: |
build-${{ matrix.vcpkg_triplet }}/*.tar.gz
build-${{ matrix.vcpkg_triplet }}/*.zip
# ──────────────────────────────────────────────────────────────────────
# Python bindings — build, test, and wheel packaging
# ──────────────────────────────────────────────────────────────────────
python:
name: "Python (${{ matrix.alias }})"
needs: engine
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
alias: Linux-x64
vcpkg_triplet: x64-linux
cmake_osx_arch: ""
# - os: macos-latest
# alias: macOS-arm64
# vcpkg_triplet: arm64-osx
# cmake_osx_arch: arm64
# - os: macos-15-intel
# alias: macOS-x64
# vcpkg_triplet: x64-osx
# cmake_osx_arch: x86_64
# - os: windows-latest
# alias: Windows-x64
# vcpkg_triplet: x64-windows
# cmake_osx_arch: ""
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install OpenMP and Ninja (macOS)
if: runner.os == 'macOS'
run: brew install libomp ninja
- name: Install Ninja (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y ninja-build
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install Python requirements
working-directory: python
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Build and install (Windows)
if: runner.os == 'Windows'
working-directory: python
env:
CMAKE_GENERATOR: "Visual Studio 17 2022"
run: python -m pip install .
- name: Build and install (Unix)
if: runner.os != 'Windows'
working-directory: python
env:
CMAKE_OSX_ARCHITECTURES: ${{ matrix.cmake_osx_arch }}
run: python -m pip install .
- name: Run Python tests
env:
CMAKE_OSX_ARCHITECTURES: ${{ matrix.cmake_osx_arch }}
working-directory: python
run: |
# Temporarily hide source tree so installed package is used
mv openswmm openswmm_src
python -m pytest -v tests
mv openswmm_src openswmm
- name: Clean stale build cache
run: python -c "import shutil, os; shutil.rmtree('python/_skbuild', ignore_errors=True)"
- name: Build wheels
uses: pypa/cibuildwheel@v2.23.2
with:
package-dir: ./python
output-dir: ./python/wheelhouse
env:
CMAKE_OSX_ARCHITECTURES: ${{ matrix.cmake_osx_arch }}
CIBW_BUILD_VERBOSITY: 3
CIBW_BEFORE_BUILD_LINUX: pip install ninja
CIBW_BEFORE_BUILD_MACOS: brew install ninja libomp && pip install delocate
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=15.0 CMAKE_OSX_ARCHITECTURES=${{ matrix.cmake_osx_arch }}
CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel
CIBW_ENVIRONMENT_WINDOWS: CMAKE_GENERATOR="Visual Studio 17 2022"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: auditwheel repair -w {dest_dir} {wheel}
CIBW_REPAIR_WHEEL_COMMAND_MACOS: delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: ""
CIBW_TEST_REQUIRES: pytest numpy
CIBW_TEST_COMMAND: pytest {package}/tests -v --import-mode=importlib
- name: Upload Python wheels
if: always()
uses: actions/upload-artifact@v5
with:
name: python-wheels-${{ matrix.vcpkg_triplet }}
path: |
python/wheelhouse/*.whl
python/dist/*.whl