Build wheels #10
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] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - 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: | |
| CIBW_BUILD: ${{ matrix.python_tag }}-* | |
| CIBW_SKIP: "*-manylinux_i686 *-musllinux_* *-win32" | |
| 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 | |
| - 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 |