Repository navigation
Screenshots #2
This file contains hidden or 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: Screenshots | |
| # Boots an emulator, installs the app, drives through the screens with live | |
| # data and saves screenshots + the crash log. By default it shoots the latest | |
| # release; "build" shoots the branch it's run on instead. | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| apk: | |
| description: "release = latest published APK, build = build this branch" | |
| default: release | |
| type: choice | |
| options: [release, build] | |
| jobs: | |
| shots: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Latest APK | |
| if: inputs.apk != 'build' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh release download latest -p AKL-Live.apk -R ${{ github.repository }} | |
| - uses: actions/setup-java@v4 | |
| if: inputs.apk == 'build' | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - uses: gradle/actions/setup-gradle@v4 | |
| if: inputs.apk == 'build' | |
| with: | |
| gradle-version: "8.11.1" | |
| - name: Build this branch | |
| if: inputs.apk == 'build' | |
| env: | |
| AT_API_KEY: ${{ secrets.AT_API_KEY }} | |
| LINZ_API_KEY: ${{ secrets.LINZ_API_KEY }} | |
| run: | | |
| gradle :app:assembleRelease --no-daemon --stacktrace | |
| cp app/build/outputs/apk/release/app-release.apk AKL-Live.apk | |
| - 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 | |
| - uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 34 | |
| target: google_apis | |
| arch: x86_64 | |
| profile: pixel_7 | |
| disable-animations: false | |
| script: bash tools/ci_screens.sh | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: screenshots | |
| path: shots/ | |
| - name: Screenshots in the log | |
| # small JPEGs as base64, for reviewing a run without downloading it | |
| if: always() | |
| run: | | |
| command -v convert > /dev/null || (sudo apt-get update -qq && sudo apt-get install -y -qq imagemagick) | |
| cat shots/crash.txt || true | |
| for f in shots/*.png; do | |
| convert "$f" -resize 480x -quality 72 /tmp/shot.jpg | |
| echo "=== SHOT $(basename "$f" .png) ===" | |
| base64 -w 0 /tmp/shot.jpg; echo | |
| echo "=== END ===" | |
| done |