Skip to content

Commit

Permalink
#9: try out reactivecircus emulated runner
Browse files Browse the repository at this point in the history
  • Loading branch information
arburk committed Jan 30, 2024
1 parent 6639409 commit 5cdf155
Showing 1 changed file with 41 additions and 18 deletions.
59 changes: 41 additions & 18 deletions .github/workflows/android_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ name: Android CI
on: [push]

jobs:
build:
prepare:
name: prepare actions
runs-on: ubuntu-latest # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md
env:
JAVA_TOOL_OPTIONS: -Xmx4g

steps:
- name: Check if PR exists or branch is main
Expand All @@ -24,6 +23,13 @@ jobs:
echo "pr_exists_or_main_branch=$pr_exists_or_main_branch"
echo "pr_exists_or_main_branch=$pr_exists_or_main_branch" >> "$GITHUB_OUTPUT"
build:
runs-on: ubuntu-latest
env:
JAVA_TOOL_OPTIONS: -Xmx4g

steps:
- name: checkout source
uses: actions/checkout@v4
with:
Expand All @@ -36,13 +42,6 @@ jobs:
distribution: 'temurin'
cache: gradle

- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Gradle packages
uses: actions/cache@v4
with:
Expand All @@ -56,12 +55,22 @@ jobs:
- name: Build with Gradle
run: ./gradlew clean build


instrumented-tests:
runs-on: ubuntu-latest
if: steps.check_pr.outputs.pr_exists_or_main_branch != 0
needs: build
strategy:
matrix:
api-level: [ 27, 28, 30, 33 ]
env:
JAVA_TOOL_OPTIONS: -Xmx4g

steps:
- name: SDKs - accept licenses
if: steps.check_pr.outputs.pr_exists_or_main_branch != 0
run: /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"

- name: Enable KVM group perms
if: steps.check_pr.outputs.pr_exists_or_main_branch != 0
# https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
# Starting on February 23, 2023, Actions users of GitHub-hosted larger Linux runners will be able to make use of hardware acceleration for Android testing
run: |
Expand All @@ -72,18 +81,32 @@ jobs:
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
if: steps.check_pr.outputs.pr_exists_or_main_branch != 0
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-[27, 28, 30, 33]
key: avd-${{ matrix.api-level }}

- name: Perfom instrumented tests
id: perform-it
continue-on-error: true
if: steps.check_pr.outputs.pr_exists_or_main_branch != 0
run: ./gradlew supportedSdksGroupDebugAndroidTest -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" -Pandroid.experimental.testOptions.managedDevices.emulators.emulator.showKernelLogging=true --info --stacktrace --scan
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
profile: Nexus 6
script: ./gradlew supportedSdksGroupDebugAndroidTest -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" -Pandroid.experimental.testOptions.managedDevices.emulators.emulator.showKernelLogging=true --info --stacktrace --scan

quality-check:
runs-on: ubuntu-latest
needs: [build, instrumented-tests]

steps:
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Sonar checks
env:
Expand Down

0 comments on commit 5cdf155

Please sign in to comment.