Skip to content

Commit

Permalink
Build windows wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
dangeross committed Mar 5, 2024
1 parent b6732e6 commit 2b00a74
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 15 deletions.
26 changes: 24 additions & 2 deletions .github/workflows/build-bindings-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,31 @@ jobs:
- name: Build sdk-bindings
working-directory: libs/sdk-bindings
run: cargo build --release --target ${{ matrix.target }}


- name: Copy VC redistributables to release directory for Windows
if: matrix.target == 'x86_64-pc-windows-msvc'
working-directory: libs/target/${{ matrix.target }}/release
run: |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\msvcp140.dll') .
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140.dll') .
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140_1.dll') .
- name: Copy VC redistributables to release directory for Windows
if: matrix.target == 'i686-pc-windows-msvc'
working-directory: libs/target/${{ matrix.target }}/release
run: |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x86\*\msvcp140.dll') .
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x86\*\vcruntime140.dll') .
- name: Archive release
uses: actions/upload-artifact@v3
with:
name: sdk-bindings-${{ matrix.target }}
path: libs/target/${{ matrix.target }}/release/breez_sdk_bindings.dll
path: |
libs/target/${{ matrix.target }}/release/breez_sdk_bindings.dll
libs/target/${{ matrix.target }}/release/msvcp140.dll
libs/target/${{ matrix.target }}/release/vcruntime140.dll
libs/target/${{ matrix.target }}/release/vcruntime140_1.dll
build-dummies:
if: ${{ inputs.use-dummy-binaries }}
Expand All @@ -80,6 +99,9 @@ jobs:
- name: Build dummy windows ${{ matrix.target }}
run: |
touch breez_sdk_bindings.dll
touch msvcp140.dll
touch vcruntime140.dll
touch vcruntime140_1.dll
- name: Upload dummy windows ${{ matrix.target }} artifact
uses: actions/upload-artifact@v3
Expand Down
77 changes: 65 additions & 12 deletions .github/workflows/publish-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,62 @@ jobs:
name: python-wheel-${{ matrix.python }}-manylinux_2_31_${{ matrix.arch }}
path: libs/sdk-bindings/bindings-python/dist/*.whl

build-windows-wheels:
runs-on: windows-latest
strategy:
matrix:
arch: [win_amd64, win32]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
repository: ${{ inputs.repository || github.repository }}
ref: ${{ inputs.ref || github.sha }}

- name: "Setup Python"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- uses: actions/download-artifact@v3
if: matrix.target == 'win_amd64'
with:
name: sdk-bindings-x86_64-pc-windows-msvc
path: libs/sdk-bindings/bindings-python/src/breez_sdk

- uses: actions/download-artifact@v3
if: matrix.target == 'win32'
with:
name: sdk-bindings-i686-pc-windows-msvc
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: python -m pip install --upgrade pip twine wheel setuptools

- name: "Build wheel"
working-directory: libs/sdk-bindings/bindings-python
run: python -m setup bdist_wheel --plat-name ${{ matrix.arch }} --verbose

- uses: actions/upload-artifact@v3
with:
name: python-wheel-${{ matrix.python }}-${{ matrix.arch }}
path: libs/sdk-bindings/bindings-python/dist/*.whl

publish-package:
runs-on: ubuntu-latest
needs: [build-macos-wheels, build-linux-wheels]
needs: [build-macos-wheels, build-linux-wheels, build-windows-wheels]
steps:
- name: Checkout breez-sdk repo
uses: actions/checkout@v3
Expand All @@ -148,20 +201,20 @@ jobs:
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 }}
- 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/*/
2 changes: 1 addition & 1 deletion libs/sdk-bindings/bindings-python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
packages=["breez_sdk"],
package_dir={"breez_sdk": "./src/breez_sdk"},
include_package_data=True,
package_data={"breez_sdk": ["*.dylib", "*.so"]},
package_data={"breez_sdk": ["*.dylib", "*.so", "*.dll"]},
url="https://github.com/breez/breez-sdk",
author="Breez <[email protected]>",
license="MIT",
Expand Down

0 comments on commit 2b00a74

Please sign in to comment.