update SDK #85
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: ubuntu-latest | |
strategy: | |
matrix: | |
device: | |
- profile: pixel_6 | |
api-level: 34 | |
display_size: 1080x2336 # subtracted the 64px bottom navigation bar | |
type: phone | |
- profile: pixel_tablet | |
api-level: 34 | |
display_size: 2560x1488 # subtracted the 64px navigation bar and 48px status bar | |
type: tenInch | |
steps: | |
- 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 | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Retrieve debug keystore | |
env: | |
DEBUG_KEYSTORE_BASE64: ${{ secrets.DEBUG_KEYSTORE_BASE64 }} | |
run: | | |
mkdir ~/.config/.android | |
echo $DEBUG_KEYSTORE_BASE64 | base64 --decode > ~/.config/.android/debug.keystore | |
- name: Set up Java environment | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
cache: 'gradle' | |
- name: Setup Android SDK | |
run: | | |
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "cmdline-tools;latest" | |
rm -r $ANDROID_HOME/cmdline-tools/latest | |
mv $ANDROID_HOME/cmdline-tools/latest-2 $ANDROID_HOME/cmdline-tools/latest | |
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --version | |
- name: AVD cache | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: ${{ runner.os }}-avd-api${{ matrix.device.api-level }}-${{ matrix.device.profile }} | |
- 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.device.api-level }} | |
target: google_atd | |
arch: x86_64 | |
profile: ${{ matrix.device.profile }} | |
force-avd-creation: false | |
ram-size: 2048M | |
disk-size: 8192M | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-metrics | |
disable-animations: true | |
script: echo "Generated AVD snapshot for caching." | |
- name: Build app | |
run: ./gradlew assembleGoogleNormalDebug assembleGoogleNormalAndroidTest | |
env: | |
GOINGELECTRIC_API_KEY: ${{ secrets.GOINGELECTRIC_API_KEY }} | |
OPENCHARGEMAP_API_KEY: ${{ secrets.OPENCHARGEMAP_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 }} | |
- name: Run emulator and generate screenshots | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.device.api-level }} | |
target: google_atd | |
arch: x86_64 | |
profile: ${{ matrix.device.profile }} | |
force-avd-creation: false | |
ram-size: 2048M | |
disk-size: 4096M | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-metrics | |
disable-animations: true | |
script: | | |
adb shell pm clear net.vonforst.evmap.debug || true | |
adb shell wm size ${{ matrix.device.display_size }} | |
adb logcat -c | |
adb logcat *:E & | |
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 --device_type=${{ matrix.device.type }} -q en-US,de-DE,fr-FR,nb-rNO,nl-NL,pt-PT,ro-RO | |
- name: Upload screenshots as artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: screenshots-${{ matrix.device.profile }}-${{ matrix.device.api-level }} | |
path: fastlane/metadata/android |