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
62 changes: 50 additions & 12 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ on:
pull_request:
branches: [ master ]

# Global envs
# env:
# ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/x.x.x
# ANDROID_NDK_ROOT: /usr/local/lib/android/sdk/ndk/x.x.x
# ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/25.0.8221429
# ANDROID_NDK_ROOT: /usr/local/lib/android/sdk/ndk/25.0.8221429

# TODO: Avoid brutally editing/setting ndk.dir in local.properties

Expand All @@ -25,7 +24,9 @@ jobs:

runs-on: ubuntu-latest

# Local job envs
# env:
# ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/25.0.8221429
# ANDROID_NDK_ROOT: /usr/local/lib/android/sdk/ndk/25.0.8221429

steps:

Expand All @@ -38,35 +39,72 @@ jobs:
distribution: temurin
cache: 'gradle'

- name: Debug info
run: npx react-native info

# (Standalone toolchains obsolete)
# Ubuntu 20.04: r21e, r22, r23b, Custom: r24+
- name: Set up NDK 25 Beta 2
uses: nttld/[email protected]
with:
ndk-version: r25-beta2
# - name: Set up NDK 25 Beta 2
# uses: nttld/[email protected]
# id: setup-ndk
# with:
# ndk-version: r25-beta2
# # Added to path by default

# - name: Debug info
# run: npx react-native info

# - name: Manually set NDK env vars
# run: |
# export ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/25.0.8221429
# export ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk/25.0.8221429

# - name: Or manually set NDK X env vars
# run: |
# export ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/x.x.x
# export ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk/x.x.x
# - name: Debug info
# run: npx react-native info

- name: Install all project dependencies
run: yarn

# - name: steps.setup-ndk.outputs.ndk-path
# run: | # /opt/hostedtoolcache/ndk/r25-beta2/x64
# echo "${{ steps.setup-ndk.outputs.ndk-path }}"

# - name: /usr/local/lib/android/sdk/ndk
# run: |
# cd /usr/local/lib/android/sdk/ndk
# ls

# - name: /opt/hostedtoolcache/ndk
# run: |
# cd "${{ steps.setup-ndk.outputs.ndk-path }}"
# cd ..
# cd ..
# ls

# - name: cp -rf /opt/hostedtoolcache/ndk/r25-beta2/x64 /usr/local/lib/android/sdk/ndk-bundle
# run: |
# cp -rf /opt/hostedtoolcache/ndk/r25-beta2/x64 /usr/local/lib/android/sdk/ndk-bundle

# Avoid poisoned cache problems
- name: Delete Android build pre-computed outputs
if: always()
uses: gradle/[email protected]
with:
arguments: clean
build-root-directory: android
# env:
# ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
# ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}

- name: Build application Debug APK with Gradle
if: always()
uses: gradle/[email protected]
with:
arguments: assembleDebug
build-root-directory: android

- name: Build application Release APK with Gradle
if: always()
uses: gradle/[email protected]
with:
arguments: assembleRelease
Expand Down
15 changes: 1 addition & 14 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,7 @@ buildscript {
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31

if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24+ which added support for aarch64
ndkVersion = "25.0.8221429 rc2"
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
// For Android Users, we need to use NDK 23, otherwise the build will
// fail due to paths longer than the OS limit
ndkVersion = "23.1.7779620"
} else {
// Otherwise we default to the side-by-side NDK version from AGP.
ndkVersion = "21.4.7075529"
}
// Also create/update android/local.properties ndk.dir=/Users/<user>/Library/Android/sdk/ndk/<ver>
// Some versions like 24.0.7956693-beta2 not listed in Android Studio Preview
ndkVersion = "23.1.7779620"
}
repositories {
google()
Expand Down