forked from PX4/PX4-ECL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
187 lines (176 loc) · 5.42 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
pipeline {
agent none
stages {
stage('Build') {
parallel {
stage('Linux GCC') {
agent {
docker {
image 'px4io/px4-dev-base-bionic:2019-10-24'
args '-v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
environment {
CCACHE_BASEDIR = "${env.WORKSPACE}"
}
steps {
sh 'export'
sh 'ccache -z'
sh 'make distclean'
sh 'make'
sh 'ccache -s'
sh 'make distclean'
}
}
stage('Linux Clang') {
agent {
docker {
image 'px4io/px4-dev-clang:2019-10-24'
args '-v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
environment {
CCACHE_BASEDIR = "${env.WORKSPACE}"
CC = 'clang'
CXX = 'clang++'
}
steps {
sh 'export'
sh 'ccache -z'
sh 'make distclean'
sh 'make'
sh 'ccache -s'
sh 'make distclean'
}
}
stage('OSX') {
agent {
node {
label 'mac'
}
}
environment {
CCACHE_BASEDIR = "${env.WORKSPACE}"
}
steps {
sh 'export'
sh 'ccache -z'
sh 'make distclean'
sh 'make'
sh 'ccache -s'
sh 'make distclean'
}
}
} // parallel
} // stage Build
stage('Test') {
parallel {
stage('coverage') {
agent {
docker {
image 'px4io/px4-dev-base-bionic:2019-10-24'
args '-v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
steps {
sh 'export'
sh 'ccache -z'
sh 'make distclean'
sh 'make coverage'
sh 'make coverage_html'
// publish html
publishHTML target: [
reportTitles: 'code coverage',
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'build/coverage_build/out',
reportFiles: '*',
reportName: 'Code Coverage'
]
withCredentials([string(credentialsId: 'ECL_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) {
sh 'curl -s https://codecov.io/bash | bash -s - -F ecl_tests'
}
sh 'ccache -s'
sh 'make distclean'
}
}
stage('test') {
agent {
docker {
image 'px4io/px4-dev-base-bionic:2019-10-24'
args '-v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
steps {
sh 'export'
sh 'ccache -z'
sh 'make distclean'
sh 'make test'
sh 'ccache -s'
sh 'make distclean'
}
}
stage('doxygen') {
agent {
docker {
image 'px4io/px4-dev-base-bionic:2019-10-24'
args '-v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
steps {
sh 'export'
sh 'ccache -z'
sh 'make distclean'
//sh 'make doxygen'
sh 'ccache -s'
publishHTML([
reportTitles: 'Doxygen',
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'build/doxygen/Documentation',
reportFiles: '*',
reportName: 'doxygen'
])
sh 'make distclean'
}
}
stage('PX4/Firmware build') {
agent {
docker {
image 'px4io/px4-dev-base-bionic:2019-10-24'
args '-v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
environment {
GIT_COMMITTER_EMAIL = "bot@px4.io"
GIT_COMMITTER_NAME = "PX4BuildBot"
PX4_FIRMWARE_TEST_BRANCH = "ecl_${env.JOB_BASE_NAME}"
}
steps {
sh 'export'
withCredentials([usernamePassword(credentialsId: 'px4buildbot_github_personal_token', passwordVariable: 'GIT_PASS', usernameVariable: 'GIT_USER')]) {
sh('git clone --branch master --origin px4 https://${GIT_USER}:${GIT_PASS}@github.com/PX4/Firmware.git')
sh('cd Firmware; git checkout -B ${PX4_FIRMWARE_TEST_BRANCH}')
sh('if [ -n "${CHANGE_FORK+set}" ]; then cd Firmware; git config --file=.gitmodules submodule."src/lib/ecl".url https://github.com/${CHANGE_FORK}/ecl.git; fi')
sh('cd Firmware; git submodule sync')
sh('cd Firmware; git submodule update --init --recursive --force src/lib/ecl')
sh 'cd Firmware/src/lib/ecl; git fetch --all --tags; git checkout -f ${GIT_COMMIT}'
sh('cd Firmware; git commit -a -m "PX4/ecl test `date` ${GIT_BRANCH} ${GIT_COMMIT}"')
sh('cd Firmware; git push --force px4 ${PX4_FIRMWARE_TEST_BRANCH}')
}
}
}
} // parallel
} // stage Test
} // stages
environment {
CCACHE_DIR = '/tmp/ccache'
CI = true
}
options {
buildDiscarder(logRotator(numToKeepStr: '10', artifactDaysToKeepStr: '30'))
timeout(time: 60, unit: 'MINUTES')
}
}