This repository has been archived by the owner on Feb 10, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathJenkinsfile
78 lines (68 loc) · 2.35 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
properties properties: [
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '10']],
disableConcurrentBuilds()
]
@Library('mare-build-library')
def nodeJS = new de.mare.ci.jenkins.NodeJS()
timeout(60) {
node('nativescript') {
def buildNumber = env.BUILD_NUMBER
def branchName = env.BRANCH_NAME
def workspace = env.WORKSPACE
def buildUrl = env.BUILD_URL
// PRINT ENVIRONMENT TO JOB
echo "workspace directory is $workspace"
echo "build URL is $buildUrl"
echo "build Number is $buildNumber"
echo "branch name is $branchName"
echo "PATH is $env.PATH"
try {
stage('Checkout') {
checkout scm
}
stage('Build') {
nodeJS.nvm("install -g nativescript")
dir("publish") {
nodeJS.nvmRun("setup-dev-env")
}
}
stage('Webpack') {
parallel demo: {
dir("demo") {
nodeJS.nvmRun("build-android-bundle")
nodeJS.nvmRun("build-ios-bundle")
}
sh "cd demo && npm run build-ios-bundle && npm run build-android-bundle"
}, demoAngular: {
dir("demo-angular") {
nodeJS.nvmRun("build-android-bundle")
nodeJS.nvmRun("build-ios-bundle")
}
},
failFast: true
}
stage('Test') {
parallel unit:{
dir("src") {
nodeJS.nvmRun("test")
}
}, iOS: {
//sh "cd demo && npm run ci.ios.build && tns test ios --justlaunch --emulator"
}, Android: {
//sh "cd demo && npm run ci.android.build && tns test android --justlaunch --emulator"
},
failFast: true
junit 'demo/target/junit-report/*.xml,src/target/junit-report/*.xml'
}
stage('Publish NPM snapshot') {
def packageJSON = readJSON file: './src/package.json';
sh "cd publish/package && mv *.tgz nativescript-urlhandler_v${packageJSON.version}-build${buildNumber}.tgz"
archiveArtifacts artifacts: 'publish/package/*.tgz'
nodeJS.publishSnapshot('src', buildNumber, branchName)
}
} catch (e) {
mail subject: "${env.JOB_NAME} (${env.BUILD_NUMBER}): Error on build", to: '[email protected]', body: "Please go to ${env.BUILD_URL}."
throw e
}
}
}