Skip to content

Commit 4bef85d

Browse files
Merge branch 'main' into flutter_rust_bridge_v2
2 parents 4063b57 + 95c7d0b commit 4bef85d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+6873
-5699
lines changed

.github/workflows/build-bindings-android.yml

+9
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ jobs:
4949
rustup target add ${{ matrix.target }}
5050
cargo install cargo-ndk
5151
52+
- name: Setup NDK
53+
uses: nttld/setup-ndk@v1
54+
id: setup-ndk
55+
with:
56+
ndk-version: r26d
57+
58+
- name: Set ANDROID_NDK_HOME
59+
run: echo "ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >> "$GITHUB_ENV"
60+
5261
- name: Install Protoc
5362
uses: arduino/setup-protoc@v2
5463
with:

.github/workflows/main.yml

+79
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,32 @@ jobs:
143143
working-directory: tools/sdk-cli
144144
run: cargo test
145145

146+
build-common:
147+
name: Test sdk-common
148+
runs-on: ubuntu-latest
149+
steps:
150+
- name: Checkout repo
151+
uses: actions/checkout@v3
152+
153+
- name: Install rust
154+
run: |
155+
rustup set auto-self-update disable
156+
rustup toolchain install stable --profile minimal
157+
158+
- uses: Swatinem/rust-cache@v2
159+
with:
160+
workspaces: libs/sdk-common -> ../target
161+
162+
- name: Install Protoc
163+
uses: arduino/setup-protoc@v2
164+
with:
165+
version: "23.4"
166+
repo-token: ${{ secrets.GITHUB_TOKEN }}
167+
168+
- name: Run sdk-common tests
169+
working-directory: libs/sdk-common
170+
run: cargo test
171+
146172
clippy:
147173
name: Clippy
148174
runs-on: ubuntu-latest
@@ -273,3 +299,56 @@ jobs:
273299

274300
- name: dart-format
275301
run: dart format -o none --set-exit-if-changed -l 110 .
302+
303+
# Create a new plain Rust project, add the SDK as single dependency and try to compile it.
304+
# This tests whether the SDK compiles with the latest version of the dependencies that can be updated.
305+
#
306+
# Our checked-in Cargo.lock contains the specific combination of all direct and transitive dependency versions.
307+
# This dependency tree snapshot was tested against during development and is what we release.
308+
#
309+
# However, when integrating the SDK in a new Rust project, Cargo not use our Cargo.lock. Instead, it will try to generate
310+
# a new Cargo.lock based on our (and our dependencies') Cargo.toml files. This means that, where a dependency version range
311+
# is used in a Cargo.toml, Cargo will try to upgrade it to the latest matching version. If this happens, this new dependency
312+
# version may even result in the whole project failing to compile. In that case, the only solution is to manually pin
313+
# the problematic dependencies to the last known good versions, in the application's Cargo.toml.
314+
#
315+
# Since this is the situation new projects are faced with when adding the SDK as a Rust dependency, we simulate it here
316+
# to get an early warning signal, should any newer dependency cause it to fail to compile.
317+
#
318+
# See discussion at https://github.com/breez/breez-sdk/issues/969#issuecomment-2104700522
319+
check-sdk-as-dependency:
320+
name: Check SDK as Rust dependency in fresh project
321+
runs-on: ubuntu-latest
322+
steps:
323+
- name: Checkout repo
324+
uses: actions/checkout@v3
325+
326+
- name: Install rust
327+
run: |
328+
rustup set auto-self-update disable
329+
rustup toolchain install stable --profile minimal
330+
331+
- uses: Swatinem/rust-cache@v2
332+
with:
333+
workspaces: |
334+
libs -> target
335+
336+
- name: Install Protoc
337+
uses: arduino/setup-protoc@v2
338+
with:
339+
version: "23.4"
340+
repo-token: ${{ secrets.GITHUB_TOKEN }}
341+
342+
- name: test-new-project-with-sdk-dependency
343+
run: |
344+
mkdir new-project
345+
cd new-project
346+
cargo init --name test_project --vcs none
347+
348+
# A project might reference our SDK as a git repository
349+
# cargo add --git https://github.com/breez/breez-sdk breez-sdk-core
350+
351+
# In this test, we reference the checked out repo (e.g. this PR branch)
352+
cargo add --path ../libs/sdk-core breez-sdk-core
353+
354+
cargo clippy -- -D warnings

0 commit comments

Comments
 (0)