mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-10-03 09:04:32 -04:00
ci(store-screenshots): capture each flavor on its own emulator without a second Gradle run (#7500)
This commit is contained in:
1 parent
503391e41f
commit
d94166be1c
5 files changed
+88
-49
No files matched your search
@@ -1,8 +1,8 @@
|
||||
name: Store Screenshots
|
||||
|
||||
# Captures the store-listing screenshots from the real debug apps, connected to Demo
|
||||
# Mode's hidden showcase mesh. Android runs `:store-screenshots` for both flavors on one
|
||||
# emulator: the google flavor feeds the Play listing, the fdroid flavor the fastlane
|
||||
# Mode's hidden showcase mesh. Android runs `:store-screenshots` once per flavor, each on
|
||||
# its own emulator: the google flavor feeds the Play listing, the fdroid flavor the fastlane
|
||||
# tree F-Droid and IzzyOnDroid read, each uploaded as `store-screenshots-<flavor>` laid
|
||||
# out as `images/<type>Screenshots/<n>_<name>.png`. Desktop runs the real app on a virtual
|
||||
# display (`store-screenshots/capture-desktop.sh`) and uploads the five Flathub PNGs as
|
||||
@@ -45,11 +45,19 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
android:
|
||||
name: Android
|
||||
name: Android (${{ matrix.flavor }})
|
||||
# Hosted x64 runners expose KVM; the emulator needs it.
|
||||
runs-on: ubuntu-26.04
|
||||
timeout-minutes: 35
|
||||
continue-on-error: ${{ inputs.soft == true }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- flavor: google
|
||||
variant: Google
|
||||
- flavor: fdroid
|
||||
variant: Fdroid
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
@@ -67,6 +75,7 @@ jobs:
|
||||
# The google flavor draws Google Maps, which needs the debug Maps key; the fdroid
|
||||
# flavor draws MapLibre and needs nothing.
|
||||
- name: Provide the debug Maps key
|
||||
if: ${{ matrix.flavor == 'google' }}
|
||||
env:
|
||||
GOOGLE_MAPS_API_KEY_DEBUG: ${{ secrets.GOOGLE_MAPS_API_KEY_DEBUG }}
|
||||
run: |
|
||||
@@ -76,11 +85,10 @@ jobs:
|
||||
echo "::warning::GOOGLE_MAPS_API_KEY_DEBUG is unset -- the google-flavor map shot will be blank."
|
||||
fi
|
||||
|
||||
# Built before the emulator boots, so the emulator step only installs and runs.
|
||||
# Built before the emulator boots, so the emulator step only installs and runs, with
|
||||
# no second Gradle configuration.
|
||||
- name: Build the app and the capture module
|
||||
run: >
|
||||
./gradlew :androidApp:assembleGoogleDebug :store-screenshots:assembleGoogleDebug
|
||||
:androidApp:assembleFdroidDebug :store-screenshots:assembleFdroidDebug
|
||||
run: ./gradlew :androidApp:assemble${{ matrix.variant }}Debug :store-screenshots:assemble${{ matrix.variant }}Debug
|
||||
|
||||
- name: Enable KVM (for the emulator)
|
||||
run: |
|
||||
@@ -89,12 +97,7 @@ jobs:
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger --name-match=kvm
|
||||
|
||||
# The runner's `script:` runs each line in its own shell and stops at the first that
|
||||
# fails, so a failure is recorded in out/failed and both flavors are still pulled.
|
||||
# Each flavor leaves its PNGs in /data/local/tmp/store-screenshots/<flavor>, which
|
||||
# outlives the test app's uninstall at the end of the connected run.
|
||||
# --no-configuration-cache: connected tasks in a com.android.test module are not
|
||||
# configuration-cache serializable (see scheduled-baseline.yml).
|
||||
# The runner's `script:` runs each line in its own shell, so the capture is one script.
|
||||
- name: Capture on the emulator
|
||||
uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # v2
|
||||
with:
|
||||
@@ -105,54 +108,38 @@ jobs:
|
||||
cores: 4
|
||||
disable-animations: true
|
||||
emulator-options: -no-window -gpu swiftshader -noaudio -no-boot-anim -camera-back none
|
||||
script: |
|
||||
mkdir -p out/google out/fdroid
|
||||
./gradlew --continue :store-screenshots:connectedGoogleDebugAndroidTest :store-screenshots:connectedFdroidDebugAndroidTest -Dorg.gradle.isolated-projects=false --no-configuration-cache || touch out/failed
|
||||
adb pull /data/local/tmp/store-screenshots/google/. out/google/ || touch out/failed
|
||||
adb pull /data/local/tmp/store-screenshots/fdroid/. out/fdroid/ || touch out/failed
|
||||
test ! -e out/failed
|
||||
script: store-screenshots/capture-android.sh ${{ matrix.flavor }} out
|
||||
|
||||
- name: Summarize the captures
|
||||
if: ${{ always() }}
|
||||
env:
|
||||
FLAVOR: ${{ matrix.flavor }}
|
||||
run: |
|
||||
for flavor in google fdroid; do
|
||||
{
|
||||
echo "### Store screenshots (${flavor})"
|
||||
if [ -n "$(find "out/$flavor" -name '*.png' 2>/dev/null)" ]; then
|
||||
find "out/$flavor" -name '*.png' | sort | sed "s|^out/$flavor/|- |"
|
||||
else
|
||||
echo "- none captured"
|
||||
fi
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
done
|
||||
{
|
||||
echo "### Store screenshots (${FLAVOR})"
|
||||
if [ -n "$(find "out/$FLAVOR" -name '*.png' 2>/dev/null)" ]; then
|
||||
find "out/$FLAVOR" -name '*.png' | sort | sed "s|^out/$FLAVOR/|- |"
|
||||
else
|
||||
echo "- none captured"
|
||||
fi
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
- name: Upload the google captures
|
||||
- name: Upload the captures
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: store-screenshots-google
|
||||
path: out/google
|
||||
name: store-screenshots-${{ matrix.flavor }}
|
||||
path: out/${{ matrix.flavor }}
|
||||
if-no-files-found: warn
|
||||
retention-days: 7
|
||||
|
||||
- name: Upload the fdroid captures
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: store-screenshots-fdroid
|
||||
path: out/fdroid
|
||||
if-no-files-found: warn
|
||||
retention-days: 7
|
||||
|
||||
# The failing test's exception and the device logcat live only in these directories.
|
||||
# The failing test's exception is in instrument.txt, the rest of the story in logcat.txt.
|
||||
- name: Upload the test results
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: store-screenshots-test-results
|
||||
path: |
|
||||
store-screenshots/build/outputs/androidTest-results/connected
|
||||
store-screenshots/build/reports/androidTests/connected
|
||||
name: store-screenshots-test-results-${{ matrix.flavor }}
|
||||
path: out/test-results/${{ matrix.flavor }}
|
||||
if-no-files-found: warn
|
||||
retention-days: 7
|
||||
|
||||
|
||||
Reference in new issue
Block a user