forked from frankaemika/franka_ros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
170 lines (170 loc) · 6.36 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
pipeline {
agent any
triggers {
pollSCM('H/5 * * * *')
}
libraries {
lib('[email protected]')
}
options {
checkoutToSubdirectory('src/franka_ros')
parallelsAlwaysFailFast()
disableConcurrentBuilds()
}
environment {
CMAKE_BUILD_PARALLEL_LEVEL=sh(script: 'nproc', returnStdout: true).trim().toInteger()
}
stages {
stage('Build & Test') {
matrix {
agent {
dockerfile {
filename ".ci/Dockerfile.${env.DISTRO}"
dir 'src/franka_ros'
}
}
axes {
axis {
name 'DISTRO'
values 'melodic', 'noetic'
}
axis {
name 'BUILD_TOOL'
values 'catkin_make', 'catkin build'
}
}
stages {
stage('Notify Stash') {
when {
allOf {
environment name: 'DISTRO', value: 'noetic'
environment name: 'BUILD_TOOL', value: 'catkin_make'
}
}
steps {
script {
notifyBitbucket()
}
}
}
stage('Build w/ Catkin Make') {
when {
environment name: 'BUILD_TOOL', value: 'catkin_make'
}
steps {
sh '''
. /opt/ros/${DISTRO}/setup.sh
rm -rf src/CMakeLists.txt build devel
catkin_init_workspace src
${BUILD_TOOL} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
'''
}
}
stage('Build w/ Catkin Tools') {
when {
environment name: 'BUILD_TOOL', value: 'catkin build'
}
environment {
HOME=sh(script: 'pwd', returnStdout: true).trim()
SPACE_SUFFIX='_catkin_tools'
}
steps {
sh '''
. /opt/ros/${DISTRO}/setup.sh
rm -rf *${SPACE_SUFFIX}
catkin config --workspace . --init --extend /opt/ros/${DISTRO} \\
--space-suffix ${SPACE_SUFFIX}
${BUILD_TOOL} --no-status
'''
}
}
stage('Check C++ Format') {
when {
environment name: 'BUILD_TOOL', value: 'catkin_make'
}
steps {
sh '''
cmake --build build --target check-format
'''
}
}
stage('Check Python Format') {
when {
environment name: 'BUILD_TOOL', value: 'catkin_make'
}
steps {
sh '''
cmake --build build --target check-pyformat
'''
}
}
stage('Check Linting') {
when {
environment name: 'BUILD_TOOL', value: 'catkin_make'
}
steps {
sh '''
. /opt/ros/${DISTRO}/setup.sh
cmake --build build --target check-tidy
'''
}
}
stage('Test') {
when {
environment name: 'BUILD_TOOL', value: 'catkin_make'
}
environment {
HOME=sh(script: 'pwd', returnStdout: true).trim()
}
steps {
sh '''
. /opt/ros/${DISTRO}/setup.sh
${BUILD_TOOL} run_tests -j1
catkin_test_results
'''
}
post {
always {
junit 'build/test_results/**/*.xml'
}
}
}
stage('Check for Non-ASCII') {
when {
// Melodic has problems with non-ascii chars in YAML files
environment name: 'DISTRO', value: 'melodic'
}
steps {
dir('src/franka_ros') {
feEnsureAsciiFileContents('*.yaml')
}
}
}
stage('Check commit history sync') {
when {
allOf {
environment name: 'DISTRO', value: 'noetic'
environment name: 'BUILD_TOOL', value: 'catkin_make'
}
}
steps {
sh """
cd src/franka_ros
.ci/checkgithistory.sh \\
https://github.com/frankaemika/franka_ros.git develop
"""
}
}
}
}
}
}
post {
always {
cleanWs()
script {
notifyBitbucket()
}
}
}
}