From fb5c52e419e754105393aca82d7505d6e9947773 Mon Sep 17 00:00:00 2001 From: Kirill Zyusko Date: Wed, 27 Nov 2024 11:23:12 +0100 Subject: [PATCH] fix: Android specific CI checks (#706) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 📜 Description These 3 checks may constantly fail due to various reasons - one of them is new releases from RN (0.77.0-rc.0 triggered failures last time). In this PR I'm locking the version for CI jobs for these checks. ## 💡 Motivation and Context I'm tired of random CI failures not related to actual changes that I made in PR. The solution with locking RN version on CI is the most obvious one. I made my changes in a backward compatible way - unless you specify `reactNativeVersion` everything should work as before (and I highly doubt anyone is using such variable name - if needed I can rename it to `keyboardControllerRNVersion` but I don't think it's required). ## 📢 Changelog ### CI - specify RN version in `verify-android` in env; - use env RN version for build, lint and unit-tests jobs. ### Android - added new `reactNativeVersion` gradle variable with default `+` value; - use this variable instead of hardcoded `+`; ## 🤔 How Has This Been Tested? Tested on CI. ## 📸 Screenshots (if appropriate): image ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed --- .github/workflows/verify-android.yml | 9 ++++++--- android/build.gradle | 5 +++-- android/gradle.properties | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/verify-android.yml b/.github/workflows/verify-android.yml index d8822834e..ce38d9e2c 100644 --- a/.github/workflows/verify-android.yml +++ b/.github/workflows/verify-android.yml @@ -1,5 +1,8 @@ name: 📱 Validate Android +env: + REACT_NATIVE_VERSION: 0.76.2 + on: push: branches: @@ -40,7 +43,7 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile --cwd .. - name: Run Gradle Lint - run: ./gradlew lint + run: ./gradlew lint -PreactNativeVersion=${{ env.REACT_NATIVE_VERSION }} android-build: runs-on: ubuntu-latest name: 🏗️ Android Build @@ -57,7 +60,7 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile --cwd .. - name: Run Gradle Assemble - run: ./gradlew assembleDebug + run: ./gradlew assembleDebug -PreactNativeVersion=${{ env.REACT_NATIVE_VERSION }} detekt: runs-on: ubuntu-latest name: 🧬 Run detekt @@ -93,4 +96,4 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile --cwd .. - name: Run Unit Tests - run: ./gradlew testDebugUnitTest + run: ./gradlew testDebugUnitTest -PreactNativeVersion=${{ env.REACT_NATIVE_VERSION }} diff --git a/android/build.gradle b/android/build.gradle index 67215d057..d40d54c33 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -158,14 +158,15 @@ repositories { } def kotlin_version = getExtOrDefault('kotlinVersion') +def reactNativeVersion = getExtOrDefault('reactNativeVersion') dependencies { if (project.ext.shouldConsumeReactNativeFromMavenCentral()) { // noinspection GradleDynamicVersion - implementation 'com.facebook.react:react-android:+' + implementation "com.facebook.react:react-android:$reactNativeVersion" } else { // noinspection GradleDynamicVersion - implementation 'com.facebook.react:react-native:+' + implementation "com.facebook.react:react-native:$reactNativeVersion" } implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'androidx.core:core-ktx:1.5.0-beta03' diff --git a/android/gradle.properties b/android/gradle.properties index caf9b4b7a..f6963f483 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -2,5 +2,6 @@ KeyboardController_kotlinVersion=1.8.22 KeyboardController_compileSdkVersion=33 KeyboardController_targetSdkVersion=33 KeyboardController_minSdkVersion=16 +KeyboardController_reactNativeVersion=+ android.useAndroidX=true