-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
59 lines (58 loc) · 2.98 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
def dockerImage = 'build-tools/android-build-box:latest'
node('d3-build-agent') {
properties(
[
disableConcurrentBuilds()
]
)
timestamps {
try {
stage('Git pull'){
def scmVars = checkout scm
env.GIT_BRANCH = scmVars.GIT_LOCAL_BRANCH
env.GIT_COMMIT = scmVars.GIT_COMMIT
}
withCredentials([
[$class: 'FileBinding', credentialsId: 'firebase_sora_app_distribution_key', variable: 'GOOGLE_APPLICATION_CREDENTIALS'],
[$class: 'FileBinding', credentialsId: 'android_keystore_debug', variable: 'CI_KEYSTORE_PATH'],
[$class: 'StringBinding', credentialsId: 'android_keystore_storepass_debug', variable: 'CI_KEYSTORE_PASS'],
[$class: 'StringBinding', credentialsId: 'android_keyalias_debug', variable: 'CI_KEYSTORE_KEY_ALIAS'],
[$class: 'StringBinding', credentialsId: 'android_keypass_debug', variable: 'CI_KEYSTORE_KEY_PASS']])
{
docker.withRegistry('https://docker.soramitsu.co.jp', 'nexus-build-tools-ro') {
docker.image("${dockerImage}").inside() {
//stage('Test') {
// sh "./gradlew clean testDebugUnitTest"
//}
stage('Check code style') {
sh "./gradlew ktlint"
}
stage('Run tests') {
sh "./gradlew clean runModuleTests"
}
stage('Build and deploy') {
def git_commit_message = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'%s'").trim()
def git_commit_author = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'%an'").trim()
env.CI_FIREBASE_RELEASENOTES = "Commit: ${env.GIT_COMMIT} Message: ${git_commit_message} Author: ${git_commit_author}"
if (env.GIT_BRANCH == 'master') {
env.CI_FIREBASE_GROUP = 'sora-test'
sh "./gradlew clean assembleTstCifirebasedebug appDistributionUploadTstCifirebasedebug"
}
else if (env.GIT_BRANCH == 'develop') {
env.CI_FIREBASE_GROUP = 'sora-dev'
sh "./gradlew clean assembleDevelopCifirebasedebug appDistributionUploadDevelopCifirebasedebug"
} else {
sh "./gradlew clean assembleDevelopCidebug"
}
}
}
}
}
} catch (e) {
currentBuild.result = 'FAILURE'
} finally {
archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/checkstyle/*.html, build-logs/*.gz'
cleanWs()
}
}
}