chore: android sdk check #1
Workflow file for this run
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: Test Android | ||
on: | ||
workflow_call: | ||
inputs: | ||
android-version: | ||
required: false | ||
default: 33 | ||
type: number | ||
react-native-version: | ||
required: false | ||
default: '0.71.14' | ||
type: string | ||
jobs: | ||
test-Android: | ||
runs-on: macos-14 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.node-version }} | ||
cache: 'yarn' | ||
- uses: actions/cache/restore@v4 | ||
with: | ||
path: lib | ||
key: temp-lib-${{ github.sha }} | ||
- uses: actions/cache/restore@v4 | ||
id: yarn-cache | ||
with: | ||
path: example\node_modules | ||
key: temp-node-${{ github.sha }} | ||
- name: Build dependency if needed | ||
if: steps.yarn-cache.outputs.cache-hit != 'true' | ||
run: yarn | ||
- name: Gradle cache | ||
uses: gradle/gradle-build-action@v3 | ||
- name: AVD cache | ||
uses: actions/cache@v4 | ||
id: avd-cache | ||
with: | ||
path: | | ||
~/.android/avd/* | ||
~/.android/adb* | ||
key: avd-${{ inputs.android-version }} | ||
- 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: ${{ inputs.android-version }} | ||
force-avd-creation: false | ||
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: false | ||
script: | | ||
sdkmanager --list | ||
echo "Generated AVD snapshot for caching." | ||
- name: Run tests | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: ${{ inputs.android-version }} | ||
force-avd-creation: false | ||
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: true | ||
working-directory: ./example/android | ||
script: | | ||
echo "::group::Running Android app" | ||
yarn android | ||
echo "::endgroup::" | ||
echo "::group::Running Tests" | ||
./gradlew jacocoTestReport | ||
echo "::endgroup::" | ||
- name: Prepare Jacoco report | ||
run: | | ||
mkdir reports | ||
mv $(find . -name 'jacocoTestReport.xml') reports/jacoco.xml | ||
- name: Archive Coverage report | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: kotlin-coverage-report | ||
path: reports |