Target specific SDK version (#4) #40
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: Espresso Tests | |
on: | |
workflow_dispatch: | |
inputs: | |
SDK_TARGET_VERSION: | |
description: 'Target a specific SDK version. Otherwise latest' | |
required: false | |
push: | |
jobs: | |
build: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
api-level: [ 32 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: 'adopt' | |
cache: 'gradle' | |
- name: Gradle cache | |
uses: gradle/gradle-build-action@v2 | |
- name: AVD cache | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }} | |
- 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 }} | |
target: google_apis | |
arch: x86_64 | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: echo "Generated AVD snapshot for caching." | |
- name: Create env file | |
env: | |
API_TOKEN: ${{secrets.API_TOKEN}} | |
WORKFLOW_ID: ${{secrets.WORKFLOW_ID}} | |
SDK_TARGET_VERSION: ${{github.event.inputs.SDK_TARGET_VERSION}} | |
run: | | |
mkdir app/src/main/assets | |
cd app/src/main/assets | |
touch env | |
echo API_TOKEN="$API_TOKEN" >> env | |
echo WORKFLOW_ID="$WORKFLOW_ID" >> env | |
- name: run tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: google_apis | |
arch: x86_64 | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: ./gradlew connectedCheck |