Ensure Android tests compile and fix warnings

This commit is contained in:
Benoit Marty 2019-10-24 17:24:42 +02:00
parent 8422c6de17
commit 2929b8f617
3 changed files with 16 additions and 4 deletions

View file

@ -4,7 +4,7 @@
# We propagate the environment to the container (sse https://github.com/buildkite-plugins/docker-buildkite-plugin#propagate-environment-optional-boolean) # We propagate the environment to the container (sse https://github.com/buildkite-plugins/docker-buildkite-plugin#propagate-environment-optional-boolean)
steps: steps:
- label: "Unit test" - label: "Compile and run Unit tests"
agents: agents:
# We use a medium sized instance instead of the normal small ones because # We use a medium sized instance instead of the normal small ones because
# gradle build is long # gradle build is long
@ -16,6 +16,18 @@ steps:
image: "runmymind/docker-android-sdk" image: "runmymind/docker-android-sdk"
propagate-environment: true propagate-environment: true
- label: "Compile Android tests"
agents:
# We use a medium sized instance instead of the normal small ones because
# gradle build is long
queue: "medium"
commands:
- "./gradlew clean assembleAndroidTest --stacktrace"
plugins:
- docker#v3.1.0:
image: "runmymind/docker-android-sdk"
propagate-environment: true
- label: "Assemble GPlay Debug version" - label: "Assemble GPlay Debug version"
agents: agents:
# We use a medium sized instance instead of the normal small ones because # We use a medium sized instance instead of the normal small ones because

View file

@ -17,12 +17,12 @@
package im.vector.matrix.android package im.vector.matrix.android
import android.content.Context import android.content.Context
import androidx.test.InstrumentationRegistry import androidx.test.core.app.ApplicationProvider
import java.io.File import java.io.File
interface InstrumentedTest { interface InstrumentedTest {
fun context(): Context { fun context(): Context {
return InstrumentationRegistry.getTargetContext() return ApplicationProvider.getApplicationContext()
} }
fun cacheDir(): File { fun cacheDir(): File {

View file

@ -17,8 +17,8 @@
package im.vector.matrix.android.auth package im.vector.matrix.android.auth
import androidx.test.annotation.UiThreadTest import androidx.test.annotation.UiThreadTest
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.rule.GrantPermissionRule import androidx.test.rule.GrantPermissionRule
import androidx.test.runner.AndroidJUnit4
import im.vector.matrix.android.InstrumentedTest import im.vector.matrix.android.InstrumentedTest
import im.vector.matrix.android.OkReplayRuleChainNoActivity import im.vector.matrix.android.OkReplayRuleChainNoActivity
import im.vector.matrix.android.api.auth.Authenticator import im.vector.matrix.android.api.auth.Authenticator