diff --git a/.github/workflows/python-wheels.yml b/.github/workflows/python-wheels.yml new file mode 100644 index 000000000..748a2d99f --- /dev/null +++ b/.github/workflows/python-wheels.yml @@ -0,0 +1,71 @@ +name: Python Package + +on: + release: + types: [published] + push: + workflow_dispatch: + + +permissions: + contents: read + +jobs: + build_wheels: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Stub `setup.py` check + # It will be generated during CMake run + # https://github.com/pypa/cibuildwheel/issues/1139 + run: touch python/setup.py + + - name: Build wheels + uses: pypa/cibuildwheel@v2.7.0 + env: + CIBW_BUILD: cp3{9,10}-manylinux_x86_64 + CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 + # installing packages in AlmaLinux is a quest + # https://bugs.almalinux.org/view.php?id=208&nbn=3 + CIBW_BEFORE_ALL: > + dnf install -y epel-release && + dnf module enable -y mariadb-devel && + dnf install -y $(grep "^[^#]" dependencies.txt) && + echo "need newer asio-devel version" && + curl -OL https://download.sourceforge.net/asio/asio-1.21.0.tar.bz2 && + tar xf asio-1.21.0.tar.bz2 && + cd asio-1.21.0 && + ./configure && + make && + make install && + cd .. + CIBW_BEFORE_BUILD: > + pip install Cython && + cmake -DOPENDHT_PYTHON=ON . && + make + # The way to point `auditwheel` to "libopendht.so.2" in the current dir + CIBW_REPAIR_WHEEL_COMMAND_LINUX: > + LD_LIBRARY_PATH=$PWD auditwheel repair -w {dest_dir} {wheel} + with: + package-dir: python + + - uses: actions/upload-artifact@v3 + with: + name: opendht-wheels-linux + path: ./wheelhouse/*.whl + + publish: + runs-on: ubuntu-latest + needs: build_wheels + steps: + - uses: actions/download-artifact@v3 + with: + name: opendht-wheels-linux + + - name: Publish package + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/dependencies.txt b/dependencies.txt new file mode 100644 index 000000000..dcf4217fd --- /dev/null +++ b/dependencies.txt @@ -0,0 +1,12 @@ +# System dependencies for building OpenDHT wheels on AlmaLinux 8 +# +# dnf install -y $(grep "^[^#]" dependencies.txt) + +gnutls-devel +msgpack-devel +readline-devel +libargon2-devel + +# asio-devel 1.10.x in AlmaLinux 8 is too old and OpenDHT needs 1.12+ +# +#asio-devel