Skip to content

Commit fb4fb04

Browse files
android/iOS CI Checks (#1667)
* android/ios ci --------- Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 9f0dd2c commit fb4fb04

File tree

10 files changed

+550
-187
lines changed

10 files changed

+550
-187
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Check iOS & Android Bindings
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
paths:
8+
- ".github/workflows/check-ios-android-bindings.yml"
9+
- "bindings_ffi/**"
10+
- "Cargo.toml"
11+
- "Cargo.lock"
12+
- "dev/**"
13+
- "rust-toolchain"
14+
- ".cargo/**"
15+
jobs:
16+
check-swift:
17+
runs-on: warp-macos-13-arm64-6x
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
target:
22+
- x86_64-apple-darwin
23+
- aarch64-apple-darwin
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
- name: Install Nix
28+
uses: cachix/install-nix-action@v30
29+
with:
30+
# Mostly to avoid GitHub rate limiting
31+
extra_nix_config: |
32+
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
33+
- uses: DeterminateSystems/flakehub-cache-action@main
34+
- name: Cache
35+
uses: Swatinem/rust-cache@v2
36+
with:
37+
workspaces: |
38+
.
39+
- name: Build target
40+
run: |
41+
nix develop . --command \
42+
cargo check --target ${{ matrix.target }} --manifest-path bindings_ffi/Cargo.toml
43+
check-android:
44+
runs-on: warp-ubuntu-latest-x64-16x
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
target:
49+
- x86_64-linux-android
50+
# We can add other targets later by making a pkg derivation and configuring LD_LIBRARY_PATH
51+
# according to https://github.com/bburdette/tauri-zknotes/blob/7aa3495dc2c8a266d81c2fa3e51ae347e9c2597d/flake.nix#L158
52+
# but this is good for just checking to ensure it compiles on this target
53+
# Can also run android emulator here after cloning xmtp-android
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v4
57+
- name: Install Nix
58+
uses: cachix/install-nix-action@v30
59+
with:
60+
# Mostly to avoid GitHub rate limiting
61+
extra_nix_config: |
62+
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
63+
- uses: DeterminateSystems/flakehub-cache-action@main
64+
- name: Cache
65+
uses: Swatinem/rust-cache@v2
66+
with:
67+
workspaces: |
68+
.
69+
- name: check target
70+
run: |
71+
nix develop .#android --command \
72+
cargo check --target ${{ matrix.target }} --manifest-path bindings_ffi/Cargo.toml

Cargo.lock

+74-74
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindings_ffi/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ tracing-subscriber = { workspace = true, features = [
2020
"fmt",
2121
"json",
2222
] }
23-
uniffi = { version = "0.28.0", default-features = false, features = ["tokio"] }
23+
uniffi = { version = "0.29.0", default-features = false, features = ["tokio"] }
2424
xmtp_api.workspace = true
2525
xmtp_api_grpc.workspace = true
2626
xmtp_common.workspace = true
@@ -45,7 +45,7 @@ tracing_android_trace = { version = "0.1", features = ["api_level_29"] }
4545
tracing-oslog = "0.2"
4646

4747
[build-dependencies]
48-
uniffi = { version = "0.28.0", features = ["build"] }
48+
uniffi = { version = "0.29.0", features = ["build"] }
4949

5050
[[bin]]
5151
name = "ffi-uniffi-bindgen"
@@ -56,7 +56,7 @@ required-features = ["uniffi/cli"]
5656
ethers = { workspace = true, features = ["rustls"] }
5757
rand.workspace = true
5858
tokio = { workspace = true, features = ["rt-multi-thread"] }
59-
uniffi = { version = "0.28.0", features = ["bindgen-tests"] }
59+
uniffi = { version = "0.29.0", features = ["bindgen-tests"] }
6060
uuid = { workspace = true, features = ["v4", "fast-rng"] }
6161
xmtp_api_grpc = { workspace = true, features = ["test-utils"] }
6262
xmtp_mls = { workspace = true, features = ["test-utils"] }

bindings_ffi/src/logger.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ mod ios {
5151
let libxmtp_filter = EnvFilter::builder()
5252
.parse(FILTER_DIRECTIVE)
5353
.unwrap_or_else(|_| EnvFilter::new("info"));
54-
5554
let subsystem = format!("org.xmtp.{}", env!("CARGO_PKG_NAME"));
56-
5755
OsLogger::new(subsystem, "default").with_filter(libxmtp_filter)
5856
}
5957
}
@@ -104,11 +102,19 @@ pub use test_logger::*;
104102
#[cfg(test)]
105103
mod test_logger {
106104
use super::*;
105+
use tracing_subscriber::EnvFilter;
107106

108107
pub fn native_layer<S>() -> impl Layer<S>
109108
where
110109
S: Subscriber + for<'a> LookupSpan<'a>,
111110
{
112111
xmtp_common::logger_layer()
113112
}
113+
114+
#[test]
115+
fn test_directive() {
116+
let _filer = EnvFilter::builder()
117+
.parse(FILTER_DIRECTIVE)
118+
.expect("should parse correctly");
119+
}
114120
}

0 commit comments

Comments
 (0)