From 6dcda8cd72737525e379a68a6c9273d1ea656757 Mon Sep 17 00:00:00 2001 From: Olivier Bilodeau Date: Tue, 5 Dec 2023 11:24:41 -0500 Subject: [PATCH 1/4] Cross-platform binary packaging with cibuildwheel --- .github/workflows/wheels.yml | 30 ++++++++++++++++++++++++++++++ pyproject.toml | 4 +--- 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/wheels.yml diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 000000000..cbad1fb65 --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,30 @@ +name: Build + +on: [push, pull_request] + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, windows-2019, macOS-11] + + steps: + - uses: actions/checkout@v4 + + # Used to host cibuildwheel + - uses: actions/setup-python@v3 + + - name: Install cibuildwheel + run: python -m pip install cibuildwheel==2.16.2 + + - name: Build wheels + run: python -m cibuildwheel --output-dir wheelhouse + # to supply options, put them in 'env', like: + # env: + # CIBW_SOME_OPTION: value + + - uses: actions/upload-artifact@v3 + with: + path: ./wheelhouse/*.whl diff --git a/pyproject.toml b/pyproject.toml index 6f146c964..d5874b680 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,9 +7,7 @@ build-backend = "setuptools.build_meta" name = "pyrdp" description = "Remote Desktop Protocol (RDP) Monster-in-the-Middle tool and Python library" readme = "README.md" -#license = "GPL-3.0-or-later" -# TODO automatically pull from this in the code -version = "1.2.1.dev0" +version = "2.0.0.rc1" requires-python = ">=3.7" authors = [ { name = "Olivier Bilodeau", email = "obilodeau@gosecure.net" }, From 571530b725f42edd41f73696552a0b80c0c4961d Mon Sep 17 00:00:00 2001 From: Olivier Bilodeau Date: Tue, 5 Dec 2023 11:57:59 -0500 Subject: [PATCH 2/4] Run less often and clarify tests vs builds --- .github/workflows/ci.yml | 2 +- .github/workflows/wheels.yml | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86f6a8007..33f09f629 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Build +name: Tests on: pull_request: diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index cbad1fb65..f30157514 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -1,6 +1,13 @@ name: Build -on: [push, pull_request] +on: + pull_request: + branches: + - '**' + push: + branches: + - master + jobs: build_wheels: From 480276373a7cf3c6351e99811c28eb37107ee943 Mon Sep 17 00:00:00 2001 From: Olivier Bilodeau Date: Tue, 5 Dec 2023 14:08:10 -0500 Subject: [PATCH 3/4] Packaging instructions --- docs/devel.adoc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/devel.adoc b/docs/devel.adoc index b012deb52..7b263b589 100644 --- a/docs/devel.adoc +++ b/docs/devel.adoc @@ -45,6 +45,20 @@ docker images (latest, slim), on linux, on Windows * sections, vim's: `%s/^=== \(.*\)$/## \1/gc` * asciidoc links to markdown with vim: `%s/link:\([^\[]\+\)\(\[[^\[]\+\]\)/\2(\1)/gc` +.Upload binaries to PyPI + +Instructions are partially from: https://cibuildwheel.readthedocs.io/en/stable/deliver-to-pypi/#manual-method + + rm -rf dist/ + # Make a source distribution + pipx run build --sdist + +* Download packages built (called artifacts) by the https://github.com/GoSecure/pyrdp/actions/workflows/wheels.yml[Build workflow on GitHub] that are from the release commit +* Extract the zip in the dist/ directory + + # Upload using 'twine' + pipx run twine upload dist/* + .Post-release * Update version in `pyproject.toml` (+1 bugfix, append '.dev0') and commit * commit msg: Begin development on next release From 175004696ec271e259e35f38abfa3b3d127a9d13 Mon Sep 17 00:00:00 2001 From: Olivier Bilodeau Date: Tue, 5 Dec 2023 14:22:54 -0500 Subject: [PATCH 4/4] Updated CHANGELOG --- CHANGELOG.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 5a1c77502..b2651b072 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -16,6 +16,7 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[ === Enhancements +* Pre-built binaries available on PyPI for Linux, Windows and macOS! ({uri-issue}451[#451]) * Support for RDP version 10.11 ({uri-issue}433[#433]) * Support for Python 3.11 by updating PyAV to get pre-built binary wheels ({uri-issue}437[#437], {uri-issue}438[#438]) * MITM start and termination log messages are now part of the JSON logs ({uri-issue}447[#447]) @@ -33,6 +34,7 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[ * Added Python 3.10 tests on Windows to CI test configuration ({uri-issue}439[#439]) * Replaced Python 3.10 with Python 3.11 for CI test configuration ({uri-issue}438[#438]) * Added Ubuntu 20.04 in CI test configuration +* Using cibuildwheel for cross-platform and cross-python builds Windows, Linux, macOS ({uri-issue}451[#451]) == v1.2.0 - 2022-12-23