Skip to content

Commit

Permalink
Update SDKs tested by CI/CD
Browse files Browse the repository at this point in the history
Android 34 is latest public, 33 is iNat target version. 23 continues to be iNat min version.

Also fixed:
 - Use x86 or x86_64 arch based on what emulator images are actually available. Tagged cache with sdk-arch naming
 - Updated emulator build from a mid-2021 build to latest (we were working around
emulator boot issues (see ReactiveCircus/android-emulator-runner#160
for details). Newest emulator boots fine with all SDK versions
 - Updated host VM to Mac 12 from 11. Also allows us to tap into more hardware cores
  • Loading branch information
hamiltont committed Dec 27, 2023
1 parent b960e36 commit 280c998
Showing 1 changed file with 37 additions and 13 deletions.
50 changes: 37 additions & 13 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ on:
jobs:
test:
name: Instrumented Tests, SDK ${{ matrix.api-level }}
runs-on: macos-11
runs-on: macos-12
strategy:
matrix:
api-level:
- 23 # Android 5, minSdkVersion
- 27 # Android 8, has caused problems in the past
# SDK 29 causes frequent problems with the emulator, not sure why.
# Hoping SDK 30 is close enough
# - 29 # Android 10, targetSdkVersion
- 30 # Android 11, latest public release
- 33 # Android 10, targetSdkVersion
# Fails currently, need to debug before we can upgrade
# - 34 # Android 14, latest public release
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -31,31 +30,46 @@ jobs:
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}

# You can use sdkmanager --list to locate available packages.
# In our case, API=27 with google_apis is only available with x86, but
# later APIs (33,34) do not have x86
- name: Set AVD Architecture Based on API Level
if: steps.avd-cache.outputs.cache-hit != 'true'
run: echo "ARCH=$(if [ ${{ matrix.api-level }} -eq 27 ]; then echo 'x86'; else echo 'x86_64'; fi)" >> $GITHUB_ENV

- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-20220105-1
key: avd-${{ matrix.api-level }}-${{ env.ARCH }}-20231227

- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: ${{ env.ARCH }}
cores: 3
force-avd-creation: true
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -grpc 8554 -verbose -timezone America/New_York
disable-animations: true
target: google_apis
ndk: 26.1.10909125
# I think this might be a quick fix for intermittent build failures waiting for the emaultor to boot
emulator-build: 7425822
script: echo "Generated AVD snapshot for caching."
script: |
cat /Users/runner/.android/avd/test.avd/config.ini
cat /Users/runner/.android/avd/test.avd/hardware-qemu.ini
/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop
/Users/runner/Library/Android/sdk/platform-tools/adb shell df
/Users/runner/Library/Android/sdk/platform-tools/adb shell cat /proc/meminfo
echo "Generated AVD snapshot for caching."
- name: Set Java 11
run: |
echo "JAVA_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
- name: Copy iNat config files
run: |
sed -E 's/<!-- *</</' iNaturalist/src/main/res/values/config.example.xml | sed -E 's/> *-->/>/' > iNaturalist/src/main/res/values/config.xml
Expand All @@ -65,15 +79,25 @@ jobs:
run: ./gradlew :smoothrescale:assembleDebug

- name: Run instrumented tests
continue-on-error: true
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: ${{ env.ARCH }}
cores: 3
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -grpc 8554 -verbose -timezone America/New_York
disable-animations: true
target: google_apis
ndk: 26.1.10909125
script: ./gradlew connectedCheck
script: |
cat /Users/runner/.android/avd/test.avd/config.ini
cat /Users/runner/.android/avd/test.avd/hardware-qemu.ini
/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop
/Users/runner/Library/Android/sdk/platform-tools/adb shell df
/Users/runner/Library/Android/sdk/platform-tools/adb shell cat /proc/meminfo
./gradlew connectedCheck
notify:
name: Notify Slack
needs: test
Expand Down

0 comments on commit 280c998

Please sign in to comment.