implement automatic screenshot generation #8
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
on: | |
push: | |
branches: | |
- '*' | |
name: Generate Screenshots | |
jobs: | |
screenshot: | |
name: Generate screenshots | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
api-level: [ 34 ] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- 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 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: playstore | |
arch: x86_64 | |
profile: pixel_4 | |
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: Set up Java environment | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
cache: 'gradle' | |
- name: Build app | |
run: ./gradlew assembleGoogleNormalDebug assembleGoogleNormalAndroidTest | |
env: | |
GOINGELECTRIC_API_KEY: ${{ secrets.GOINGELECTRIC_API_KEY }} | |
OPENCHARGEMAP_API_KEY: ${{ secrets.OPENCHARGEMAP_API_KEY }} | |
CHARGEPRICE_API_KEY: ${{ secrets.CHARGEPRICE_API_KEY }} | |
MAPBOX_API_KEY: ${{ secrets.MAPBOX_API_KEY }} | |
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }} | |
FRONYX_API_KEY: ${{ secrets.FRONYX_API_KEY }} | |
ACRA_CRASHREPORT_CREDENTIALS: ${{ secrets.ACRA_CRASHREPORT_CREDENTIALS }} | |
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }} | |
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.KEYSTORE_ALIAS_PASSWORD }} | |
- name: Start System UI demo mode | |
run: | | |
- name: Run emulator and generate screenshots | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: playstore | |
arch: x86_64 | |
profile: pixel_4 | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
script: | | |
adb shell settings put global hidden_api_policy 1 | |
# Start demo mode | |
adb shell settings put global sysui_demo_allowed 1 | |
# Display time 12:00 | |
adb shell am broadcast -a com.android.systemui.demo -e command clock -e hhmm 1200 | |
# Display full mobile data without type | |
adb shell am broadcast -a com.android.systemui.demo -e command network -e mobile show -e level 4 -e datatype false | |
adb shell am broadcast -a com.android.systemui.demo -e command network -e wifi show -e level 4 -e fully true | |
# Hide notifications | |
adb shell am broadcast -a com.android.systemui.demo -e command notifications -e visible false | |
# Show full battery but not in charging state | |
adb shell am broadcast -a com.android.systemui.demo -e command battery -e plugged false -e level 100 | |
fastlane screengrab --app_apk_path app/build/outputs/apk/googleNormal/debug/app-google-normal-debug.apk --test_apk_path app/build/outputs/apk/androidTest/googleNormal/debug/app-google-normal-debug-androidTest.apk --tests_package_name=net.vonforst.evmap.debug.test --app_package_name net.vonforst.evmap.debug -p net.vonforst.evmap.screenshot --use_timestamp_suffix false --clear_previous_screenshots true -q en-US,de-DE | |
adb shell am broadcast -a com.android.systemui.demo -e command exit | |
- name: Upload screenshots as artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: screenshots | |
path: fastlane/metadata/android |