2017-05-21 18:47:35 +00:00
|
|
|
#!/usr/bin/env groovy
|
2017-05-21 18:44:23 +00:00
|
|
|
if (env.BRANCH_NAME.startsWith('PR-')) {
|
|
|
|
properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactNumToKeepStr: '1']]])
|
|
|
|
} else {
|
|
|
|
properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '30', artifactNumToKeepStr: '5']]])
|
|
|
|
}
|
2016-11-26 11:54:25 +00:00
|
|
|
|
2017-05-29 19:08:51 +00:00
|
|
|
if (env.CHANGE_TARGET == 'master') {
|
|
|
|
error("This pull request targets the wrong branch. Please reopen the pull request targetting the dev branch.")
|
|
|
|
}
|
|
|
|
|
2016-05-27 17:05:26 +00:00
|
|
|
node('master') {
|
2017-05-21 18:47:35 +00:00
|
|
|
stage('Pull changes') {
|
|
|
|
checkout scm
|
|
|
|
}
|
2016-05-27 17:05:26 +00:00
|
|
|
|
2017-05-21 18:47:35 +00:00
|
|
|
stage('Build data') {
|
|
|
|
sh 'mkdir -p build'
|
|
|
|
dir('build') {
|
|
|
|
sh '''
|
|
|
|
cmake -DCMAKE_INSTALL_PREFIX=/install -DCOLOBOT_INSTALL_DATA_DIR=/install/data ..
|
|
|
|
make
|
|
|
|
rm -rf install
|
|
|
|
DESTDIR=. make install
|
|
|
|
'''
|
|
|
|
}
|
2016-05-27 17:05:26 +00:00
|
|
|
}
|
|
|
|
|
2017-05-21 18:47:35 +00:00
|
|
|
stage('Archive data') {
|
|
|
|
sh 'rm -f data.zip'
|
|
|
|
zip zipFile: 'data.zip', archive: true, dir: 'build/install'
|
|
|
|
}
|
2017-05-21 18:44:23 +00:00
|
|
|
|
2017-05-21 18:41:01 +00:00
|
|
|
// Clean workspace after building pull requests
|
|
|
|
// to save disk space on the Jenkins host
|
|
|
|
if (env.BRANCH_NAME.startsWith('PR-')) {
|
|
|
|
cleanWs()
|
|
|
|
}
|
2016-05-27 17:05:26 +00:00
|
|
|
}
|