This repository has been archived by the owner on May 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
78 lines (75 loc) · 3.11 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
pipeline {
agent any
environment {
GIT = credentials('github')
}
stages {
stage('Build') {
steps {
sh './gradlew switchsdk::assembleDebug'
}
}
stage('Tests') {
steps {
parallel(
"Unit Tests": {
sh './gradlew switchsdk::test'
junit '**/test-results/**/*.xml'
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: true, reportDir: 'switchsdk/build/reports/tests/testDebugUnitTest/', reportFiles: 'index.html', reportName: 'Unit Tests Results', reportTitles: ''])
},
"Instrumentation Tests": {
sh '$ANDROID_HOME/platform-tools/adb shell input keyevent KEYCODE_POWER'
sh './gradlew switchsdk::connectedAndroidTest'
junit '**/androidTest-results/**/*.xml'
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: true, reportDir: 'switchsdk/build/reports/androidTests/connected/', reportFiles: 'index.html', reportName: 'Instrumentation Tests Results', reportTitles: ''])
}
)
}
}
stage('Hockeyapp Distribute') {
when {
branch 'hockeyapp'
}
environment {
CLIENT_ID = credentials('SwitchSdkClientId')
CLIENT_SECRET = credentials('SwitchSdkClientSecret')
HOCKEYAPP_ID = credentials('SwitchHockeyappId')
HOCKEYAPP_API_KEY = credentials('SwitchHockeyappAPIKey')
}
steps {
sh "./gradlew assembleHockey -PbuildNumber=${BUILD_NUMBER} -PclientId=${CLIENT_ID} -PclientSecret=${CLIENT_SECRET} -PhockeyAppId=${HOCKEYAPP_ID}"
step([$class: 'HockeyappRecorder', applications: [[apiToken: env.HOCKEYAPP_API_KEY, downloadAllowed: true, filePath: 'sample/build/outputs/apk/sample-hockey-debug.apk', mandatory: false, notifyTeam: false, releaseNotesMethod: [$class: 'NoReleaseNotes'], uploadMethod: [$class: 'VersionCreation', appId: env.HOCKEYAPP_ID]]], debugMode: false, failGracefully: false])
}
}
stage('Release SDK') {
when {
branch 'master'
}
steps {
script {
def bintrayCredentials = input message: 'Enter your Bintray credentials', parameters: [string(defaultValue: '', description: 'Bintray username', name: 'BINTRAY_USERNAME'), password(defaultValue: '', description: 'Bintray api key', name: 'BINTRAY_KEY')]
env.BINTRAY_USERNAME = bintrayCredentials['BINTRAY_USERNAME']
env.BINTRAY_KEY = bintrayCredentials['BINTRAY_KEY']
}
sh "./gradlew clean build bintrayUpload -PbintrayUser=${env.BINTRAY_USERNAME} -PbintrayKey=${env.BINTRAY_KEY} -PdryRun=false"
}
}
stage('Publish Documentation') {
when {
branch 'master'
}
steps {
withEnv(["PATH+=/usr/local/bin"]) {
sh 'sh documentation/install_sphynx.sh'
}
sh 'sh documentation/create_documentation.sh $GIT_USR $GIT_PSW'
}
}
}
post {
always {
deleteDir()
sh '$ANDROID_HOME/platform-tools/adb shell input keyevent KEYCODE_POWER'
}
}
}