Skip to content

Conversation

@cpoile
Copy link
Member

@cpoile cpoile commented Dec 13, 2025

Summary

Add CI and developer setup for E2EE Rust module

  • I've tried my best to reduce the added size of the rust code, but it's still a bit. I'll keep looking at ways to reduce it.
  • I've also tried to keep the added CI work to a minimum -- we're caching the rust build artifacts, so we shouldn't see too much added time here for regular PRS that don't change e2ee code.

E2EE Module:

  • Add @mattermost/e2ee library with Rust core in libraries/@mattermost/e2ee/
  • Just for testing, I made a test component in the channel info menu that called greet from the Rust code through the TS wrapper, and it all works. (to be clear: I did not include that component in this PR)
  • Bindings are auto generated using uniffi-bindgen-react-native
  • TypeScript wrapper layer for React Native integration
  • Configure iOS Podspec and Android Gradle build
  • Added old architecture overrides for RN 0.76 compatibility (New Architecture disabled) -- it shouldn't be too much work to get it working when we move to new arch.

Developer Setup:

  • Add scripts/setup-rust.sh that auto-installs Rust, required targets, and cargo-ndk if missing
  • We call the setup script from postinstall.sh so npm i works out of the box for devs

Build System:

  • Add scripts/build.sh to compile Rust for iOS targets (aarch64, aarch64-sim, x86_64) and Android targets (aarch64, armv7, x86_64, i686)
  • Add npm run e2ee:build and related scripts to root package.json
  • Auto-build E2EE module during npm install via postinstall hook
  • Add scripts/clean.sh updates to clean Rust build artifacts

CI Changes:

  • Add test-rust job to ci.yml that runs Rust unit tests in parallel with existing test job
  • The rest of the tests are run in the build app steps
  • Add prepare-rust-toolchain action to set up Rust, run tests, build E2EE module, and verify builds
  • rust-toolchain.toml is at the repo root so CI actions can auto-detect it

E2EE Testing:

  • Add npm run e2ee:test scripts for Rust unit tests, iOS, and Android verification
  • Add verify-build.sh to validate built artifacts exist and have correct structure
  • Add iOS test that compiles Swift against xcframework and verifies FFI checksums on simulator (we can remove this eventually -- it's just to make sure things are working)
  • Add Android test that verifies static library symbols are correctly exported (can't easily use emulator -- we can remove this eventually too)

Ticket Link

Checklist

  • Added or updated unit tests (required for all new features)
  • Has UI changes
  • Includes text changes and localization file updates
  • Have tested against the 5 core themes to ensure consistency between them.
  • Have run E2E tests by adding label E2E iOS tests for PR.

Device Information

This PR was tested on:

Screenshots

Release Note

Added rust to mobile builds, CI pipeline, basic tests

@cpoile cpoile self-assigned this Dec 13, 2025
@cpoile cpoile added the Work In Progress Not yet ready for review label Dec 13, 2025
@github-actions
Copy link

github-actions bot commented Dec 13, 2025

Coverage Comparison Report

Generated on December 15, 2025 at 22:36:06 UTC

+-----------------+------------+------------+-----------+
| Metric          | Main       | This PR    | Diff      |
+-----------------+------------+------------+-----------+
| Lines           |     86.18% |     86.18% |     0.00% |
| Statements      |     86.06% |     86.06% |     0.00% |
| Branches        |     72.61% |     72.61% |     0.00% |
| Functions       |     85.40% |     85.40% |     0.00% |
+-----------------+------------+------------+-----------+
| Total           |     82.56% |     82.56% |     0.00% |
+-----------------+------------+------------+-----------+

@cpoile cpoile added Build Apps for PR Build the mobile app for iOS and Android to test E2E iOS tests for PR Run iOS E2E Detox tests E2E Android tests for PR Run Android E2E Detox tests labels Dec 13, 2025
@cpoile cpoile added Build Apps for PR Build the mobile app for iOS and Android to test E2E iOS tests for PR Run iOS E2E Detox tests E2E Android tests for PR Run Android E2E Detox tests and removed Build Apps for PR Build the mobile app for iOS and Android to test E2E iOS tests for PR Run iOS E2E Detox tests E2E Android tests for PR Run Android E2E Detox tests labels Dec 13, 2025
@cpoile cpoile added Build Apps for PR Build the mobile app for iOS and Android to test E2E iOS tests for PR Run iOS E2E Detox tests E2E Android tests for PR Run Android E2E Detox tests and removed Build Apps for PR Build the mobile app for iOS and Android to test E2E iOS tests for PR Run iOS E2E Detox tests E2E Android tests for PR Run Android E2E Detox tests labels Dec 13, 2025
@cpoile cpoile removed the Build Apps for PR Build the mobile app for iOS and Android to test label Dec 13, 2025
@cpoile cpoile added E2E Android tests for PR Run Android E2E Detox tests Build Apps for PR Build the mobile app for iOS and Android to test labels Dec 15, 2025
@cpoile cpoile added Build Apps for PR Build the mobile app for iOS and Android to test E2E iOS tests for PR Run iOS E2E Detox tests E2E Android tests for PR Run Android E2E Detox tests and removed Build Apps for PR Build the mobile app for iOS and Android to test E2E iOS tests for PR Run iOS E2E Detox tests E2E Android tests for PR Run Android E2E Detox tests labels Dec 15, 2025
@github-actions
Copy link

Android E2E Test Report: a7e9735 | "84.18"% (282/335) | full report

Tests Passed ✅ Failed ❌ Skipped ⏭️ Errors ⚠️
335 282 52 1 0

@github-actions github-actions bot removed the E2E Android tests for PR Run Android E2E Detox tests label Dec 15, 2025
@cpoile cpoile added E2E iOS tests for PR Run iOS E2E Detox tests and removed Build Apps for PR Build the mobile app for iOS and Android to test E2E iOS tests for PR Run iOS E2E Detox tests labels Dec 15, 2025
@cpoile cpoile added E2E iOS tests for PR Run iOS E2E Detox tests and removed E2E iOS tests for PR Run iOS E2E Detox tests labels Dec 15, 2025
@cpoile cpoile added Build Apps for PR Build the mobile app for iOS and Android to test E2E iOS tests for PR Run iOS E2E Detox tests E2E Android tests for PR Run Android E2E Detox tests and removed E2E iOS tests for PR Run iOS E2E Detox tests labels Dec 15, 2025
@cpoile cpoile requested review from carlisgg and enahum December 16, 2025 00:28
@cpoile cpoile added 2: Dev Review Requires review by a core commiter and removed Work In Progress Not yet ready for review labels Dec 16, 2025
@github-actions
Copy link

Android E2E Test Report: 4c59f0e | "84.48"% (283/335) | full report

Tests Passed ✅ Failed ❌ Skipped ⏭️ Errors ⚠️
335 283 51 1 0

@github-actions github-actions bot removed the E2E Android tests for PR Run Android E2E Detox tests label Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2: Dev Review Requires review by a core commiter Build Apps for PR Build the mobile app for iOS and Android to test E2E iOS tests for PR Run iOS E2E Detox tests release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants