Skip to content

Merge branch 'main' of https://github.com/inaturalist/iNaturalistAndroid #420

Merge branch 'main' of https://github.com/inaturalist/iNaturalistAndroid

Merge branch 'main' of https://github.com/inaturalist/iNaturalistAndroid #420

Workflow file for this run

name: CI
on:
push:
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
name: Instrumented Tests, SDK ${{ matrix.api-level }}
runs-on: macos-11
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
steps:
- name: Checkout
uses: actions/checkout@v3
# Cache steps all from the example at https://github.com/ReactiveCircus/android-emulator-runner
- name: Gradle cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-20220105-1
- 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 }}
force-avd-creation: true
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
target: google_apis
ndk: 22.1.7171670
# 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."
- 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
cp iNaturalist/google-services.example.json iNaturalist/google-services.json
- name: Run instrumented tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
target: google_apis
ndk: 22.1.7171670
script: ./gradlew connectedCheck -x :smoothrescale:connectedDebugAndroidTest
notify:
name: Notify Slack
needs: test
if: ${{ success() || failure() }}
runs-on: ubuntu-22.04
steps:
- uses: iRoachie/[email protected]
if: env.SLACK_WEBHOOK_URL != null
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BUILDS_WEBHOOK_URL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}