Skip to content

Run test app on CI #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 25, 2025
Merged

Run test app on CI #133

merged 10 commits into from
Jun 25, 2025

Conversation

kraenhansen
Copy link
Collaborator

@kraenhansen kraenhansen commented Jun 19, 2025

Merging this PR will update the check workflow on CI to run the test app:

  • In an Android emulator in a Linux / Ubuntu runner (when the PR has the "Android 🤖" label)
  • In an iOS simulator in a MacOS runner (when the PR has the "Apple 🍎" label)

Also ...

  • Skipping iOS simulator on Linux and Windows because .. well, that's not supportet.
  • Skipping Android simulator on Windows because the action used to create and boot the emulator does not support windows - this could probably be fixed if we orchestrate the booting of the emulator more directly.
  • Skipping Android simulator on MacOS, because it doesn't provide too much added value (it's already running on Ubuntu) and according to the emulator actions docs, it's 3 times slower.

I suggest using mocha-remote (a tool I maintain and use for Realm JS) to drive the "integrated unit tests", at least for now. I'm open to switching this out for another "universal testing library".

@kraenhansen kraenhansen self-assigned this Jun 19, 2025
Copy link

changeset-bot bot commented Jun 19, 2025

⚠️ No Changeset found

Latest commit: db31ec6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@kraenhansen kraenhansen force-pushed the kh/mocha-remote branch 19 times, most recently from d992ba6 to 55df470 Compare June 22, 2025 19:19
@kraenhansen kraenhansen marked this pull request as ready for review June 24, 2025 00:00
@kraenhansen kraenhansen added Apple 🍎 Anything related to the Apple platform (iOS, macOS, Cocoapods, Xcode, XCFrameworks, etc.) Android 🤖 Anything related to the Android platform (Gradle, NDK, Android SDK) labels Jun 24, 2025
@kraenhansen kraenhansen requested a review from Copilot June 24, 2025 19:39
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the CI check workflow to run the React Native test app on labeled Android/iOS runners and integrates mocha-remote for end-to-end tests in the app.

  • Adds test:android and test:ios scripts in apps/test-app using mocha-remote + concurrently
  • Refactors App.tsx to use MochaRemoteProvider/signals for test runner UI
  • Extends CI workflow (.github/workflows/check.yml) with new test-ios and test-android jobs conditional on labels

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
packages/node-addon-examples/index.js Temporarily commented out a crashing example
apps/test-app/package.json Added Metro and test scripts, new test dependencies
apps/test-app/App.tsx Switched to MochaRemoteProvider and signal-based UI
.github/workflows/check.yml New CI jobs: iOS/Android test app runs based on PR labels
Comments suppressed due to low confidence (4)

.github/workflows/check.yml:71

  • [nitpick] The iOS test job installs Android SDK and NDK – consider removing this step from the iOS workflow to reduce setup time and eliminate irrelevant setup.
      - name: Setup Android SDK

apps/test-app/package.json:10

  • The mocha-remote flag is written as -- concurrently but should be --concurrently (no space) to correctly enable concurrent execution.
    "test:android": "mocha-remote --exit-on-error -- concurrently --kill-others-on-fail --passthrough-arguments npm:metro 'npm:android -- {@}' --",

apps/test-app/package.json:11

  • Likewise, change -- concurrently to --concurrently so the mocha-remote script picks up the concurrently flag properly.
    "test:ios": "mocha-remote --exit-on-error -- concurrently --passthrough-arguments --kill-others-on-fail npm:metro 'npm:ios -- {@}' --"

apps/test-app/App.tsx:11

  • The import path @react-native-node-api/node-addon-examples does not match the dependency name (react-native-node-addon-examples) in package.json; update one to match the other.
import nodeAddonExamples from "@react-native-node-api/node-addon-examples";

Comment on lines 15 to +16
// TODO: This crashes (SIGABRT)
"async_work_thread_safe_function": () => require("./examples/5-async-work/async_work_thread_safe_function/napi/index.js"),
// "async_work_thread_safe_function": () => require("./examples/5-async-work/async_work_thread_safe_function/napi/index.js"),
Copy link
Preview

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider removing this long-commented-out example or extracting it behind a feature flag to avoid confusion and clean up the code.

Copilot uses AI. Check for mistakes.

Copy link
Collaborator

@matthargett matthargett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very thorough!

- name: Clone patched Hermes version
shell: bash
run: |
REACT_NATIVE_OVERRIDE_HERMES_DIR=$(npx react-native-node-api vendor-hermes --silent)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could being silent here hide any warnings that are early signs of issues?

uses: android-actions/setup-android@v3
with:
packages: tools platform-tools ndk;${{ env.NDK_VERSION }}
- run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android aarch64-apple-ios-sim
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing rustup just skips the nonsensical toolchain combinations (ios-sim on windows, etc)?

Copy link
Collaborator Author

@kraenhansen kraenhansen Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure you can cross-compile any of these. Or at the very least install the targets on any system.

@kraenhansen kraenhansen merged commit a7702b4 into main Jun 25, 2025
6 checks passed
@kraenhansen kraenhansen deleted the kh/mocha-remote branch June 25, 2025 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android 🤖 Anything related to the Android platform (Gradle, NDK, Android SDK) Apple 🍎 Anything related to the Apple platform (iOS, macOS, Cocoapods, Xcode, XCFrameworks, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants