Skip to content

Commit

Permalink
android/iOS CI Checks (#1667)
Browse files Browse the repository at this point in the history
* android/ios ci

---------

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
insipx and dependabot[bot] authored Feb 27, 2025
1 parent 9f0dd2c commit fb4fb04
Show file tree
Hide file tree
Showing 10 changed files with 550 additions and 187 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/check-ios-android-bindings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Check iOS & Android Bindings
on:
push:
branches:
- main
pull_request:
paths:
- ".github/workflows/check-ios-android-bindings.yml"
- "bindings_ffi/**"
- "Cargo.toml"
- "Cargo.lock"
- "dev/**"
- "rust-toolchain"
- ".cargo/**"
jobs:
check-swift:
runs-on: warp-macos-13-arm64-6x
strategy:
fail-fast: false
matrix:
target:
- x86_64-apple-darwin
- aarch64-apple-darwin
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
# Mostly to avoid GitHub rate limiting
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
- name: Build target
run: |
nix develop . --command \
cargo check --target ${{ matrix.target }} --manifest-path bindings_ffi/Cargo.toml
check-android:
runs-on: warp-ubuntu-latest-x64-16x
strategy:
fail-fast: false
matrix:
target:
- x86_64-linux-android
# We can add other targets later by making a pkg derivation and configuring LD_LIBRARY_PATH
# according to https://github.com/bburdette/tauri-zknotes/blob/7aa3495dc2c8a266d81c2fa3e51ae347e9c2597d/flake.nix#L158
# but this is good for just checking to ensure it compiles on this target
# Can also run android emulator here after cloning xmtp-android
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
# Mostly to avoid GitHub rate limiting
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
- name: check target
run: |
nix develop .#android --command \
cargo check --target ${{ matrix.target }} --manifest-path bindings_ffi/Cargo.toml
148 changes: 74 additions & 74 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions bindings_ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tracing-subscriber = { workspace = true, features = [
"fmt",
"json",
] }
uniffi = { version = "0.28.0", default-features = false, features = ["tokio"] }
uniffi = { version = "0.29.0", default-features = false, features = ["tokio"] }
xmtp_api.workspace = true
xmtp_api_grpc.workspace = true
xmtp_common.workspace = true
Expand All @@ -45,7 +45,7 @@ tracing_android_trace = { version = "0.1", features = ["api_level_29"] }
tracing-oslog = "0.2"

[build-dependencies]
uniffi = { version = "0.28.0", features = ["build"] }
uniffi = { version = "0.29.0", features = ["build"] }

[[bin]]
name = "ffi-uniffi-bindgen"
Expand All @@ -56,7 +56,7 @@ required-features = ["uniffi/cli"]
ethers = { workspace = true, features = ["rustls"] }
rand.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread"] }
uniffi = { version = "0.28.0", features = ["bindgen-tests"] }
uniffi = { version = "0.29.0", features = ["bindgen-tests"] }
uuid = { workspace = true, features = ["v4", "fast-rng"] }
xmtp_api_grpc = { workspace = true, features = ["test-utils"] }
xmtp_mls = { workspace = true, features = ["test-utils"] }
Expand Down
10 changes: 8 additions & 2 deletions bindings_ffi/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ mod ios {
let libxmtp_filter = EnvFilter::builder()
.parse(FILTER_DIRECTIVE)
.unwrap_or_else(|_| EnvFilter::new("info"));

let subsystem = format!("org.xmtp.{}", env!("CARGO_PKG_NAME"));

OsLogger::new(subsystem, "default").with_filter(libxmtp_filter)
}
}
Expand Down Expand Up @@ -104,11 +102,19 @@ pub use test_logger::*;
#[cfg(test)]
mod test_logger {
use super::*;
use tracing_subscriber::EnvFilter;

pub fn native_layer<S>() -> impl Layer<S>
where
S: Subscriber + for<'a> LookupSpan<'a>,
{
xmtp_common::logger_layer()
}

#[test]
fn test_directive() {
let _filer = EnvFilter::builder()
.parse(FILTER_DIRECTIVE)
.expect("should parse correctly");
}
}
Loading

0 comments on commit fb4fb04

Please sign in to comment.