mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-04-20 14:58:35 -04:00
108 lines
3.3 KiB
YAML
108 lines
3.3 KiB
YAML
name: e2e-Android
|
|
on:
|
|
pull_request:
|
|
|
|
jobs:
|
|
deduplicate:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: fkirc/skip-duplicate-actions@master
|
|
with:
|
|
github_token: ${{ github.token }}
|
|
cancel_others: true
|
|
|
|
test:
|
|
needs: deduplicate
|
|
runs-on: macos-latest
|
|
# Kill the task if not finished after 60 minutes
|
|
timeout-minutes: 60
|
|
|
|
steps:
|
|
- name: Check out Git repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Install Node.js, NPM and Yarn
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
|
|
- name: Download Android Emulator Image
|
|
run: |
|
|
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install "system-images;android-28;default;x86"
|
|
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd --force --name Pixel_5_API_31_AOSP --device "Nexus 5X" -k 'system-images;android-28;default;x86'
|
|
$ANDROID_HOME/emulator/emulator -list-avds
|
|
|
|
## configure cash for gradle : will help to reduce build time
|
|
- name: Cache Gradle Wrapper
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.gradle/wrapper
|
|
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
|
|
|
|
- name: Cache Gradle Dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.gradle/caches
|
|
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gradle-caches-
|
|
|
|
- name: Cache node modules
|
|
uses: actions/cache@v3
|
|
id: cache
|
|
with:
|
|
path: node_modules
|
|
key: node-modules-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Rebuild detox from cache
|
|
if: steps.cache.outputs.cache-hit == 'true'
|
|
run: npx detox clean-framework-cache && npx detox build-framework-cache
|
|
|
|
- name: Install Dependencies
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: npm install --legacy-peer-deps
|
|
|
|
- name: Secret files dummy
|
|
run: cp env.example .env
|
|
- name: Secret files dummy 2
|
|
run: cp android/example-keystore.properties android/keystore.properties
|
|
|
|
- name: Set up JDK 11
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: '11'
|
|
distribution: 'zulu'
|
|
|
|
- name: Build for detox
|
|
run: npm run e2e:build:android
|
|
|
|
- name: Android Emulator
|
|
timeout-minutes: 10
|
|
continue-on-error: true
|
|
run: |
|
|
echo "Starting emulator"
|
|
nohup $ANDROID_HOME/emulator/emulator -avd Pixel_5_API_31_AOSP -no-audio -no-snapshot -no-window &
|
|
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
|
|
$ANDROID_HOME/platform-tools/adb devices
|
|
echo "Emulator started"
|
|
|
|
- name: Reverse ADB
|
|
run: adb reverse tcp:8081 tcp:8081
|
|
|
|
- name: Android Detox
|
|
run: npm start & npm run e2e:test:android -- --cleanup --debug-synchronization 200
|
|
|
|
notify:
|
|
name: Notify Slack
|
|
needs: test
|
|
if: ${{ success() || failure() }}
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: iRoachie/slack-github-actions@v2.3.0
|
|
if: env.SLACK_WEBHOOK_URL != null
|
|
env:
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BUILDS_WEBHOOK_URL }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|