forked from connectbot/connectbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
83 lines (70 loc) · 2.71 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
pipeline {
agent {
dockerfile {
dir 'ci/builder'
args "${env.JAVA_OPTS ? "-e JAVA_OPTS=\"$env.JAVA_OPTS\"" : ''} " +
"${env.GRADLE_BUILD_CACHE ? " -e GRADLE_BUILD_CACHE=\"$env.GRADLE_BUILD_CACHE\"" : ''} " +
"${env.MAVEN_REPO_CACHE ? " -e MAVEN_REPO_CACHE=\"$env.MAVEN_REPO_CACHE\"" : ''} " +
"${env.DOCKER_NETWORK ? " --network \"$env.DOCKER_NETWORK\"" : ''}"
}
}
stages {
stage('Build') {
steps {
gradlew 'assemble'
}
}
stage('Test') {
steps {
gradlew 'check jacocoTestReport'
junit 'app/build/test-results/**/*.xml'
}
}
stage('Device test') {
when { expression { env.ANDROID_ADB_SERVER_ADDRESS != null } }
steps {
script {
sh "ANDROID_ADB_SERVER_ADDRESS=${env.ANDROID_ADB_SERVER_ADDRESS ?: "host.docker.internal"} " +
"ANDROID_ADB_SERVER_PORT=${env.ANDROID_ADB_SERVER_PORT ?: "5037"} " +
"./gradlew connectedCheck --stacktrace --no-daemon"
}
}
}
}
post {
always {
jacoco(
execPattern: 'app/build/jacoco/*.exec, app/build/outputs/code-coverage/connected/**/*.ec',
sourcePattern: 'app/src/*/java',
classPattern: 'app/build/intermediates/javac/**/classes',
inclusionPattern: 'org/connectbot/**/*.class',
exclusionPattern: '**/R$*.class, **/*$ViewInjector*.*, **/BuildConfig.*, **/Manifest*.*'
)
publishCoverage adapters: [
jacocoAdapter('app/build/reports/jacoco/jacocoTestGoogleDebugUnitTestReport/jacocoTestGoogleDebugUnitTestReport.xml'),
jacocoAdapter('app/build/reports/jacoco/jacocoTestGoogleReleaseUnitTestReport/jacocoTestGoogleReleaseUnitTestReport.xml'),
jacocoAdapter('app/build/reports/jacoco/jacocoTestOssDebugUnitTestReport/jacocoTestOssDebugUnitTestReport.xml'),
jacocoAdapter('app/build/reports/jacoco/jacocoTestOssReleaseUnitTestReport/jacocoTestOssReleaseUnitTestReport.xml')
]
dir('app/build') {
archiveArtifacts artifacts: 'outputs/apk/**/*.apk', fingerprint: true
archiveArtifacts 'outputs/apk/**/output.json'
archiveArtifacts 'jacoco/*.exec'
archiveArtifacts 'test-results/**/*.xml'
checkstyle pattern: 'reports/checkstyle/*.xml'
archiveArtifacts 'reports/checkstyle/*.html'
archiveArtifacts 'reports/checkstyle/*.xml'
androidLint pattern: 'reports/lint-results*.xml'
archiveArtifacts 'reports/lint-results*.xml'
archiveArtifacts 'reports/tests/**/*'
}
}
}
}
def gradlew(command) {
if (isUnix()) {
sh "./gradlew ${command} --stacktrace --no-daemon"
} else {
bat "./gradlew.bat ${command} --stacktrace --no-daemon"
}
}