1. Build Code and run unit test.
2. Source Code Analysis
3. Print Coverage Report
4. Print Unit Test Report
Jenkins will send email to RD Team if build fails.
false
ylhealth
-1
3
-1
-1
2
https://cm.ylhealth.org/gitlab/ym/HRB_Mobile.git
3485e854-8389-40e8-8c86-b94e94e91904
develop
false
"Build Node 134"||"Build Node 133"||master
false
false
false
false
false
#!/bin/groovy
pipeline {
tools {
nodejs 'default-nodejs'
}
stages {
stage('Startup') {
steps {
script {
sh 'npm install'
}
}
}
stage('Test') {
steps {
script {
sh 'npm run test'
}
}
post {
always {
step([$class: 'CoberturaPublisher', coberturaReportFile: 'output/coverage/jest/cobertura-coverage.xml'])
}
}
}
stage('Build') {
steps {
script {
sh 'npm start'
sh 'npm pack'
}
}
}
stage('Deploy') {
when {
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
}
}
steps {
script {
def server = Artifactory.server 'My_Artifactory'
uploadArtifact(server)
}
}
}
}
}
def uploadArtifact(server) {
def uploadSpec = """{
"files": [
{
"pattern": "continuous-test-code-coverage-guide*.tgz",
"target": "npm-stable/"
}
]
}"""
server.upload(uploadSpec)
def buildInfo = Artifactory.newBuildInfo()
server.upload spec: uploadSpec, buildInfo: buildInfo
server.publishBuildInfo buildInfo
}
coverage/coverage.xml
false
false
false
false
false
false
0
true
80, 0, 0
70, 0, 0
LINE
8000000
CONDITIONAL
7000000
LINE
0
CONDITIONAL
0
LINE
0
CONDITIONAL
0
ASCII
false
coverage/junit.xml
false
1.0
false
false
false
false
false