-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
82 lines (70 loc) · 2.84 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
properties properties: [
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '20']]
]
timeout(60) {
node('nativescript') {
try {
def appName = 'TNS+NGX Demo'
def appID = 'de.holisticon.nativescript.ngdemo'
// Jenkins makes these variables available for each job it runs
def buildNumber = env.BUILD_NUMBER
def branchName = env.BRANCH_NAME
def workspace = env.WORKSPACE
def buildUrl = env.BUILD_URL
env.LANG = "en_US.UTF-8" // needed for cocoapods
// PRINT ENVIRONMENT TO JOB
echo "workspace directory is $workspace"
echo "build URL is $buildUrl"
echo "build Number is $buildNumber"
echo "branch name is $branchName"
dir('mobile-app'){
stage('Checkout') {
checkout scm
sh "cp ~/.holisticon/fabric.json ."
}
stage('Build') {
sh "npm run clean"
sh "BUILD_NUMBER='${buildNumber}' npm run buildnumbering && npm run build"
}
timeout(10) {
stage('Unit-Test') {
// TODO
// sh "npm run test"
// step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
}
}
timeout(10) {
stage('Integration-Tests') {
// TODO fix appium tests && npm run test-e2e"
//junit healthScaleFactor: 1.0, testResults: 'target/reports/TESTS-*.xml'
}
}
stage('Build Release') {
sh "BUILD_NUMBER='${buildNumber}' KEYSTORE_PATH='${KEYSTORE_PATH}' KEYSTORE_PASS='${KEYSTORE_PASS}' npm run release:snapshot"
//sh "npm run buildnumbering ${buildNumber} && npm run app-changelog && npm run clean && npm run package"
sh "cd target && for file in *.ipa; do mv \$file ngx-demo_build${buildNumber}.ipa; done && for file in *.apk; do mv \$file ngx-demo_build${buildNumber}.apk; done"
step([$class : "ArtifactArchiver",
artifacts : "target/*.ipa, target/*.apk",
fingerprint: true
])
}
if (branchName.equalsIgnoreCase('master')) {
stage('Store Upload') {
parallel(
'PlayStore': {
sh "fastlane supply --apk target/ngx-demo_build${buildNumber}.apk --json_key ~/.holisticon/playstore.json --package_name {appID} --track alpha"
},
'iTunes Connect': {
sh "fastlane pilot upload --ipa target/ngx-demo_build${buildNumber}.ipa -u [email protected] --changelog \"Something that is new here\""
},
failFast: false
)
}
}
}
} catch (e) {
rocketSend channel: 'holi-oss', emoji: ':rotating_light:', message: 'Fehler'
throw e
}
}
}