Update dependency upgrades - non-major #915
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Detox Integration Tests - Android | |
on: [push] | |
jobs: | |
build: | |
name: Detox Integration Tests - Android | |
runs-on: macos-13 | |
timeout-minutes: 45 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 'latest' | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
# Sharp CLI enables faster image generation during prebuild | |
# https://github.com/expo/expo-cli/issues/2676 | |
- name: Install Sharp CLI for faster image generation during prebuild | |
run: npm install --global sharp-cli | |
- name: Prepare files for gradlew command | |
run: pnpm expo prebuild --platform android | |
# Use Kotlin version 1.6.0 instead of 1.4.21, | |
# which is normally specified in android/build.gradle | |
# https://github.com/expo/expo/issues/16907#issuecomment-1088809249 | |
- name: Upgrade Kotlin version | |
run: sed -i'' -e $'s/kotlinVersion = "1.4.21"/kotlinVersion = "1.6.0"/g' android/build.gradle | |
# Set up Detox as compiling dependency as | |
# temporary workaround for React Native 0.68 | |
# https://wix.github.io/Detox/docs/introduction/android/#setting-detox-up-as-a-compiling-dependency | |
# https://github.com/wix/Detox/issues/3344#issuecomment-1111197955 | |
- name: Set up Detox as compiling dependency for React Native 0.68 | |
run: | | |
sed -i'' -e $'s/rootProject.name = \'hotline-bling-codealong\'/rootProject.name = \'hotline-bling-codealong\'\\\ninclude \':detox\'\\\nproject(\':detox\').projectDir = new File(rootProject.projectDir, \'..\/node_modules\/detox\/android\/detox\')/' android/settings.gradle | |
sed -i'' -e $'s/\'com.wix:detox:+\'/project(path: ":detox")/' android/app/build.gradle | |
sed -i'' -e $'s/defaultConfig {/defaultConfig {\\\n testBuildType System.getProperty("testBuildType", "debug")\\\n testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"\\\n missingDimensionStrategy "detox", "full"/' android/app/build.gradle | |
- name: Install Java JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Build Android app locally with gradlew | |
run: pnpm detox build --configuration android | |
- name: Cache AVD snapshot | |
uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-30-aosp-atd | |
- name: Create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
# Use the slimmer aosp_atd images for working | |
# around "System UI isn't responding" ANR | |
# (Application Not Responding) error | |
# | |
# https://android-developers.googleblog.com/2021/10/whats-new-in-scalable-automated-testing.html#:~:text=Slimmer%20Emulator%20System%20Images | |
# https://github.com/ReactiveCircus/android-emulator-runner/issues/129 | |
# https://github.com/upleveled/hotline-bling-codealong/pull/26#issuecomment-1094659722 | |
target: aosp_atd | |
api-level: 30 | |
arch: x86 | |
ram-size: 4096M | |
channel: canary | |
profile: pixel | |
avd-name: Pixel_3a_API_30_AOSP | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
emulator-boot-timeout: 12000 | |
disable-animations: false | |
script: echo "Generated AVD snapshot for caching" | |
- name: Start emulator and run Detox integration tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
target: aosp_atd | |
api-level: 30 | |
arch: x86 | |
ram-size: 4096M | |
channel: canary | |
profile: pixel | |
avd-name: Pixel_3a_API_30_AOSP | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
emulator-boot-timeout: 12000 | |
disable-animations: true | |
script: pnpm detox test --configuration android | |
- name: Store Detox artifacts on test failure | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: detox-artifacts | |
path: .detoxArtifacts |