Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@brettchabot Cache Gradle Managed Devices emulator snapshot. #2115

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 25 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -33,7 +33,7 @@ jobs:
distribution: 'zulu'
java-version: '17'
- name: 'Cache Bazel files'
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-${{ env.cache-version }}-bazel-build-${{ github.sha }}
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
distribution: 'zulu'
java-version: '17'
- name: 'Cache Bazel files'
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-${{ env.cache-version }}-bazel-test-${{ github.sha }}
Expand Down Expand Up @@ -110,9 +110,31 @@ jobs:
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
sudo udevadm trigger --name-match=kvm
- name: Set ANDROID_USER_HOME
run: echo "ANDROID_USER_HOME=$HOME/.android" >> $GITHUB_ENV
- name: 'Cache Gradle files'
uses: gradle/gradle-build-action@v2
# Saving the GMD snapshot to cache is expensive
# Theoretically we only need to update the cache if the snapshot is changed,
# which should only happen if emulator version or system image has changed.
# As a workaround, encorporate the year and week to the cache key, so
# the snapshot cache gets regenerated every week
# http://man7.org/linux/man-pages/man1/date.1.html
- name: Get Date
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y%U")" >> $GITHUB_OUTPUT
shell: bash
- name: 'Cache GMD snapshot'
uses: actions/cache@v4
with:
path: |
~/.android/avd/gradle-managed/*
~/.android/adb*
# use combination of date (to cover case where emulator or system image version changed) and
# hash of top-level build.gradle (to cover case where AGP or android API level changed)
key: ${{ runner.os }}-${{ env.cache-version }}-gmd-${{ steps.get-date.outputs.date }}-${{ hashFiles('gradle-tests/build.gradle') }}
- name: 'Download local snapshot for tests'
uses: actions/download-artifact@v4
with:
Expand All @@ -137,4 +159,3 @@ jobs:
name: test-reports
path: gradle-tests/**/build/reports/androidTests/