This repository has been archived by the owner on Aug 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathJenkinsfile
46 lines (39 loc) · 1.96 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
@Library(['android-pipeline', 'general-pipeline']) _
node('master') {
withEnv(['DEVELOPMENT_MODE=true']) {
timeout(15) {
withSlack channel: 'jenkins', {
stage("init") {
deleteDir()
deviceCount shouldBe: env.ANDROID_DEVICE_COUNT,
action: { devices, message ->
slackMessage channel: 'jenkins', text: message
}
git url: 'git@github.com:emartech/android-mobile-engage-sample-app.git', branch: 'master'
def testFileCount = sh(returnStdout: true, script: 'find . -name "*Test.java" | wc -l').trim() as Integer
def timeoutRuleCount = sh(returnStdout: true, script: 'grep -r "^\\s*public TestRule timeout = TimeoutUtils.getTimeoutRule();" . | wc -l').trim() as Integer
if (testFileCount != timeoutRuleCount) {
error("$testFileCount tests found, but only $timeoutRuleCount timeout rules!")
}
}
stage("build") {
androidBuild andArchive: '**/apk/*.apk'
}
stage('lint') {
androidLint andArchive: '**/lint-results*.*'
}
stage("instrumentation-test") {
sh './gradlew uninstallDebug'
sh './gradlew uninstallDebugAndroidTest'
androidInstrumentationTest withScreenOn: true, withLock: env.ANDROID_DEVICE_FARM_LOCK, withRetryCount: 2, runTrulyParallel: true, withStepNames: env.ANDROID_STEP_NAMES, andArchive: '**/outputs/androidTest-results/connected/*.xml'
}
stage("install") {
sh './gradlew installDebug'
}
stage('Deploy APK to Amazon S3') {
sh env.AWS_DEPLOY_COMMAND_OLD
}
}
}
}
}