This repository has been archived by the owner on May 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
78 lines (62 loc) · 2.31 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
#!/usr/bin/env groovy
pipeline {
agent {
label 'java8'
}
post {
always {
junit allowEmptyResults: true, testResults: 'build/test-results/**/*.xml'
}
success {
ircSendSuccess()
}
failure {
ircSendFailure()
}
}
environment {
GRADLE_OPTIONS = "--no-daemon --rerun-tasks -PBUILD_NUMBER=${env.BUILD_NUMBER} -PBRANCH=\"${env.BRANCH_NAME}\""
}
stages {
stage('Checkout') {
steps {
ircSendStarted()
checkout scm
sh "rm -Rv build || true"
}
}
stage('Build & Test') {
steps {
sh "./gradlew ${env.GRADLE_OPTIONS} clean build test"
sh "./gradlew ${env.GRADLE_OPTIONS} generatePomFileForMavenJavaPublication"
stash includes: 'build/libs/**/*.jar', name: 'build_libs', useDefaultExcludes: false
stash includes: 'build/publications/mavenJava/pom-default.xml', name: 'maven_artifacts', useDefaultExcludes: false
}
}
stage('Coverage') {
environment {
CODECOV_TOKEN = credentials('engineer.carrot.warren.kale.codecov')
}
steps {
sh "./gradlew ${env.GRADLE_OPTIONS} jacocoTestReport"
sh "./codecov.sh -B ${env.BRANCH_NAME}"
step([$class: 'JacocoPublisher'])
}
}
stage('Archive') {
steps {
archive includes: 'build/libs/*.jar'
}
}
stage('Deploy') {
steps {
sh "rm -Rv build || true"
unstash 'maven_artifacts'
unstash 'build_libs'
sh "ls -lR build"
sh "find build/libs -name Kale\\*${env.BUILD_NUMBER}.jar | head -n 1 | xargs -I '{}' mvn install:install-file -Dfile={} -DpomFile=build/publications/mavenJava/pom-default.xml -DlocalRepositoryPath=/var/www/maven.hopper.bunnies.io"
sh "find build/libs -name Kale\\*sources.jar | head -n 1 | xargs -I '{}' mvn install:install-file -Dfile={} -Dclassifier=sources -DpomFile=build/publications/mavenJava/pom-default.xml -DlocalRepositoryPath=/var/www/maven.hopper.bunnies.io"
}
}
}
}