Skip to content
Draft
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
6 changes: 3 additions & 3 deletions .github/workflows/build_deploy_pages.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: docs
name: Build and Deploy Documentation

on:
push:
Expand Down Expand Up @@ -39,8 +39,8 @@ jobs:
if: github.event_name == 'push'
permissions:
contents: read
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
126 changes: 126 additions & 0 deletions .github/workflows/build_test_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Build wheels, sdist, and full wheel test matrix.
# Runs on: push to main (including merges), publish_pypi.yml (tags), workflow_call, and monthly schedule.
name: Build and Test Wheels

on:
workflow_call: # For use by publish_pypi.yml
push:
branches: [main]
schedule:
- cron: '0 0 1 * *'

jobs:
build_wheels:
name: Build wheels
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-15-intel, macos-latest]
fail-fast: false
steps:
- name: Set env variables to handle macOS-15
if: ${{ matrix.os == 'macos-15-intel'}}
run: |
echo "MACOSX_DEPLOYMENT_TARGET=15.0" >> $GITHUB_ENV
echo "PLAT=macosx-15.0-universal2" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
- name: Install libomp on macos
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'macos-15-intel'}}
run: |
brew reinstall libomp
- name: Ad-hoc codesign for Apple Silicon
if: ${{ matrix.os == 'macos-latest' }}
run: |
dylib_path="wntr/epanet/libepanet/darwin-arm"
if [ -d "$dylib_path" ]; then
for file in "$dylib_path"/*; do
[ -e "$file" ] && codesign -f -s - "$file"
done
fi
- name: Build wheels
uses: pypa/cibuildwheel@v3.1.4
env:
CIBW_ENVIRONMENT: BUILD_WNTR_EXTENSIONS='true'
CIBW_BUILD: cp310-* cp311-* cp312-* cp313-*
CIBW_SKIP: "*-win32 *-manylinux_i686 pp* *-musllinux*"
CIBW_REPAIR_WHEEL_COMMAND: '' # Skip repair step
- name: Set up Python for twine verification
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Verify wheels with twine
shell: bash
run: |
python -m pip install --upgrade pip twine
for wheel in ./wheelhouse/*.whl; do
twine check "$wheel"
done
- name: Fix linux wheel names # Temporary hack: rename linux -> manylinux2014 so PyPI accepts them without a proper repair step.
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
for file in ./wheelhouse/*.whl; do
[ -e "$file" ] || continue
new_file="${file/linux/manylinux2014}"
mv "$file" "$new_file"
done
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz

test_wheels:
name: Test wheels (${{ matrix.python-version }}, ${{ matrix.os }})
needs: build_wheels
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
os: [ubuntu-latest, windows-latest, macos-15-intel, macos-latest]
fail-fast: false
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download wheels for this OS
uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-${{ matrix.os }}-*
merge-multiple: true
- name: Checkout test assets
uses: actions/checkout@v4
with:
sparse-checkout: |
wntr/tests/
sparse-checkout-cone-mode: false
fetch-depth: 1
- name: Set mpl backend on windows
if: ${{ matrix.os == 'windows-latest' }}
run: echo "MPLBACKEND=Agg" >> $env:GITHUB_ENV
shell: pwsh
- if: ${{ matrix.os == 'macos-latest' || matrix.os == 'macos-15-intel'}}
run: brew reinstall libomp
- name: Install wntr from wheel
run: |
python -m pip install --upgrade pip
pip install --pre --find-links=. "wntr[optional,test]"
python -c "import wntr; print(wntr.__version__)"
- name: Run tests against wheel
run: pytest wntr/tests/ --ignore=wntr/tests/test_demos.py --ignore=wntr/tests/test_examples.py
Loading
Loading