Skip to content

Commit

Permalink
Hardware accelerated Android virtualization on Actions Linux larger h…
Browse files Browse the repository at this point in the history
…osted runners
  • Loading branch information
softartdev committed Sep 21, 2024
1 parent ea59913 commit 97b286f
Showing 1 changed file with 46 additions and 37 deletions.
83 changes: 46 additions & 37 deletions .github/workflows/kmp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,76 +14,85 @@ jobs:
continue-on-error: true
steps:
- name: Check out
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1
- name: Cached Konan
uses: actions/cache@v2
with:
path: ~/.konan
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-konan-
- name: Cached Gradle
uses: actions/cache@v2
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 17
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: 17
- name: install cocoapods-generate
run: sudo gem install cocoapods-generate
java-version: '17'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build
run: ./gradlew build
- name: Archive build-output artifacts
if: ${{ always() }}
if: always()
uses: actions/upload-artifact@v4
with:
name: output-build-artifacts
path: |
shared/build/reports
android-compose-app/build/reports
android_ui_test_job:
name: Android UI-tests on emulator
needs: build_job
runs-on: macos-latest
runs-on: ubuntu-latest
continue-on-error: true
strategy:
fail-fast: false
matrix:
api-level: [ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34 ]
api-level: [ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 ]
steps:
- name: Check out
uses: actions/checkout@v2
- name: Cached Konan
uses: actions/cache@v2
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
path: ~/.konan
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-konan-
- name: Cached Gradle
uses: actions/cache@v2
java-version: '17'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 17
uses: actions/setup-java@v1
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-${{ matrix.target }}
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
java-version: 17
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
profile: Nexus 6
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: Run UI-tests on emulator
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: google_apis
target: ${{ matrix.target }}
arch: x86_64
profile: Nexus 6
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 :android-compose-app:connectedCheck
- name: Archive ui-tests-output artifacts
if: ${{ always() }}
if: always()
uses: actions/upload-artifact@v4
with:
name: output-ui-tests-artifacts
name: output-ui-tests-artifacts-${{ matrix.api-level }}-${{ matrix.target }}
path: |
android-compose-app/build/outputs
android-compose-app/build/reports

0 comments on commit 97b286f

Please sign in to comment.