-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit '9cdea22d9d42dc0d0ec72218879e4b078c52fd0c' into v0.2.9
* commit '9cdea22d9d42dc0d0ec72218879e4b078c52fd0c': Alternative workflow input Revert "Test publish" Test publish Revert "Remove macos build for testing" Remove macos build for testing Build linux wheels on ubuntu Update .github/workflows/publish-python.yml Add readme Clean up CI workflow Fix manylinux tag Use matrix builds Add linux wheels to CI Add CI Setup python package
- Loading branch information
Showing
8 changed files
with
294 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
name: Publish Python Bindings | ||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
description: 'commit/tag/branch reference' | ||
required: true | ||
type: string | ||
package-version: | ||
description: 'version for the python package (MAJOR.MINOR.BUILD)' | ||
required: true | ||
type: string | ||
publish: | ||
description: 'value indicating whether to publish to pypi.' | ||
required: true | ||
type: boolean | ||
default: false | ||
secrets: | ||
PYPI_API_TOKEN: | ||
description: 'api token to authenticate to pypi' | ||
required: true | ||
|
||
jobs: | ||
build-macos-wheels: | ||
runs-on: macos-latest | ||
strategy: | ||
matrix: | ||
python: ["3.8", "3.9", "3.10"] | ||
steps: | ||
- name: Checkout breez-sdk repo | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.ref || github.sha }} | ||
|
||
- name: "Install Python" | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: sdk-bindings-darwin-universal | ||
path: libs/sdk-bindings/bindings-python/src/breez_sdk | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: bindings-python | ||
path: libs/sdk-bindings/bindings-python/src/breez_sdk | ||
|
||
- name: Clean up downloaded files | ||
run: | | ||
rm -f libs/sdk-bindings/bindings-python/src/breez_sdk/*.a | ||
ls -R libs/sdk-bindings/bindings-python | ||
- name: Update package version | ||
if: ${{ inputs.package-version }} | ||
working-directory: libs/sdk-bindings/bindings-python | ||
run: sed -i.bak -e 's/ version=".*",/ version="${{ inputs.package-version }}",/' setup.py | ||
|
||
- name: Install dependencies | ||
working-directory: libs/sdk-bindings/bindings-python | ||
run: pip3 install wheel setuptools | ||
|
||
- name: Build wheel | ||
working-directory: libs/sdk-bindings/bindings-python | ||
run: python3 setup.py bdist_wheel --plat-name macosx_11_0_universal2 --verbose | ||
|
||
- name: List wheel contents | ||
working-directory: libs/sdk-bindings/bindings-python/dist | ||
run: python3 -m zipfile --list *.whl || true | ||
|
||
- name: Archive the wheel | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-wheel-${{ matrix.python }}-macos | ||
path: libs/sdk-bindings/bindings-python/dist/*.whl | ||
|
||
build-linux-wheels: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
arch: [x86_64, aarch64] | ||
python: ["3.8", "3.9", "3.10"] | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v3 | ||
|
||
- name: "Setup Python" | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: sdk-bindings-${{ matrix.arch }}-unknown-linux-gnu | ||
path: libs/sdk-bindings/bindings-python/src/breez_sdk | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: bindings-python | ||
path: libs/sdk-bindings/bindings-python/src/breez_sdk | ||
|
||
- name: Update package version | ||
if: ${{ inputs.package-version }} | ||
working-directory: libs/sdk-bindings/bindings-python | ||
run: sed -i.bak -e 's/ version=".*",/ version="${{ inputs.package-version }}",/' setup.py | ||
|
||
- name: Install dependencies | ||
working-directory: libs/sdk-bindings/bindings-python | ||
run: pip3 install wheel setuptools | ||
|
||
- name: "Build wheel" | ||
working-directory: libs/sdk-bindings/bindings-python | ||
run: python3 setup.py bdist_wheel --plat-name manylinux_2_31_${{ matrix.arch }} --verbose | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-wheel-${{ matrix.python }}-manylinux_2_31_${{ matrix.arch }} | ||
path: libs/sdk-bindings/bindings-python/dist/*.whl | ||
|
||
publish-package: | ||
runs-on: ubuntu-latest | ||
needs: [build-macos-wheels, build-linux-wheels] | ||
steps: | ||
- name: Checkout breez-sdk repo | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.ref || github.sha }} | ||
|
||
- name: Download wheels | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: libs/sdk-bindings/bindings-python/dist/ | ||
|
||
- name: Clean downloaded contents | ||
working-directory: libs/sdk-bindings/bindings-python | ||
run: | | ||
find dist -maxdepth 1 ! -path dist ! -name "python-wheel-*" -exec rm -rf {} \; | ||
ls -laR dist | ||
# for developing, testing, and experimenting | ||
# - name: "Publish on test PyPI" | ||
# uses: pypa/gh-action-pypi-publish@release/v1 | ||
# with: | ||
# verbose: true | ||
# user: __token__ | ||
# password: ${{ secrets.PYPI_API_TOKEN }} | ||
# repository_url: https://test.pypi.org/legacy/ | ||
# packages_dir: libs/sdk-bindings/bindings-python/dist/*/ | ||
|
||
- name: "Publish on PyPI" | ||
if: ${{ inputs.publish }} | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
verbose: true | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
packages_dir: libs/sdk-bindings/bindings-python/dist/*/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
src/breez_sdk/breez_sdk.py | ||
src/breez_sdk/*.dylib | ||
*.egg-info | ||
build | ||
dist |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# SDK bindings for Python | ||
|
||
## Usage | ||
|
||
``` | ||
pip install breez_sdk | ||
``` | ||
|
||
``` python | ||
import breez_sdk | ||
|
||
# see https://sdk-doc.breez.technology | ||
``` | ||
|
||
## Python Package | ||
|
||
Run the GitHub workflow 'Publish Python Bindings' when creating a new release of Breez SDK. | ||
It will create wheels for the following Python versions and Platforms and upload them to [PyPi.org](https://pypi.org/project/breez-sdk/). | ||
|
||
### Supported Wheels | ||
|
||
| | GNU/Linux amd64 | GNU/Linux arm64v8 | macOS x86_64 | macos aarch64 | | ||
|-----------------|-----------------|-------------------|--------------|---------------| | ||
| **Python 3.8** | ✅ | ✅ | ✅ | ✅ | | ||
| **Python 3.9** | ✅ | ✅ | ✅ | ✅ | | ||
| **Python 3.10** | ✅ | ✅ | ✅ | ✅ | | ||
|
||
## Building Manually | ||
|
||
To build the package manually inside this directory use the supplied `makefile`: | ||
|
||
``` shell | ||
make darwin # builds the package for macos | ||
make linux # builds the package for linux | ||
``` | ||
|
||
The artifacts will be placed in `src/breez_sdk/`. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.PHONY: init | ||
init: | ||
make -C ../ init | ||
|
||
darwin: | ||
make -C ../ python-darwin | ||
cp ../ffi/python/breez_sdk.py src/breez_sdk | ||
cp ../ffi/python/libbreez_sdk_bindings.dylib src/breez_sdk | ||
|
||
linux: | ||
make -C ../ python-linux | ||
cp ../ffi/python/breez_sdk.py src/breez_sdk | ||
cp ../ffi/python/libbreez_sdk_bindings.dylib src/breez_sdk |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["setuptools"] | ||
build-backend = "setuptools.build_meta" |
Oops, something went wrong.