Skip to content

Commit 4e53a52

Browse files
[ConfigSample] Try out caching
1 parent d20a9b7 commit 4e53a52

File tree

3 files changed

+24
-52
lines changed

3 files changed

+24
-52
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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import androidx.compose.ui.test.junit4.createAndroidComposeRule
1919
import androidx.test.ext.junit.runners.AndroidJUnit4
2020
import kotlinx.coroutines.delay
2121
import kotlinx.coroutines.runBlocking
22-
import org.junit.Assert
2322
import org.junit.Assert.assertTrue
2423
import org.junit.Rule
2524
import org.junit.Test
@@ -58,6 +57,13 @@ class MainActivityTests {
5857
assertTrue(true)
5958
}
6059

60+
@Test
61+
fun sampleTest5() {
62+
// Add instrumented tests here
63+
runBlocking { delay(10000) }
64+
assertTrue(true)
65+
}
66+
6167
/**
6268
* When you find an issue with a specific device or API level,
6369
* you can create an annotation for it and add it to your test.
@@ -70,6 +76,6 @@ class MainActivityTests {
7076
fun regressionTestKnownIssueApi26() {
7177
// Add instrumented tests here
7278
runBlocking { delay(10000) }
73-
Assert.assertTrue(true)
79+
assertTrue(true)
7480
}
7581
}

0 commit comments

Comments
 (0)