diff --git a/.github/workflows/build-python.yml b/.github/workflows/build-python.yml new file mode 100644 index 0000000..4524a79 --- /dev/null +++ b/.github/workflows/build-python.yml @@ -0,0 +1,32 @@ +# Builds Python wheels and create a draft release +name: Build Python release + +on: [workflow_dispatch] + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, macos-11, windows-2019] + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Build wheels + uses: pypa/cibuildwheel@v2.8.1 + env: + CIBW_BEFORE_BUILD_LINUX: "python3 -m pip install cmake" + CIBW_BUILD: "cp38-macosx_x86_64 cp38-manylinux_x86_64 cp38-win_amd64 cp39-macosx_x86_64 cp39-manylinux_x86_64 cp39-win_amd64 cp310-macosx_x86_64 cp310-win_amd64 cp310-manylinux_x86_64" + - name: Deploy + uses: softprops/action-gh-release@v1 + with: + tag_name: Draft + name: Draft + draft: true + files: | + ./wheelhouse/*.whl + env: + GITHUB_TOKEN: ${{ secrets.deploy }} diff --git a/.github/workflows/python-release-to-pypi.yml b/.github/workflows/python-release-to-pypi.yml new file mode 100644 index 0000000..b9f950d --- /dev/null +++ b/.github/workflows/python-release-to-pypi.yml @@ -0,0 +1,50 @@ +# Deploy the latest published release to PyPi or Test PyPi + +name: Release to PyPi +on: + workflow_dispatch: + inputs: + pypi-target: + description: Deploy to PyPi [Main] or [Test] + required: true + default: 'Main' + +jobs: + deploy-pypi: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Download wheels + uses: robinraju/release-downloader@v1.2 + with: + repository: "CityOfZion/neo3crypto" + # Latest does not work on pre-release versions, it will error with a 404. + latest: true + tarBall: false + zipBall: false + # download all files + fileName: "*" + out-file-path: "dist" + token: ${{ secrets.GITHUB_TOKEN }} + - if: github.event.inputs.pypi-target == 'Main' + name: Publish to PyPi + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + twine upload dist/* + - if: github.event.inputs.pypi-target == 'Test' + name: Publish to Test-PyPi + env: + TWINE_USERNAME: ${{ secrets.PYPI_TEST_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }} + run: | + twine upload --repository testpypi dist/* diff --git a/README.rst b/README.rst index c1bc947..18e1da5 100644 --- a/README.rst +++ b/README.rst @@ -18,6 +18,10 @@ Installation Or download the wheels from the Github releases page. +Windows users +============= +If installing fails with the error ``No Matching distribution found`` then upgrade your Python installation to use the latest post release version (i.e. ``3.8.8`` instead of ``3.8.0``) + Usage ~~~~~ @@ -43,4 +47,4 @@ using ``help(neo3crypto)``. Building wheels ~~~~~~~~~~~~~~~ -Make sure to have ``wheel`` and ``CMake`` installed. Then call ``python setup.py bdist_wheel``. \ No newline at end of file +Make sure to have ``wheel`` and ``CMake`` installed. Then call ``python setup.py bdist_wheel``. diff --git a/setup.py b/setup.py index 1296d0f..9f8105c 100644 --- a/setup.py +++ b/setup.py @@ -10,8 +10,8 @@ from setuptools.command.install_lib import install_lib as install_lib_orig from distutils.version import LooseVersion -if sys.version_info < (3, 7): - sys.exit('Python < 3.7 is not supported') +if sys.version_info < (3, 8): + sys.exit('Python < 3.8 is not supported') exclude = ['*-obj*', 'tools'] @@ -61,7 +61,7 @@ def build_extension(self, ext): '-DPYTHON_EXECUTABLE=' + sys.executable] # cfg = 'Debug' if self.debug else 'Release' - cfg = 'Debug' + cfg = 'Release' build_args = ['--config', cfg] if platform.system() == "Windows": @@ -89,6 +89,7 @@ def build_extension(self, ext): author='Erik van den Brink', author_email='erik@coz.io', name='neo3crypto', + python_requires='>=3.8.*', description="Native crypto functions for the NEO 3 Blockchain", long_description=readme, long_description_content_type="text/x-rst",