diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index 4d3e110..3116ed0 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -78,38 +78,3 @@ jobs: - run: cp lazythreetenbp/build/outputs/aar/lazythreetenbp-release.aar diffuse-source-file-release if: github.event_name != 'pull_request' shell: bash - - ui-test: - runs-on: macos-latest - strategy: - matrix: - apiVersion: [ 23, 28, 30, 31, 34 ] - fail-fast: false - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 21 - - - uses: gradle/gradle-build-action@v2 - - - name: run tests - uses: reactivecircus/android-emulator-runner@v2 - with: - api-level: ${{ matrix.apiVersion }} - profile: pixel_xl - target: google_apis - arch: x86_64 - disable-spellchecker: true - script: ./gradlew connectedCheck - - - name: Upload tests result - uses: actions/upload-artifact@v4 - with: - name: "test-results [${{ matrix.apiVersion }}]" - path: "${{ github.workspace }}/**/reports/**" diff --git a/build.gradle b/build.gradle index ffa9178..fe4d4fd 100644 --- a/build.gradle +++ b/build.gradle @@ -14,8 +14,8 @@ commonConfig { allprojects { tasks.withType(KotlinCompile).configureEach { compilerOptions { - apiVersion = KotlinVersion.KOTLIN_1_5 - languageVersion = KotlinVersion.KOTLIN_1_5 + apiVersion = KotlinVersion.KOTLIN_1_6 + languageVersion = KotlinVersion.KOTLIN_1_6 } } pluginManager.withPlugin("kotlin") { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9e26573..177879e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,14 +1,13 @@ [versions] -gradle-starter = "0.67.0" +gradle-starter = "0.68.0" gradle-doctor = "0.9.1" google-annotation = "1.7.1" -google-androidtest = "1.5.2" -google-androidtestext = "1.1.5" maven-threetenbp = "1.6.8" maven-junit = "4.13.2" maven-truth = "1.2.0" maven-ticktock = "1.2.0-2021e" maven-binarycompatiblity = "0.13.2" +maven-robolectric = "4.11.1" [libraries] starter-android = { module = "com.project.starter:android", version.ref = "gradle-starter" } @@ -16,9 +15,8 @@ ticktock-compiler = { module = "dev.zacsweers.ticktock:ticktock-compiler", versi annotation-core = { module = "androidx.annotation:annotation", version.ref = "google-annotation" } threetenbp-core = { module = "org.threeten:threetenbp", version.ref = "maven-threetenbp" } junit-core = { module = "junit:junit", version.ref = "maven-junit" } +robolectric-core = { module = "org.robolectric:robolectric", version.ref = "maven-robolectric" } truth-core = { module = "com.google.truth:truth", version.ref = "maven-truth" } -androidtest-runner = { module = "androidx.test:runner", version.ref = "google-androidtest" } -androidtest-junitext = { module = "androidx.test.ext:junit-ktx", version.ref = "google-androidtestext" } [plugins] starter-library-android = { id = "com.starter.library.android", version.ref = "gradle-starter" } diff --git a/lazythreetenbp/build.gradle b/lazythreetenbp/build.gradle index fcd4416..818d7ae 100755 --- a/lazythreetenbp/build.gradle +++ b/lazythreetenbp/build.gradle @@ -33,6 +33,11 @@ android { checkReleaseBuilds false disable += "UseTomlInstead" } + testOptions { + unitTests { + includeAndroidResources = true + } + } } androidComponents { @@ -61,9 +66,7 @@ dependencies { // noinspection UseTomlInstead implementation("org.threeten:threetenbp:1.6.8:no-tzdb") - androidTestImplementation libs.annotation.core - androidTestImplementation libs.junit.core - androidTestImplementation libs.truth.core - androidTestImplementation libs.androidtest.runner - androidTestImplementation libs.androidtest.junitext + testImplementation libs.junit.core + testImplementation libs.robolectric.core + testImplementation libs.truth.core } diff --git a/lazythreetenbp/src/androidTest/kotlin/com/usefulness/threetenbp/AndroidThreeTenTest.kt b/lazythreetenbp/src/test/kotlin/com/usefulness/threetenbp/AndroidThreeTenTest.kt similarity index 79% rename from lazythreetenbp/src/androidTest/kotlin/com/usefulness/threetenbp/AndroidThreeTenTest.kt rename to lazythreetenbp/src/test/kotlin/com/usefulness/threetenbp/AndroidThreeTenTest.kt index 44c59e8..4e55603 100644 --- a/lazythreetenbp/src/androidTest/kotlin/com/usefulness/threetenbp/AndroidThreeTenTest.kt +++ b/lazythreetenbp/src/test/kotlin/com/usefulness/threetenbp/AndroidThreeTenTest.kt @@ -1,13 +1,15 @@ package com.usefulness.threetenbp -import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry import com.google.common.truth.Truth.assertThat import org.junit.Test import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.annotation.Config import org.threeten.bp.zone.ZoneRulesProvider -@RunWith(AndroidJUnit4::class) +@Config(sdk = [23, 28, 30, 31, 34]) +@RunWith(RobolectricTestRunner::class) internal class AndroidThreeTenTest { private val context = InstrumentationRegistry.getInstrumentation().context