Skip to content

Commit

Permalink
android e2e clean up (#5970)
Browse files Browse the repository at this point in the history
* init

zsh:1: command not found: :q

* change

* changes

* clean up

* new cloud package commit

* package bump

* oops

* skip

* skip test

* rm redundancies

* oop

* bruno change
  • Loading branch information
BrodyHughes authored Aug 27, 2024
1 parent c9f8d60 commit b13d453
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 69 deletions.
94 changes: 60 additions & 34 deletions .github/workflows/macstadium-android-e2e.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,82 @@
# This is a basic workflow to help you get started with Actions

name: Android e2e tests

# Controls when the workflow will run
on: [pull_request, workflow_dispatch]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
on: []
jobs:
# This workflow contains a single job called "android-e2e"
android-e2e:
if: startsWith(github.head_ref, 'android-ci')
# The type of runner that the job will run on
runs-on: ["self-hosted", "ci-5"]
# Cancel current builds if there's a newer commit on the same branch
concurrency:
runs-on: ["self-hosted"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Steps represent a sequence of tasks that will be executed as part of the job
permissions:
contents: read

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up github keys
run: git config core.sshCommand "ssh -i ~/.ssh/id_ed25519 -F /dev/null"

- name: Clean Android app
run: yarn clean:android > /dev/null 2>&1 || true

- name: Set up ENV vars & scripts
env:
CI_SCRIPTS_RN_UPGRADE: ${{ secrets.CI_SCRIPTS_RN_UPGRADE }}
run: |
# read local env vars
source ~/.bashrc
# fetch env vars
source ~/.zshrc
git clone [email protected]:rainbow-me/rainbow-env.git
# unpack dotenv
mv rainbow-env/android/app/google-services.json android/app
mv rainbow-env/dotenv .env && rm -rf rainbow-env
# run CI scripts
eval $CI_SCRIPTS
# tweak dotenv for e2e
sed -i''-e "s/\IS_TESTING=false/IS_TESTING=true/" .env && rm -f .env-e
# set up password
cp android/keystores/debug.keystore android/keystores/rainbow-key.keystore
sed -i -e "s:rainbow-alias:androiddebugkey:g" android/app/build.gradle
export RAINBOW_KEY_ANDROID_PASSWORD=android
- name: Install deps via Yarn
run: yarn setup-ci
eval $CI_SCRIPTS_RN_UPGRADE
sed -i'' -e "s/IS_TESTING=false/IS_TESTING=true/" .env && rm -f .env-e
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
.yarn/cache
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: |
yarn cache clean --all && yarn install && yarn setup
- name: Check for frozen lockfile
run: ./scripts/check-lockfile.sh

- name: Audit CI
run: yarn audit-ci --config audit-ci.jsonc

- name: Lint
run: yarn lint:ci

- name: Unit tests
run: yarn test

- name: Rebuild detox cache
run: ./node_modules/.bin/detox clean-framework-cache && ./node_modules/.bin/detox build-framework-cache

- name: Version debug
run: |
npx react-native info
- name: Build the app in Release mode
run: ./node_modules/.bin/detox build --configuration android.emu.release
- name: Fix permissions
run: |
chmod -R +x node_modules/react-native/scripts
chmod -R +x node_modules/@sentry/react-native/scripts
- name: Run Android e2e tests
run: ./node_modules/.bin/detox test -R 5 --configuration android.emu.release --forceExit
- name: Build the app in Release mode
run: yarn detox build --configuration android.emu.release

# change the '3' here to how many times you want the tests to rerun on failure
- name: Run iOS e2e tests with retry
run: ./scripts/run-retry-tests.sh 3
41 changes: 19 additions & 22 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ apply plugin: "org.jetbrains.kotlin.android"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'


def getPassword(String currentUser, String keyChain) {
def stdout = new ByteArrayOutputStream()
def stderr = new ByteArrayOutputStream()
Expand All @@ -30,15 +29,9 @@ def getPassword(String currentUser, String keyChain) {
stdout.toString().trim()
}


import com.android.build.OutputFile



apply plugin: "com.facebook.react"



apply from: "../../node_modules/@sentry/react-native/sentry.gradle"

react {
Expand Down Expand Up @@ -114,11 +107,9 @@ def enableProguardInReleaseBuilds = false
*/
def jscFlavor = 'org.webkit:android-jsc:+'



android {
def envFile = project.file('../../.env')
def env =[:]
def env = [:]
envFile.eachLine {
if (it.contains('=') && (!it.startsWith("#"))) {
def (key, value) = it.split('=')
Expand All @@ -145,19 +136,19 @@ android {
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
multiDexEnabled true
testBuildType System.getProperty('testBuildType', 'debug') // This will later be used to control the test apk build type
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy 'detox', 'full'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'

manifestPlaceholders = [
BRANCH_KEY: env.get('BRANCH_KEY')
]
BRANCH_KEY: env.get('BRANCH_KEY')
]

ndk {
abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
}


signingConfigs {
debug {
storeFile file('../keystores/debug.keystore')
Expand Down Expand Up @@ -187,7 +178,7 @@ android {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
// Detox-specific additions to pro-guard
//proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
}
}

Expand All @@ -199,8 +190,17 @@ android {
pickFirst '**/x86_64/libc++_shared.so'
pickFirst '**/x86/libjsc.so'
pickFirst '**/armeabi-v7a/libjsc.so'
// exclude
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude("META-INF/*.kotlin_module")
}

}

dependencies {
Expand Down Expand Up @@ -229,8 +229,8 @@ dependencies {
}

// DETOX
//androidTestImplementation('com.wix:detox:+')

androidTestImplementation('com.wix:detox:+') { transitive = true }
androidTestImplementation(project(path: ":detox"))
}

// Run this once to be able to run the application with BUCK
Expand All @@ -241,6 +241,3 @@ task copyDownloadableDepsToLibs(type: Copy) {
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)



4 changes: 3 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ buildscript {
url 'https://maven.fabric.io/public'
}
mavenCentral()
maven {
url("${rootProject.projectDir}/../node_modules/detox/Detox-android")
}
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
// classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22"
classpath("de.undercouch:gradle-download-task:5.0.1")
classpath 'com.google.gms:google-services:4.3.15'
Expand Down
4 changes: 2 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ project(':react-native-palette-full').projectDir = new File(rootProject.projectD
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'

/*include ':detox'
include ':detox'
project(':detox').projectDir = new File(rootProject.projectDir, '../node_modules/detox/android/detox')
*/

includeBuild('../node_modules/@react-native/gradle-plugin')
6 changes: 3 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ PODS:
- Yoga
- react-native-change-icon (4.0.0):
- React-Core
- react-native-cloud-fs (2.6.1):
- react-native-cloud-fs (2.6.2):
- React
- react-native-compat (2.11.2):
- DoubleConversion
Expand Down Expand Up @@ -2321,7 +2321,7 @@ SPEC CHECKSUMS:
react-native-branch: 960c897d57b9f4912b08b9d06a25284b6e9879da
react-native-cameraroll: b5ce04a1ee4081d7eea921918de979f0b41d8e22
react-native-change-icon: ea9bb7255b09e89f41cbf282df16eade91ab1833
react-native-cloud-fs: e7103d1f693c57b481f820fa5e6b6b0522a5a31e
react-native-cloud-fs: c90379f513b8d7ad5cfed610ccf50f27d837016e
react-native-compat: 0468620f537a51ce0d3f4ba65bda6872240b9a0d
react-native-get-random-values: 1404bd5cc0ab0e287f75ee1c489555688fc65f89
react-native-ios-context-menu: e529171ba760a1af7f2ef0729f5a7f4d226171c5
Expand Down Expand Up @@ -2413,7 +2413,7 @@ SPEC CHECKSUMS:
TOCropViewController: b9b2905938c0424f289ea2d9964993044913fac6
ToolTipMenu: 8ac61aded0fbc4acfe7e84a7d0c9479d15a9a382
VisionCamera: 2af28201c3de77245f8c58b7a5274d5979df70df
Yoga: 88480008ccacea6301ff7bf58726e27a72931c8d
Yoga: 04f1db30bb810187397fa4c37dd1868a27af229c

PODFILE CHECKSUM: 0839e4141c8f26133bf9a961f5ded1ea3127af54

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
"clean:packager": "watchman watch-del-all",
"clean:node": "rm -rf node_modules",
"nuke": "./scripts/nuke.sh",
"detox:android": "detox build -c android.emu.debug && detox test -c android.emu.debug --loglevel verbose",
"detox:android:release": "detox build -c android.emu.release && detox test -c android.emu.release",
"detox:android:tests": "detox test -c android.emu.debug --maxWorkers 2 -- --bail 1",
"detox:android": "detox build -c android.emu.debug && yarn detox:android:tests",
"detox:ios:build": "detox build -c ios.sim.debug | xcpretty --color ",
"detox:ios:tests": "detox test -c ios.sim.debug --maxWorkers 2 -- --bail 1",
"detox:ios": "yarn detox:ios:build && yarn detox:ios:tests",
Expand Down Expand Up @@ -219,7 +220,7 @@
"react-native-branch": "5.3.1",
"react-native-change-icon": "4.0.0",
"react-native-circular-progress": "1.3.8",
"react-native-cloud-fs": "rainbow-me/react-native-cloud-fs#c4ed2d78a7c401f628248a4e45eaf5bf9319a31a",
"react-native-cloud-fs": "rainbow-me/react-native-cloud-fs#9b204615b76cf3d29bd86a9094dbd95d717b6a7a",
"react-native-crypto": "2.2.0",
"react-native-dark-mode": "0.2.2",
"react-native-device-info": "5.3.1",
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8058,7 +8058,7 @@ __metadata:
react-native-branch: "npm:5.3.1"
react-native-change-icon: "npm:4.0.0"
react-native-circular-progress: "npm:1.3.8"
react-native-cloud-fs: "rainbow-me/react-native-cloud-fs#c4ed2d78a7c401f628248a4e45eaf5bf9319a31a"
react-native-cloud-fs: "rainbow-me/react-native-cloud-fs#9b204615b76cf3d29bd86a9094dbd95d717b6a7a"
react-native-crypto: "npm:2.2.0"
react-native-dark-mode: "npm:0.2.2"
react-native-device-info: "npm:5.3.1"
Expand Down Expand Up @@ -20917,10 +20917,10 @@ __metadata:
languageName: node
linkType: hard

"react-native-cloud-fs@rainbow-me/react-native-cloud-fs#c4ed2d78a7c401f628248a4e45eaf5bf9319a31a":
version: 2.6.1
resolution: "react-native-cloud-fs@https://github.com/rainbow-me/react-native-cloud-fs.git#commit=c4ed2d78a7c401f628248a4e45eaf5bf9319a31a"
checksum: 10c0/74fe20b46f13a502176bb4bbc78ea24f5ec35d09c37a9404bc15a16c085d8459c184c948841bd8b0b1e5d649609fec2b8279ea31c18c70b24835609e34bbc253
"react-native-cloud-fs@rainbow-me/react-native-cloud-fs#9b204615b76cf3d29bd86a9094dbd95d717b6a7a":
version: 2.6.2
resolution: "react-native-cloud-fs@https://github.com/rainbow-me/react-native-cloud-fs.git#commit=9b204615b76cf3d29bd86a9094dbd95d717b6a7a"
checksum: 10c0/db1c719b90475201aa1e1177209723598ac38689a827d387dd281ea5190ad09f3e6c8fee77caff70b46a228b6552459d9a9e73e4159c18a29d19d235e17d7907
languageName: node
linkType: hard

Expand Down

0 comments on commit b13d453

Please sign in to comment.