@@ -18,37 +18,26 @@ checkout step for each job: &addWorkspace
1818default config for js : &js_defaults
1919 << : *defaults
2020 docker :
21- - image : circleci /node:14
21+ - image : cimg /node:14.18.1
2222
2323default config for macOS : &macos_defaults
2424 << : *defaults
2525 resource_class : ' medium'
2626 macos :
27- xcode : ' 13.2.1 '
27+ xcode : ' 13.1.0 '
2828
29- config for macOS ( android) : &macos_defaults_android
29+ default config for android apk tests : &android_defaults
3030 << : *defaults
31- resource_class : ' medium'
32- macos :
33- xcode : ' 11.5.0'
34-
35- default config for android apk builds : &android_defaults
36- << : *defaults
37- docker :
38- - image : reactnativecommunity/react-native-android
39- resource_class : ' medium'
40- working_directory : ~/async_storage
41- environment :
42- - _JAVA_OPTIONS : ' -XX:+UnlockExperimentalVMOptions -Xmx2048m'
43- - BUILD_THREADS : 2
31+ resource_class : large
32+ machine :
33+ image : android:2022.06.2
4434
4535# ==============================
4636# CACHE CONFIG
4737# ==============================
4838
4939cache keys :
5040 brew ios : &key_brew_ios cache-brew-ios-v5-{{ arch }}
51- brew android : &key_brew_android cache-brew-android-v4-{{ arch }}
5241 yarn : &key_yarn cache-yarn-{{ checksum "package.json" }}-{{ arch }}
5342 gradle : &key_gradle cache-gradle-v2-{{ checksum "example/android/gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "package.json" }}-{{ arch }}
5443 pods : &key_pods cache-pods-v0.64-{{ checksum "example/ios/Podfile" }}-{{ checksum "package.json" }}-{{ arch }}
@@ -66,17 +55,6 @@ cache:
6655 keys :
6756 - *key_brew_ios
6857
69- save brew cache for android : &cache_save_brew_android
70- name : Saving Brew cache for android
71- paths :
72- - ~/Library/Caches/Homebrew
73- key : *key_brew_android
74-
75- restore brew cache for android : &cache_restore_brew_android
76- name : Restoring Brew cache for android
77- keys :
78- - *key_brew_android
79-
8058 # yarn
8159 save yarn cache : &cache_save_yarn
8260 name : Saving Yarn cache
@@ -209,10 +187,24 @@ jobs:
209187 name : Run e2e tests
210188 command : yarn test:e2e:ios
211189
212- " Build : Android release apk " :
190+ " Test : Android e2e " :
213191 << : *android_defaults
214192 steps :
215193 - *addWorkspace
194+ - run :
195+ name : " Install node v14.18.1 and yarn 1.22.17"
196+ command : |
197+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
198+ source ~/.bashrc
199+ nvm install v14.18.1
200+ node -v
201+ npm install --global yarn@1.22.17
202+ yarn -v
203+ - restore_cache : *cache_restore_yarn
204+ - run :
205+ name : Install dependencies
206+ command : yarn --pure-lockfile --non-interactive --cache-folder ~/.cache/yarn
207+ - save_cache : *cache_save_yarn
216208 - run :
217209 name : Bundle JS
218210 command : yarn bundle:android --dev false
@@ -223,77 +215,31 @@ jobs:
223215 name : Build APK with Next storage
224216 working_directory : example/android
225217 command : ./gradlew assembleNext --max-workers 2
226- - persist_to_workspace :
227- root : ~/async_storage
228- paths :
229- - example/android/app/build/outputs/apk/*
230-
231- " Test: Android e2e " :
232- << : *macos_defaults_android
233- steps :
234- - *addWorkspace
235218 - run :
236- name : Configure env variables
219+ name : Configure Environment Variables
237220 command : |
238- echo 'export ANDROID_HOME="/usr/local/share/android-sdk"' >> $BASH_ENV
239- echo 'export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"' >> $BASH_ENV
240- echo 'export PATH="$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH"' >> $BASH_ENV
241221 echo 'export QEMU_AUDIO_DRV=none' >> $BASH_ENV
242- echo 'export JAVA_HOME=$(/usr/libexec/java_home) ' >> $BASH_ENV
222+ echo 'export PATH="$PATH:~/async_storage/node_modules/.bin" ' >> $BASH_ENV
243223 source $BASH_ENV
244- - restore-cache : *cache_restore_brew_android
245- - run :
246- name : Install Android SDK tools
247- command : |
248- brew update --preinstall
249- brew bundle --file=.circleci/Brewfile.android --no-lock
250- - save-cache : *cache_save_brew_android
251224 - run :
252- name : Install Android emulator
253- shell : /bin/bash -e
225+ name : Install Android system image
254226 command : |
255- yes | sdkmanager "platform-tools" "tools" 1> /dev/null
256- yes | sdkmanager "platforms;android-28" "system-images;android-28;default;x86_64" 1> /dev/null
257- yes | sdkmanager "emulator" --channel=3 1> /dev/null
258- yes | sdkmanager "build-tools;28.0.3" 1> /dev/null
259- yes | sdkmanager --licenses 1> /dev/null
260- yes | sdkmanager --list
227+ sdkmanager "system-images;android-30;default;x86_64"
261228 - run :
262- name : ADB start/stop
229+ name : " Create Android emulator "
263230 command : |
264- adb start-server
265- adb devices
266- adb kill-server
267- ls -la ~/.android
231+ avdmanager create avd -n E2E_API_30 -d pixel_4 --package "system-images;android-30;default;x86_64"
268232 - run :
269- name : Create emulator
233+ name : Launch emulator
270234 command : |
271- avdmanager create avd --force \
272- -n "Emu_E2E" \
273- -k "system-images;android-28;default;x86_64" \
274- -g "default" \
275- -d "pixel"
276- - run :
277- name : Start emulator in background
235+ emulator -avd E2E_API_30 -delay-adb -verbose -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
278236 background : true
279- command : |
280- emulator -avd "Emu_E2E" \
281- -cores 1 \
282- -gpu auto \
283- -accel on \
284- -memory 1024 \
285- -no-audio \
286- -no-snapshot \
287- -no-boot-anim \
288- -no-window \
289- -logcat '*:E ReactNative:W ReactNativeJS:*'
237+ - run :
238+ name : " Make sure TestButler apk is present"
239+ command : ./scripts/android_e2e.sh 'install_test_butler'
290240 - run :
291241 name : Wait for emulator to boot
292242 command : ./scripts/android_e2e.sh 'wait_for_emulator'
293- - run :
294- name : Wake device
295- command : |
296- adb shell input keyevent 82
297243 - run :
298244 name : Run e2e tests
299245 command : yarn test:e2e:android
@@ -333,14 +279,11 @@ workflows:
333279 requires :
334280 - " Test: lint"
335281 - " Test: TypeScript"
336- - " Build : Android release apk " :
282+ - " Test : Android e2e " :
337283 requires :
338284 - " Test: lint"
339285 - " Test: TypeScript"
340286 - " Test: Android unit"
341- - " Test: Android e2e " :
342- requires :
343- - " Build: Android release apk"
344287 - " Release " :
345288 requires :
346289 - " Test: iOS e2e"
0 commit comments