Skip to content

Commit

Permalink
More improvements + better caching
Browse files Browse the repository at this point in the history
  • Loading branch information
vinaygaba committed Jun 6, 2024
1 parent 8587e8a commit 8a990bd
Showing 1 changed file with 50 additions and 30 deletions.
80 changes: 50 additions & 30 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,37 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17

- name: Cache Gradle dependencies
uses: actions/cache@v2
uses: gradle/actions/setup-gradle@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle
cache-gradle: true

- name: Run Checks
run: ./gradlew check --stacktrace

paparazi-screenshot-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17

- name: Cache Gradle dependencies
uses: actions/cache@v2
uses: gradle/actions/setup-gradle@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle
cache-gradle: true

- name: Run Paparazzi Screenshot Tests
run: ./gradlew :showkase-screenshot-testing-paparazzi-sample:verifyPaparazziDebug -PuseKsp=true --stacktrace
Expand All @@ -70,7 +62,7 @@ jobs:
retention-days: 1

ui-testing:
runs-on: macos-11
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [ 26, 29 ]
Expand All @@ -81,33 +73,61 @@ jobs:
- api-level: 29
target: google_apis
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- 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: Set up JDK 17
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17

- name: Cache Gradle dependencies
uses: actions/cache@v2
uses: gradle/actions/setup-gradle@v3
with:
cache-gradle: true

- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

- name: Start emulator
- 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 }}
target: ${{ matrix.target }}
arch: x86_64
script: ./gradlew connectedCheck --no-daemon --stacktrace -PuseKsp=true
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 w/ KSP
run: ./gradlew connectedCheck --no-daemon --stacktrace -PuseKsp=true --continue
- name: Start emulator and run UI Tests w/ KSP
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 --no-daemon --stacktrace

- name: Start emulator and run UI Tests w/ KSP
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 --no-daemon --stacktrace -PuseKsp=true

- name: Run Screenshot Tests
run: ./gradlew executeScreenshotTests -PdirectorySuffix=Api${{ matrix.api-level }} -PprintBase64
Expand Down

0 comments on commit 8a990bd

Please sign in to comment.