Skip to content

Commit 0128d72

Browse files
Merge pull request #163 from usefulness/updates
Test with robolectric
2 parents 1ceefd9 + cba46a7 commit 0128d72

File tree

5 files changed

+17
-49
lines changed

5 files changed

+17
-49
lines changed

.github/workflows/default.yml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -78,38 +78,3 @@ jobs:
7878
- run: cp lazythreetenbp/build/outputs/aar/lazythreetenbp-release.aar diffuse-source-file-release
7979
if: github.event_name != 'pull_request'
8080
shell: bash
81-
82-
ui-test:
83-
runs-on: macos-latest
84-
strategy:
85-
matrix:
86-
apiVersion: [ 23, 28, 30, 31, 34 ]
87-
fail-fast: false
88-
89-
steps:
90-
- uses: actions/checkout@v4
91-
with:
92-
fetch-depth: 0
93-
94-
- uses: actions/setup-java@v4
95-
with:
96-
distribution: 'temurin'
97-
java-version: 21
98-
99-
- uses: gradle/gradle-build-action@v2
100-
101-
- name: run tests
102-
uses: reactivecircus/android-emulator-runner@v2
103-
with:
104-
api-level: ${{ matrix.apiVersion }}
105-
profile: pixel_xl
106-
target: google_apis
107-
arch: x86_64
108-
disable-spellchecker: true
109-
script: ./gradlew connectedCheck
110-
111-
- name: Upload tests result
112-
uses: actions/upload-artifact@v4
113-
with:
114-
name: "test-results [${{ matrix.apiVersion }}]"
115-
path: "${{ github.workspace }}/**/reports/**"

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ commonConfig {
1414
allprojects {
1515
tasks.withType(KotlinCompile).configureEach {
1616
compilerOptions {
17-
apiVersion = KotlinVersion.KOTLIN_1_5
18-
languageVersion = KotlinVersion.KOTLIN_1_5
17+
apiVersion = KotlinVersion.KOTLIN_1_6
18+
languageVersion = KotlinVersion.KOTLIN_1_6
1919
}
2020
}
2121
pluginManager.withPlugin("kotlin") {

gradle/libs.versions.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
[versions]
2-
gradle-starter = "0.67.0"
2+
gradle-starter = "0.68.0"
33
gradle-doctor = "0.9.1"
44
google-annotation = "1.7.1"
5-
google-androidtest = "1.5.2"
6-
google-androidtestext = "1.1.5"
75
maven-threetenbp = "1.6.8"
86
maven-junit = "4.13.2"
97
maven-truth = "1.2.0"
108
maven-ticktock = "1.2.0-2021e"
119
maven-binarycompatiblity = "0.13.2"
10+
maven-robolectric = "4.11.1"
1211

1312
[libraries]
1413
starter-android = { module = "com.project.starter:android", version.ref = "gradle-starter" }
1514
ticktock-compiler = { module = "dev.zacsweers.ticktock:ticktock-compiler", version.ref = "maven-ticktock" }
1615
annotation-core = { module = "androidx.annotation:annotation", version.ref = "google-annotation" }
1716
threetenbp-core = { module = "org.threeten:threetenbp", version.ref = "maven-threetenbp" }
1817
junit-core = { module = "junit:junit", version.ref = "maven-junit" }
18+
robolectric-core = { module = "org.robolectric:robolectric", version.ref = "maven-robolectric" }
1919
truth-core = { module = "com.google.truth:truth", version.ref = "maven-truth" }
20-
androidtest-runner = { module = "androidx.test:runner", version.ref = "google-androidtest" }
21-
androidtest-junitext = { module = "androidx.test.ext:junit-ktx", version.ref = "google-androidtestext" }
2220

2321
[plugins]
2422
starter-library-android = { id = "com.starter.library.android", version.ref = "gradle-starter" }

lazythreetenbp/build.gradle

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ android {
3333
checkReleaseBuilds false
3434
disable += "UseTomlInstead"
3535
}
36+
testOptions {
37+
unitTests {
38+
includeAndroidResources = true
39+
}
40+
}
3641
}
3742

3843
androidComponents {
@@ -61,9 +66,7 @@ dependencies {
6166
// noinspection UseTomlInstead
6267
implementation("org.threeten:threetenbp:1.6.8:no-tzdb")
6368

64-
androidTestImplementation libs.annotation.core
65-
androidTestImplementation libs.junit.core
66-
androidTestImplementation libs.truth.core
67-
androidTestImplementation libs.androidtest.runner
68-
androidTestImplementation libs.androidtest.junitext
69+
testImplementation libs.junit.core
70+
testImplementation libs.robolectric.core
71+
testImplementation libs.truth.core
6972
}

lazythreetenbp/src/androidTest/kotlin/com/usefulness/threetenbp/AndroidThreeTenTest.kt renamed to lazythreetenbp/src/test/kotlin/com/usefulness/threetenbp/AndroidThreeTenTest.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package com.usefulness.threetenbp
22

3-
import androidx.test.ext.junit.runners.AndroidJUnit4
43
import androidx.test.platform.app.InstrumentationRegistry
54
import com.google.common.truth.Truth.assertThat
65
import org.junit.Test
76
import org.junit.runner.RunWith
7+
import org.robolectric.RobolectricTestRunner
8+
import org.robolectric.annotation.Config
89
import org.threeten.bp.zone.ZoneRulesProvider
910

10-
@RunWith(AndroidJUnit4::class)
11+
@Config(sdk = [23, 28, 30, 31, 34])
12+
@RunWith(RobolectricTestRunner::class)
1113
internal class AndroidThreeTenTest {
1214

1315
private val context = InstrumentationRegistry.getInstrumentation().context

0 commit comments

Comments
 (0)