Build wheels #9
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 | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build_wheels: | |
| name: Build wheels (simple matrix) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-latest, ubuntu-latest, macos-latest] | |
| python_tag: [cp39, cp310, cp311, cp312, cp313, cp314] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Install cibuildwheel | |
| run: python -m pip install cibuildwheel==2.22.0 | |
| - name: Build wheels | |
| run: python -m cibuildwheel --output-dir wheelhouse owa-epanet | |
| env: | |
| # Build the specific Python tag (e.g. cp39, cp310) for the current matrix entry | |
| CIBW_BUILD: ${{ matrix.python_tag }}-* | |
| # Use manylinux_2_28 (dnf-based) for Linux builds | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 | |
| CIBW_BEFORE_ALL_LINUX: git submodule update --init && dnf install swig -y | |
| CIBW_BEFORE_ALL_WINDOWS: git submodule update && choco install swig | |
| CIBW_BEFORE_ALL_MACOS: git submodule update && brew install swig ninja libomp | |
| CIBW_BEFORE_BUILD: pip install scikit-build cmake | |
| CIBW_BUILD_VERBOSITY: 1 | |
| CIBW_TEST_COMMAND: pytest {package} | |
| CIBW_BEFORE_TEST: pip install scikit-build cmake | |
| CIBW_TEST_REQUIRES: pytest | |
| # skip 32-bit manylinux and win32 test variants | |
| CIBW_TEST_SKIP: "*-win32 *-manylinux_i686" | |
| - name: Store artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }}-${{ matrix.python_tag }} | |
| path: ./wheelhouse/*.whl | |
| build_sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Fix submodules | |
| run: | | |
| cd owa-epanet | |
| git submodule update | |
| - uses: actions/setup-python@v5 | |
| name: Install Python | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install swig -y | |
| pip install build scikit-build cmake | |
| - name: Build sdist | |
| run: | | |
| cd owa-epanet | |
| python -m build --sdist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: sdist | |
| path: owa-epanet/dist/*.tar.gz | |
| upload_pypi: | |
| needs: [ build_wheels, build_sdist ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: wheels-* | |
| merge-multiple: true | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: sdist | |
| merge-multiple: true | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| skip_existing: true |