Merge pull request #164 from pyswmm/dev #84
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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@v5 | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Build wheel | |
| run: | | |
| pip install wheel | |
| python setup.py bdist_wheel | |
| - name: Upload wheel artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nrtest-swmm-wheel | |
| path: nrtest-swmm/dist/*.whl | |
| build_sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./swmm-toolkit | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Build sdist | |
| run: | | |
| pip install build | |
| python -m build --sdist --outdir ./dist | |
| - name: Upload sdist artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: swmm-toolkit-sdist | |
| path: swmm-toolkit/dist/*.tar.gz | |
| build_wheels: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| [ | |
| ubuntu-24.04, | |
| ubuntu-24.04-arm, | |
| windows-2025, | |
| macos-15-intel, | |
| macos-15, | |
| ] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v3.1.4 | |
| with: | |
| package-dir: ./swmm-toolkit | |
| env: | |
| MACOSX_DEPLOYMENT_TARGET: "11.0" | |
| CIBW_TEST_COMMAND: "pytest {package}/tests" | |
| CIBW_BEFORE_TEST: pip install -r {package}/test-requirements.txt | |
| CIBW_ENVIRONMENT_MACOS: | | |
| MACOSX_DEPLOYMENT_TARGET=11.0 | |
| # remove system swig (cmake bug doesn't respect python venv) | |
| # https://github.com/swig/swig/issues/2481#issuecomment-1949573105 | |
| CIBW_BEFORE_BUILD_LINUX: rm -f $(which swig) && rm -f $(which swig4.0) | |
| # skip 3.8 and any free threaded variants | |
| CIBW_SKIP: cp38-* cp3??t-* | |
| CIBW_ARCHS: native | |
| CIBW_BUILD_VERBOSITY: 1 | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: swmm-toolkit-bdist-${{ matrix.os }} | |
| path: ./wheelhouse/*.whl | |
| merge_wheels: | |
| name: Consolidate all wheel artifacts | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build_wheels | |
| - build_sdist | |
| steps: | |
| - name: Download all distribution artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| path: dist | |
| pattern: swmm-toolkit-*dist* | |
| merge-multiple: true | |
| - name: Upload consolidated archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: swmm_toolkit_dist | |
| path: ./dist/* | |
| publish_toolkit: | |
| name: Publish Python 🐍 distribution 📦 to PyPI | |
| needs: | |
| - merge_wheels | |
| # only publish to PyPI on tag pushes | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/swmm-toolkit | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download all the dists | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: swmm_toolkit_dist | |
| path: dist/ | |
| - name: Publish distribution 📦 to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |