Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: enable KVM for faster emulator #2390

Merged
merged 7 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 36 additions & 29 deletions .github/workflows/gradle-android-instrumented-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
uses: ./.github/workflows/codestyle.yml
gradle-run-tests:
needs: [ detekt ]
runs-on: buildjet-4vcpu-ubuntu-2204
runs-on: ubuntu-22.04
strategy:
matrix:
api-level: [ 30 ]
Expand All @@ -25,8 +25,14 @@ jobs:
with:
fetch-depth: 0

- name: Enable KVM group perms # For a faster emulator
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: Set up JDK
uses: buildjet/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
Expand All @@ -42,36 +48,37 @@ jobs:
run: |
./gradlew :samples:compileDebugSources

# - 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.27.0
# with:
# api-level: ${{ matrix.api-level }}
# force-avd-creation: false
# target: google_apis
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# cores: 4
# ram-size: 4096M
# heap-size: 2048M
# disable-animations: false
# script: echo "Generated AVD snapshot for caching."
- name: AVD cache
uses: actions/cache@v4
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
target: google_apis
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
cores: 2
ram-size: 4096M
heap-size: 2048M
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- name: Android Instrumentation Tests
uses: reactivecircus/android-emulator-runner@v2.27.0
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
target: google_apis
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
cores: 4
cores: 2
ram-size: 4096M
heap-size: 2048M
script: ./gradlew connectedAndroidOnlyAffectedTest
Expand All @@ -81,14 +88,14 @@ jobs:

- name: Archive Test Reports
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-reports
path: ./**/build/reports/tests/**

- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-results
path: |
Expand Down Expand Up @@ -117,7 +124,7 @@ jobs:

steps:
- name: Download tests results
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: test-results
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gradle-android-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ jobs:

- name: Archive Test Reports
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-reports
path: ./**/build/reports/tests/**

- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-results
path: |
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:

steps:
- name: Download tests results
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: test-results
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gradle-ios-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ jobs:

- name: Archive Test Reports
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-reports
path: ./**/build/reports/tests/**

- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-results
path: |
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:

steps:
- name: Download tests results
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: test-results
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/gradle-jvm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ jobs:

- name: Archive Test Reports
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-reports
path: ./**/build/reports/tests/**

- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-results
path: ./**/build/test-results/**/*.xml
Expand All @@ -89,7 +89,7 @@ jobs:
files: "build/reports/kover/report.xml"

- name: Archive Kover report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: kover-report
path: build/reports/kover/report.xml
Expand All @@ -108,7 +108,7 @@ jobs:

steps:
- name: Download tests results
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
continue-on-error: true
- name: Display structure of downloaded files
run: ls -R
Expand Down
Loading