Screenshot tests #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Screenshot tests | |
on: | |
workflow_dispatch: | |
pull_request: | |
jobs: | |
execute-screenshot-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
api-level: [ 29 ] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- 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: Generate AVD 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 | |
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: Execute screenshot tests | |
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 executeScreenshotTests | |
- name: Upload instrumental report | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: instrumental-report | |
path: app/build/reports/androidTests/connected/debug | |
- name: Upload shot report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: shot-report | |
path: app/build/reports/shot | |
- name: Cleanup | |
if: always() | |
run: ./gradlew clean |