-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile
More file actions
147 lines (124 loc) · 3.82 KB
/
Jenkinsfile
File metadata and controls
147 lines (124 loc) · 3.82 KB
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
145
146
147
pipeline {
agent { label 'master' }
tools {
maven "maven 3.6.0"
jdk "jdk-11"
}
stages {
stage('Cleanup'){
steps{
cleanWs()
}
}
stage('Checkout'){
steps {
checkout scm
}
}
stage('Launch Native Code VM'){
steps{
openstackMachine cloud: 'dreamhost', template: 'debian10-builder'
}
}
stage('Build') {
steps{
sh 'mvn compile'
}
}
stage('Test'){
steps{
sh '''
# launch up an instance of the dbus and source the data output
# to see what the address is and what the PID is
TMPFILE=$(mktemp)
dbus-launch > $TMPFILE
. $TMPFILE
export DBUS_SESSION_BUS_ADDRESS
mvn test
# get the exit code
EXIT_CODE=$?
kill $DBUS_SESSION_BUS_PID
rm $TMPFILE
exit $EXIT_CODE
'''
}
}
stage('Build Native Code'){
agent{ label 'debian10-openstack' }
stages{
stage('Install Tools'){
steps{
sh '''
sudo apt-get -y install cmake build-essential
'''
checkout scm
sh '''
mvn compiler:compile@generate-jni-headers
'''
}
}
stage('build-amd64'){
steps{
sh '''
mkdir -p target/amd64
cd target/amd64
cmake ../../src/main/jni
make
'''
}
}
stage('build-x86'){
steps{
sh '''
sudo apt-get -y install gcc-multilib
mkdir -p target/i386
cd target/i386
CC="gcc -m32" cmake ../../src/main/jni
make
'''
}
}
stage('build-armhf'){
steps{
sh '''
sudo apt-get -y install gcc-arm-linux-gnueabihf
mkdir -p target/armhf
cd target/armhf
CC=arm-linux-gnueabihf-gcc cmake ../../src/main/jni
make
'''
}
}
stage('Stash Binaries'){
steps{
sh '''
mkdir -p src/main/resources/amd64
mkdir -p src/main/resources/i386
mkdir -p src/main/resources/armhf
cp target/amd64/*.so src/main/resources/amd64
cp target/i386/*.so src/main/resources/i386
cp target/armhf/*.so src/main/resources/armhf
'''
stash includes: 'src/main/resources/**/*.so', name: 'libs'
archiveArtifacts artifacts:'src/main/resources/**/*.so'
}
}
}
}
stage('Package'){
// Since we have built all of the libs, we will extract those over the current libs
steps{
unstash 'libs'
sh 'mvn -Dmaven.test.skip=true package'
}
post {
// If Maven was able to run the tests, even if some of the test
// failed, record the test results and archive the jar file.
success {
junit 'target/surefire-reports/TEST-*.xml'
archiveArtifacts 'target/*.jar'
}
}
}
}
}