Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 0 additions & 104 deletions .azurepipelines/build-rn-code-push-1es.yml

This file was deleted.

94 changes: 0 additions & 94 deletions .azurepipelines/test-rn-code-push.yml

This file was deleted.

65 changes: 39 additions & 26 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,60 @@ name: CI Tests

on:
pull_request:
types: [opened, edited]
workflow_dispatch:

jobs:
android-new-arch-test:
runs-on: self-hosted
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Run Android Tests
run: |
npm install
npm run test:android
- uses: jdx/mise-action@v4

- name: Install dependencies
run: npm install

- name: Lint and type-check
run: npm run build:tests

ios-new-arch-test:
runs-on: self-hosted
android-test:
needs: lint
runs-on: bitrise-react-native-code-push-linux-runner
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Run iOS Tests
run: |
npm install
npm run test:ios
- uses: jdx/mise-action@v4

android-old-arch-test:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: npm install

- name: Run Android Tests
- name: Enable KVM
run: |
npm install
npm run test:oldArch:android
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

ios-old-arch-test:
runs-on: self-hosted
- name: Run Android Tests
uses: reactivecircus/android-emulator-runner@v2
env:
# Tests need `emulator` to be in $PATH.
PATH: /usr/local/lib/android/sdk/emulator:/usr/local/lib/android/sdk/platform-tools:${{ env.PATH }}
with:
api-level: 27
target: google_apis
arch: x86
disable-animations: true
script: npm run test:android

ios-test:
needs: lint
runs-on: bitrise-react-native-code-push-macos-runner
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- uses: jdx/mise-action@v4

- name: Run iOS Tests
run: |
npm install
npm run test:oldArch:ios
npm run test:ios
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,5 @@ Examples/testapp_rn

#CodePushExpoDemoApp
*.rm

.claude/settings.local.json
33 changes: 10 additions & 23 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

React Native CodePush is a native module that enables over-the-air updates for React Native apps. It consists of native implementations for iOS (Objective-C), Android (Java), and Windows (C++), unified through a JavaScript bridge layer.
Expand Down Expand Up @@ -46,31 +44,20 @@ React Native CodePush is a native module that enables over-the-air updates for R

### Testing Framework
- **Custom Test Runner**: TypeScript-based test framework in `test/`
- **Emulator Management**: Automated setup and teardown of test environments
- **Real App Testing**: Creates actual React Native apps for integration testing
- **Scenario Testing**: Update, rollback, and error scenarios
- **Templates**: `test/template/` holds native files (Podfile, AppDelegate, Android app files) and JS scenarios copied over top of a freshly generated RN/Expo app during test setup, overwriting its defaults — edit files here, not the generated project, for changes to persist
- **`test:ios` vs `test:setup:ios` vs `test:fast:ios`**: `test:ios` is just `test:setup:ios` followed by `test:fast:ios` — the two are meant to be split apart for local iteration.
- `test:setup:ios` (mocha `--ios --setup`) boots the simulator and provisions the test app once: copies templates, runs `pod install`, patches Info.plist/AppDelegate. It never builds or runs any test scenario.
- `test:fast:ios` (mocha `--ios`) skips provisioning and goes straight to the actual test scenarios: its `before()` hook calls `RNIOS.buildApp` (`xcodebuild` against the already-provisioned `.xcworkspace`) and installs the binary, then runs the update/rollback/error scenarios.
- For the fast local loop: run `test:setup:ios` once per template/dependency change, then re-run `test:fast:ios` repeatedly while iterating on test/scenario code — this skips `pod install` and re-provisioning on every iteration.
- There's still no "just build, no tests" npm script — for a raw build only, lift the `xcodebuild` invocation out of `RNIOS.buildApp` in `test/test.ts` and run it by hand against the provisioned `TestCodePush.xcworkspace`.
- When debugging a CI failure, don't trust the first plausible-looking theory from log noise — reproduce the exact failing command locally on matching hardware/toolchain before writing up a root cause. This is faster than iterating against multi-hour CI runs and catches wrong hypotheses early.
- Before running `npm run test:setup:ios`, shut down all booted simulators (`xcrun simctl shutdown all`) — the test framework's simulator picker hangs silently (no error) if simulators are already booted outside it.
- `npm run test:setup:ios` provisions a full test app outside the repo (under a system temp/`test-run` dir), not inside `test/` — expect to search for it rather than finding it checked into the repo tree.
- The provisioned test app's `node_modules/@code-push-next/react-native-code-push` is a real copy, not a symlink — editing `ios/` (or `android/`) native source in the repo has zero effect on `test:fast:ios` runs until you re-copy those files into that `node_modules` path (or rerun `test:setup:ios`).

### Build Integration
- **Android Gradle Plugin**: Automatically generates bundle hashes and processes assets
- **iOS CocoaPods**: Manages native dependencies and build configuration
- **Bundle Processing**: Automated zip creation and hash calculation for OTA updates

## Development Workflow

1. **Making Changes**: Edit native code or JavaScript bridge
2. **Testing**: Run platform-specific tests with real emulators
3. **Integration**: Test with actual React Native apps via test framework
4. **Validation**: Ensure compatibility with both RN architectures

## Key Files
- `CodePush.js` - Main JavaScript API
- `test/TestRunner.ts` - Test framework entry point
- `android/build.gradle` - Android build configuration
- `ios/CodePush.podspec` - iOS CocoaPods specification
- `plugin.xml` - Cordova plugin configuration

## Special Considerations
- Native module requires platform-specific knowledge (iOS/Android/Windows)
- Testing requires emulator setup and can be time-intensive
- Updates must be backward compatible with existing app installations
- Bundle hash calculation is critical for update integrity
13 changes: 2 additions & 11 deletions ios/CodePush/CodePush.m
Original file line number Diff line number Diff line change
Expand Up @@ -538,19 +538,10 @@ - (void)loadBundle
// file (since Chrome wouldn't support it). Otherwise, update
// the current bundle URL to point at the latest update
if ([CodePush isUsingTestConfiguration] || ![super.bridge.bundleURL.scheme hasPrefix:@"http"]) {
RCTReloadCommandSetBundleURL([CodePush bundleURL]);
// [super.bridge setValue:[CodePush bundleURL] forKey:@"bundleURL"];
[super.bridge setValue:[CodePush bundleURL] forKey:@"bundleURL"];
}

// Add a small delay to ensure Fabric surface initialization is complete
// before triggering reload. This fixes a race condition in React Native 0.82+
// with New Architecture where RCTInstance invalidate and RCTFabricSurface start
// can run concurrently, causing a crash when MountingCoordinator's mutex is accessed
// after being destroyed.
//
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
RCTTriggerReloadCommandListeners(@"react-native-code-push: Restart");
});
RCTTriggerReloadCommandListeners(@"react-native-code-push: Restart");
});
}

Expand Down
4 changes: 4 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[tools]
node = "22"
java = "17"
ruby = "4.0"
Loading
Loading