forked from jinput/jinput
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
144 lines (144 loc) · 5.57 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
pipeline {
agent none
triggers { pollSCM('H/15 * * * *') }
tools {
maven 'Maven 3.5.3'
jdk 'OpenJDK 9'
}
options { buildDiscarder(logRotator(numToKeepStr: '5')) }
parameters {
booleanParam(defaultValue: false, description: 'Perform Release', name: 'release')
}
stages {
stage('Build core') {
agent {
label "osx"
}
steps {
sh 'mvn -B -Dmaven.antrun.skip -Dmaven.source.skip -Dmaven.test.skip -DskipTests -DskipITs -pl coreAPI/ package'
}
post {
success {
archiveArtifacts artifacts: 'coreAPI/target/apidocs/**/*', fingerprint: true
}
}
}
stage('Build natives') {
parallel {
stage('Build Windows natives') {
agent {
label "windows"
}
steps {
bat 'mvn -B -am -pl plugins/windows/,plugins/wintab/ clean compile'
}
post {
success {
stash includes: 'plugins/**/target/natives/*.dll', name: 'windows-natives'
}
}
}
stage('Build Linux natives') {
agent {
label "linux"
}
steps {
sh 'mvn -B -am -pl plugins/linux/ clean compile'
}
post {
success {
stash includes: 'plugins/**/target/natives/*.so*', name: 'linux-natives'
}
}
}
stage('Build OSX natives') {
agent {
label "osx"
}
steps {
sh 'mvn -B -am -pl plugins/OSX/ clean compile'
}
post {
success {
stash includes: '**/target/natives/*.jnilib', name: 'osx-natives'
}
}
}
}
}
stage('Build') {
agent {
label "linux"
}
steps {
unstash 'windows-natives'
unstash 'osx-natives'
unstash 'linux-natives'
sh 'mvn -B -P windows,linux,osx,wintab -Dmaven.antrun.skip -Dmaven.javadoc.skip -Dmaven.source.skip -Dmaven.test.skip -DskipTests -DskipITs package'
}
post {
success {
stash includes: '**/target/*.jar', name: 'all-java-jars'
archiveArtifacts artifacts: '**/target/*.jar*', fingerprint: true
}
}
}
stage('Deploy') {
agent {
label "linux"
}
when { branch 'master' }
steps {
milestone(1)
unstash 'windows-natives'
unstash 'osx-natives'
unstash 'linux-natives'
sh 'echo $GPG_SECRET_KEYS | base64 --decode | gpg --batch --import'
sh 'echo $GPG_OWNERTRUST | base64 --decode | gpg --import-ownertrust'
withMaven(
maven: 'Maven 3.5.3',
jdk: 'OpenJDK 9',
globalMavenSettingsConfig: 'global-maven-settings-ossrh',
mavenOpts: '-Djavax.net.ssl.trustStore=/etc/ssl/certs/java/cacerts' //Work around for JDK9 missing cacerts
) {
sh "mvn -P windows,linux,osx,wintab -Dmaven.antrun.skip -Dmaven.test.skip -DskipTests -DskipITs deploy"
}
}
}
stage('Release') {
agent {
label "linux"
}
when {
expression {
return params.release
}
}
steps {
milestone(3)
unstash 'windows-natives'
unstash 'osx-natives'
unstash 'linux-natives'
sh 'echo $GPG_SECRET_KEYS | base64 --decode | gpg --batch --import'
sh 'echo $GPG_OWNERTRUST | base64 --decode | gpg --import-ownertrust'
withMaven(
maven: 'Maven 3.5.3',
jdk: 'OpenJDK 9',
globalMavenSettingsConfig: 'global-maven-settings-ossrh',
mavenOpts: '-Djavax.net.ssl.trustStore=/etc/ssl/certs/java/cacerts' //Work around for JDK9 missing cacerts
) {
sh "mvn -P windows,linux,osx,wintab versions:set -DremoveSnapshot"
script {
VERSION_TAG = sh(script: "mvn -Dexpression=project.version help:evaluate | grep -e '^[[:digit:]]'", returnStdout: true).trim()
}
sh "git tag -a ${VERSION_TAG} -m 'Release tag ${VERSION_TAG}'"
sh "mvn -P windows,linux,osx,wintab,release -Dmaven.antrun.skip -Dmaven.test.skip -DskipTests -DskipITs deploy"
sh "mvn -P windows,linux,osx,wintab versions:revert"
sh "mvn -P windows,linux,osx,wintab versions:set -DnextSnapshot"
sh "git commit -m 'Next development release' ."
sh "git push origin HEAD:master --follow-tags"
}
}
}
}
}