Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,33 @@ jobs:
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
# The emulator action downloads the emulator and the system image on every run, so a
# snapshot cached under an older version of either would be restored against a newer one.
# Installing them here first lets the cache key carry their versions.
- name: Install the emulator and system image
# `|| true` keeps yes's SIGPIPE exit (141) from failing this step if pipefail is ever on.
run: (yes || true) | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --install emulator "system-images;android-${API_LEVEL};${TARGET};${ARCH}" > /dev/null
- name: Emulator and system image versions
id: versions
run: |
rev() { grep '^Pkg.Revision=' "$1/source.properties" | cut -d= -f2; }
emulator=$(rev "$ANDROID_HOME/emulator")
image=$(rev "$ANDROID_HOME/system-images/android-${API_LEVEL}/${TARGET}/${ARCH}")
# An empty version would quietly bring back the stale-snapshot problem.
if [ -z "$emulator" ] || [ -z "$image" ]; then
echo "could not read the emulator or system image version" >&2
exit 1
fi
echo "emulator=$emulator" >> "$GITHUB_OUTPUT"
echo "image=$image" >> "$GITHUB_OUTPUT"
- name: AVD cache
uses: actions/cache@v5
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ env.API_LEVEL }}-${{ env.TARGET }}-${{ env.ARCH }}
key: avd-${{ env.API_LEVEL }}-${{ env.TARGET }}-${{ env.ARCH }}-emulator-${{ steps.versions.outputs.emulator }}-image-${{ steps.versions.outputs.image }}
- name: Create AVD and snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 5s
--health-retries 10
Expand Down
Loading