77 lines
2.4 KiB
YAML
77 lines
2.4 KiB
YAML
name: Android CI for builds
|
|
|
|
on:
|
|
push:
|
|
branches: [ develop, master ]
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Git repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Fetch Git tags
|
|
run: git fetch --tags
|
|
- name: set up JDK 11
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: 'zulu' # See 'Supported distributions' for available options
|
|
java-version: '11'
|
|
- name: Gradle cache
|
|
uses: gradle/gradle-build-action@v2
|
|
- name: Grant execute permission for gradlew
|
|
run: chmod +x gradlew
|
|
- name: Build with Gradle
|
|
run: ./gradlew build
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
api-level: [24, 30, 32, 33]
|
|
target: [default, google_apis]
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Fetch Git tags
|
|
run: git fetch --tags
|
|
- name: set up JDK 11
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: 'zulu' # See 'Supported distributions' for available options
|
|
java-version: '11'
|
|
- 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 }}
|
|
force-avd-creation: false
|
|
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
|
disable-animations: false
|
|
script: echo "Generated AVD snapshot for caching."
|
|
- name: Grant execute permission for gradlew
|
|
run: chmod +x gradlew
|
|
- name: run 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
|
|
script: ./gradlew connectedCheck
|