Skip to content

Build sdk-bindings for Windows #5

Build sdk-bindings for Windows

Build sdk-bindings for Windows #5

name: Build sdk-bindings for Windows
on:
workflow_dispatch:
inputs:
ref:
description: 'commit/tag/branch reference'
required: true
type: string
workflow_call:
inputs:
repository:
description: 'sdk repository, defaults to current repository'
required: false
type: string
ref:
description: 'commit/tag/branch reference'
required: true
type: string
use-dummy-binaries:
description: 'If true, creates dummy binaries rather than real binaries'
required: false
type: boolean
default: false
jobs:
build:
if: ${{ !inputs.use-dummy-binaries }}
runs-on: windows-latest
name: build ${{ matrix.target }}
strategy:
matrix:
target: [
x86_64-pc-windows-msvc,
i686-pc-windows-msvc,
]
steps:
- name: checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
repository: ${{ inputs.repository || github.repository }}
- name: Install rust toolchain
run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
rustup target add ${{ matrix.target }}
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
version: "23.4"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: libs
- 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') .
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x86\*\vcruntime140_1.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
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 }}
runs-on: ubuntu-latest
name: build windows dummies
strategy:
matrix:
target: [
x86_64-pc-windows-msvc,
i686-pc-windows-msvc,
]
steps:
- 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
with:
name: sdk-bindings-${{ matrix.target }}
path: ./*