Skip to content

Commit

Permalink
Pinning NDK and use --active-arch-only on Android (#4910)
Browse files Browse the repository at this point in the history
* Pinning NDK and use --active-arch-only on Android

* Adding a note to the changelog
  • Loading branch information
kraenhansen authored Sep 14, 2022
1 parent a7c8c9f commit 5d1c8de
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/pr-realm-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
env:
npm_config_realm_local_prebuilds: ${{github.workspace}}/prebuilds
REALM_DISABLE_ANALYTICS: 1
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/21.4.7075529
NDK_VERSION: 21.0.6113669
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -94,6 +94,21 @@ jobs:
if: ${{ (matrix.variant.runner == 'ubuntu-latest') }}
run: sudo apt-get install ccache ninja-build

- name: Setup Java
if: ${{ matrix.variant.os == 'android' }}
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '11'

- name: Setup Android SDK
if: ${{ matrix.variant.os == 'android' }}
uses: android-actions/setup-android@v2

- name: Install NDK
if: ${{ matrix.variant.os == 'android' }}
run: sdkmanager --install "ndk;${{ env.NDK_VERSION }}"

- name: ccache
uses: hendrikmuhs/ccache-action@v1
#TODO: figure out using ccache or equivalent on windows
Expand Down Expand Up @@ -130,6 +145,8 @@ jobs:
- name: Build Android
if: ${{ (matrix.variant.os == 'android') }}
run: npm run prebuild:android -- --arch=${{matrix.variant.arch}}
env:
ANDROID_NDK: ${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.NDK_VERSION }}

- name: Install the node dependencies in the test folder
working-directory: ./tests
Expand Down Expand Up @@ -157,7 +174,6 @@ jobs:
SPAWN_LOGCAT: true
# Pin the Xcode version
DEVELOPER_DIR: /Applications/Xcode_12.5.1.app
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/21.4.7075529
runs-on: ${{ matrix.variant.runner }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -309,7 +325,7 @@ jobs:
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
arch: x86
ndk: 21.0.6113669
ndk: ${{ env.NDK_VERSION }}
cmake: 3.10.2.4988404
script: npm run ${{ matrix.variant.target}} --prefix integration-tests/environments/${{ matrix.variant.environment }}

Expand Down
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
* None.

### Fixed
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?)
* None.
* Fixed pinning of the NDK used to build our prebuilt binaries for Android. Our previous version, Realm JS v10.21.0 was compiled with NDK 25.1.8937393, which could result in unpredictable crashes, since this needs to match the one being used by React Native. ((#4910)[https://github.com/realm/realm-js/pull/4910], since v10.21.0)

### Compatibility
* React Native >= v0.64.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ async function run(headless, spawnLogcat, retries, retryDelay) {
logcat.start("com.realmreactnativetests", true).catch(console.error);
}
// Ask React Native to build and run the app
rn.sync("run-android", "--no-packager");
// Using --active-arch-only as per https://reactnative.dev/docs/build-speed#build-only-one-abi-during-development-android-only
rn.sync("run-android", "--no-packager", "--active-arch-only");
} else if (PLATFORM === "ios") {
// Ask React Native to build and run the app
rn.sync("run-ios", "--no-packager", "--simulator", IOS_DEVICE_NAME);
Expand Down

0 comments on commit 5d1c8de

Please sign in to comment.