mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-08 06:42:21 -04:00
Switch to using test gateway
This commit is contained in:
parent
acf0f7f8fb
commit
bd5c665320
@ -1,3 +1,11 @@
|
|||||||
|
import com.testdroid.api.APIClient
|
||||||
|
import com.testdroid.api.APIException
|
||||||
|
import com.testdroid.api.APIKeyClient
|
||||||
|
import com.testdroid.api.model.APIProject
|
||||||
|
import com.testdroid.api.model.APIUser
|
||||||
|
import com.android.builder.testing.api.TestServer;
|
||||||
|
import com.android.annotations.NonNull;
|
||||||
|
|
||||||
import groovy.json.JsonSlurper
|
import groovy.json.JsonSlurper
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
@ -9,14 +17,13 @@ buildscript {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "com.android.tools.build:gradle:$androidGradlePluginVersion"
|
classpath "com.android.tools.build:gradle:$androidGradlePluginVersion"
|
||||||
classpath "com.testdroid:gradle:$testdroidGradlePluginVersion"
|
|
||||||
classpath 'org.apache.httpcomponents:httpclient-android:4.3.3'
|
classpath 'org.apache.httpcomponents:httpclient-android:4.3.3'
|
||||||
|
classpath "com.testdroid:testdroid-api:2.71"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'checkstyle'
|
apply plugin: 'checkstyle'
|
||||||
apply plugin: 'testdroid'
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
@ -30,7 +37,6 @@ repositories {
|
|||||||
String[] archs = ['arm64-v8a', 'armeabi', 'mips', 'mips64', 'x86', 'x86_64']
|
String[] archs = ['arm64-v8a', 'armeabi', 'mips', 'mips64', 'x86', 'x86_64']
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
// Get kiwixlib online if it is not populated locally
|
// Get kiwixlib online if it is not populated locally
|
||||||
if (file("../kiwixlib/src/main").list().length == 1) {
|
if (file("../kiwixlib/src/main").list().length == 1) {
|
||||||
implementation 'org.kiwix.kiwixlib:kiwixlib:1.0.11'
|
implementation 'org.kiwix.kiwixlib:kiwixlib:1.0.11'
|
||||||
@ -161,6 +167,7 @@ if (custom.listFiles()) {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 28
|
||||||
|
testServer new TestDroidUpload();
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
@ -367,21 +374,42 @@ android {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Testdroid deployment configuration
|
|
||||||
|
public class TestDroidUpload extends TestServer{
|
||||||
def buildNumber = System.getenv('TRAVIS_BUILD_NUMBER')
|
def buildNumber = System.getenv('TRAVIS_BUILD_NUMBER')
|
||||||
|
def API_KEY = System.getenv('PUBLIC_TESTDROID_API_KEY')
|
||||||
|
def TESTDROID_SERVER = "https://cloud.testdroid.com";
|
||||||
|
def RUNNER_GATEWAY = System.getenv('TESTDROID_RUNNER_GATEWAY')
|
||||||
|
def accessGroup = System.getenv('ACCESS_GROUP_ID')
|
||||||
|
|
||||||
def findJar(prefix) {
|
@Override
|
||||||
configurations.runtime.filter { it.name.startsWith(prefix) }
|
String getName() {
|
||||||
|
return "kiwixtest";
|
||||||
}
|
}
|
||||||
|
|
||||||
testdroid {
|
@Override
|
||||||
authorization "APIKEY"
|
void uploadApks(@NonNull String variantName, @NonNull File testApk, @Nullable File testedApk) {
|
||||||
apiKey System.getenv('BITBAR_API_KEY')
|
APIUser.metaClass.shareFile { id, accessGroup ->
|
||||||
deviceGroup 'Kiwix'
|
System.out.println(id)
|
||||||
projectName "Kiwix"
|
try {
|
||||||
testRunName "Auto Test " + buildNumber
|
delegate.postResource(createUri(selfURI, "/files/" + id + "/share"), [accessGroupId: accessGroup], APIProject.class)
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e.getLocalizedMessage())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fullRunConfig {
|
APIClient client = new APIKeyClient(TESTDROID_SERVER, API_KEY);
|
||||||
instrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
APIUser user = client.me();
|
||||||
|
String testId = user.uploadFile(testApk).getId()
|
||||||
|
user.shareFile(testId, accessGroup);
|
||||||
|
String testedId = user.uploadFile(testedApk).getId()
|
||||||
|
user.shareFile(testedId, accessGroup);
|
||||||
|
|
||||||
|
new URL(RUNNER_GATEWAY + "?apk=" + testedId + "&test=" + testId + "&buildno=" + buildNumber).getText()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
boolean isConfigured() {
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user