-
Notifications
You must be signed in to change notification settings - Fork 45
103 lines (93 loc) · 2.92 KB
/
build-bindings-linux.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Build sdk-bindings for Linux
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: ubuntu-20.04
name: build ${{ matrix.target }}
strategy:
matrix:
target: [
aarch64-unknown-linux-gnu,
x86_64-unknown-linux-gnu,
]
steps:
- name: checkout
uses: actions/checkout@v4
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@v3
with:
version: "27.2"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install gcc-aarch64-linux-gnu
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update -y
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Install gcc-x86-64-linux-gnu
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
sudo apt-get update -y
sudo apt-get install -y gcc-x86-64-linux-gnu g++-x86-64-linux-gnu
- uses: Swatinem/rust-cache@v2
with:
workspaces: libs
- name: Build sdk-bindings
working-directory: libs/sdk-bindings
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/aarch64-linux-gnu-gcc
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/x86_64-linux-gnu-gcc
run: cargo build --release --target ${{ matrix.target }}
- name: Archive release
uses: actions/upload-artifact@v4
with:
name: sdk-bindings-${{ matrix.target }}
path: libs/target/${{ matrix.target }}/release/libbreez_sdk_bindings.so
build-dummies:
if: ${{ inputs.use-dummy-binaries }}
runs-on: ubuntu-latest
name: build linux dummies
strategy:
matrix:
target: [
aarch64-unknown-linux-gnu,
x86_64-unknown-linux-gnu,
]
steps:
- name: Build dummy linux ${{ matrix.target }}
run: |
touch libbreez_sdk_bindings.so
- name: Upload dummy linux ${{ matrix.target }} artifact
uses: actions/upload-artifact@v4
with:
name: sdk-bindings-${{ matrix.target }}
path: ./*