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 6, 2024
1 parent b6732e6 commit ae09c3e
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 6 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
5 changes: 3 additions & 2 deletions .github/workflows/publish-all-platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ jobs:
# to set these variables here to `true` or `false`
# (e.g. bindings-windows: true) if you want to test something.
repository: ${{ needs.pre-setup.outputs.repository }}
bindings-windows: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version }}
bindings-windows: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version || !!needs.pre-setup.outputs.python-package-version }}
bindings-darwin: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version || !!needs.pre-setup.outputs.python-package-version }}
bindings-linux: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version || !!needs.pre-setup.outputs.python-package-version}}
bindings-linux: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version || !!needs.pre-setup.outputs.python-package-version }}
bindings-android: ${{ !!needs.pre-setup.outputs.kotlin-mpp-package-version || !!needs.pre-setup.outputs.maven-package-version || !!needs.pre-setup.outputs.golang-package-version }}
bindings-ios: ${{ !!needs.pre-setup.outputs.kotlin-mpp-package-version || !!needs.pre-setup.outputs.maven-package-version }}
kotlin: ${{ !!needs.pre-setup.outputs.kotlin-mpp-package-version || !!needs.pre-setup.outputs.maven-package-version || !!needs.pre-setup.outputs.flutter-package-version }}
Expand Down Expand Up @@ -277,6 +277,7 @@ jobs:
- setup
- build-bindings-darwin
- build-bindings-linux
- build-bindings-windows
- build-language-bindings
if: ${{ needs.setup.outputs.python == 'true' }}
uses: ./.github/workflows/publish-python.yml
Expand Down
62 changes: 61 additions & 1 deletion .github/workflows/publish-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,68 @@ 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: (Get-Content setup.py) | Foreach-Object {$_ -replace ' version=".*",', (' version="${{ inputs.package-version }}",')} | Set-Content setup.py

- name: List files
working-directory: libs/sdk-bindings/bindings-python
run: |
ls -R
cat 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 @@ -149,6 +208,7 @@ jobs:
# for developing, testing, and experimenting
# - name: "Publish on test PyPI"
# if: ${{ inputs.publish }}
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# verbose: true
Expand Down
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 ae09c3e

Please sign in to comment.