Skip to content

Commit 6ed7029

Browse files
[ConfigSample] Try out caching
1 parent d20a9b7 commit 6ed7029

File tree

3 files changed

+24
-51
lines changed

3 files changed

+24
-51
lines changed

.github/workflows/TestConfigurationSample.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ jobs:
4747

4848
gradleManagedVirtualDevicesTest:
4949
needs: build
50-
runs-on: macOS-latest # enables hardware acceleration in the virtual machine
51-
timeout-minutes: 90
50+
runs-on: macos-latest
51+
timeout-minutes: 30
5252

5353
steps:
5454
- name: Checkout
@@ -62,7 +62,7 @@ jobs:
6262
with:
6363
java-version: 11
6464

65-
- name: Generate cache key
65+
- name: Generate cache key for Gradle cache
6666
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
6767

6868
- uses: actions/cache@v2
@@ -73,25 +73,25 @@ jobs:
7373
~/.gradle/caches/build-cache-*
7474
key: gradle-${{ hashFiles('checksum.txt') }}
7575

76-
- name: AVD cache
76+
- name: Cache pixel2api29 system image
7777
uses: actions/cache@v2
78-
id: avd-cache
7978
with:
8079
path: |
81-
~/.android/gradle/avd/*
82-
key: avd
80+
~/.android/gradle/avd/dev29_aosp_x86_Pixel_2.ini
81+
~/.android/gradle/avd/dev29_aosp_x86_Pixel_2.avd
82+
key: pixel2api29
8383

8484
- name: Run all tests
8585
working-directory: ${{ env.SAMPLE_PATH }}
86-
run: ./gradlew -i pixel2api29DebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.example.android.testing.testconfigurationsample.TestDeviceLargeScreen
87-
88-
- name: Run regression tests
89-
working-directory: ${{ env.SAMPLE_PATH }}
90-
run: ./gradlew -i pixel2api26DebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.example.android.testing.testconfigurationsample.TestDeviceApi26
91-
92-
- name: Run large screen tests
93-
working-directory: ${{ env.SAMPLE_PATH }}
94-
run: ./gradlew -i nexus9api29DebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.example.android.testing.testconfigurationsample.TestDeviceLargeScreen
86+
run: ./gradlew pixel2api29DebugAndroidTest
87+
88+
# - name: Run regression tests
89+
# working-directory: ${{ env.SAMPLE_PATH }}
90+
# run: ./gradlew -i pixel2api26DebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.example.android.testing.testconfigurationsample.TestDeviceApi26
91+
#
92+
# - name: Run large screen tests
93+
# working-directory: ${{ env.SAMPLE_PATH }}
94+
# run: ./gradlew -i nexus9api29DebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.example.android.testing.testconfigurationsample.TestDeviceLargeScreen
9595

9696
- name: Upload test reports
9797
if: always()

TestConfigurationSample/app/src/androidTest/java/com/example/android/testing/testconfigurationsample/MainActivityLargeScreenTests.kt

Lines changed: 0 additions & 34 deletions
This file was deleted.

TestConfigurationSample/app/src/androidTest/java/com/example/android/testing/testconfigurationsample/MainActivityTests.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ class MainActivityTests {
5858
assertTrue(true)
5959
}
6060

61+
@Test
62+
fun sampleTest5() {
63+
// Add instrumented tests here
64+
runBlocking { delay(10000) }
65+
assertTrue(true)
66+
}
67+
6168
/**
6269
* When you find an issue with a specific device or API level,
6370
* you can create an annotation for it and add it to your test.
@@ -70,6 +77,6 @@ class MainActivityTests {
7077
fun regressionTestKnownIssueApi26() {
7178
// Add instrumented tests here
7279
runBlocking { delay(10000) }
73-
Assert.assertTrue(true)
80+
assertTrue(true)
7481
}
7582
}

0 commit comments

Comments
 (0)