Skip to content

Commit

Permalink
Fix android emulator runner error (#12)
Browse files Browse the repository at this point in the history
* Fix android emulator runner error

* Adds free-disk-space action to fix CI

and enable KVM on base Linux image
  • Loading branch information
fornewid authored May 22, 2024
1 parent a73a54c commit 073a0a2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 45 deletions.
77 changes: 36 additions & 41 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ jobs:
timeout-minutes: 45

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Setup java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: 'zulu'
java-version: 17

- name: Decrypt secrets
run: release/signing-setup.sh ${{ secrets.ENCRYPT_KEY }}

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
gradle-home-cache-cleanup: true

Expand Down Expand Up @@ -60,64 +60,59 @@ jobs:
timeout-minutes: 70

strategy:
fail-fast: true
matrix:
api-level: [ 22, 26, 31 ]

env:
TERM: dumb
api-level: [ 22, 26, 30 ]

steps:
- uses: actions/checkout@v3
- name: Delete unnecessary tools 🔧
uses: jlumbroso/[email protected]
with:
android: false # Don't remove Android tools
tool-cache: true # Remove image tool cache - rm -rf "$AGENT_TOOLSDIRECTORY"
dotnet: true # rm -rf /usr/share/dotnet
haskell: true # rm -rf /opt/ghc...
swap-storage: true # rm -f /mnt/swapfile (4GiB)
docker-images: false # Takes 16s, enable if needed in the future
large-packages: false # includes google-cloud-sdk and it's slow

- name: Enable KVM group perms
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
ls /dev/kvm
- uses: actions/checkout@v4

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Setup java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: 'zulu'
java-version: 17

- name: Decrypt secrets
run: release/signing-setup.sh ${{ secrets.ENCRYPT_KEY }}

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
gradle-home-cache-cleanup: true

# Determine what emulator image to use. We run all API 28+ emulators using
# the google_apis image
- name: Determine emulator target
id: determine-target
env:
API_LEVEL: ${{ matrix.api-level }}
run: |
TARGET="default"
echo "TARGET=$TARGET" >> $GITHUB_OUTPUT
- name: Determine emulator arch
id: determine-arch
env:
API_LEVEL: ${{ matrix.api-level }}
run: |
ARCH="x86"
if [ "$API_LEVEL" -ge "30" ]; then
ARCH="x86_64"
fi
echo "ARCH=$ARCH" >> $GITHUB_OUTPUT
- name: Build tests
run: ./gradlew assembleDebugAndroidTest --scan

- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: ${{ steps.determine-arch.outputs.ARCH }}
target: ${{ steps.determine-target.outputs.TARGET }}
script: ./gradlew connectedDebugAndroidTest
arch: x86_64
disable-animations: true
disk-size: 6000M
heap-size: 600M
script: ./gradlew connectedDebugAndroidTest --daemon

- name: Clean secrets
if: always()
Expand Down Expand Up @@ -149,22 +144,22 @@ jobs:
TERM: dumb

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Setup java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: 'zulu'
java-version: 17

- name: Decrypt secrets
run: release/signing-setup.sh ${{ secrets.ENCRYPT_KEY }}

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
gradle-home-cache-cleanup: true

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ jobs:
TERM: dumb

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Setup java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: 'zulu'
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
gradle-home-cache-cleanup: true

Expand Down

0 comments on commit 073a0a2

Please sign in to comment.