SWADroid/.github/workflows/android-build.yml

77 lines
2.4 KiB
YAML
Raw Normal View History

name: Android CI for builds
on:
push:
branches: [ develop, master ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Git repository
2022-05-23 17:11:47 +02:00
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch Git tags
run: git fetch --tags
- name: set up JDK 11
2022-05-23 17:11:47 +02:00
uses: actions/setup-java@v3
with:
2022-05-23 17:11:47 +02:00
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
2022-05-23 17:11:47 +02:00
test:
runs-on: ubuntu-latest
strategy:
matrix:
2022-06-09 22:08:45 +02:00
api-level: [24, 30, 32, 33]
2022-05-23 17:11:47 +02:00
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