Jenkinsfile: Switch to declarative syntax
* Switch to declarative syntax * Test parallel Windows/Linux build * Remove some hard drive restrictions as now I have more HDD space on the server1008-fix
parent
0391aaf773
commit
72417fc28b
|
@ -1,71 +1,95 @@
|
||||||
#!/usr/bin/env groovy
|
#!/usr/bin/env groovy
|
||||||
if (env.BRANCH_NAME.startsWith('PR-')) {
|
|
||||||
properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactNumToKeepStr: '1']]])
|
|
||||||
} else {
|
|
||||||
properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '30', artifactNumToKeepStr: '20']]])
|
|
||||||
}
|
|
||||||
|
|
||||||
if (env.CHANGE_TARGET == 'master') {
|
pipeline {
|
||||||
error("This pull request targets the wrong branch. Please reopen the pull request targetting the dev branch.")
|
agent { label 'colobot-build' }
|
||||||
}
|
options {
|
||||||
|
buildDiscarder(logRotator(artifactDaysToKeepStr: '30', artifactNumToKeepStr: '20'))
|
||||||
node('master') {
|
|
||||||
stage('Pull changes') {
|
|
||||||
checkout scm
|
|
||||||
}
|
}
|
||||||
|
stages {
|
||||||
stage('Build Windows') {
|
stage('Check pull request target') {
|
||||||
sh 'mkdir -p build/windows'
|
when { changeRequest() }
|
||||||
dir('build/windows') {
|
steps {
|
||||||
sh '''
|
script {
|
||||||
cmake \
|
if (env.CHANGE_TARGET == 'master') {
|
||||||
-DCMAKE_INSTALL_PREFIX=/install \
|
throw "This pull request targets the wrong branch. Please reopen the pull request targetting the dev branch."
|
||||||
-DCMAKE_TOOLCHAIN_FILE=/opt/mxe/usr/i686-w64-mingw32.static/share/cmake/mxe-conf.cmake \
|
}
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=0 ../..
|
}
|
||||||
make
|
}
|
||||||
rm -rf install
|
|
||||||
DESTDIR=. make install
|
|
||||||
'''
|
|
||||||
}
|
}
|
||||||
sh 'rm -f windows-debug.zip'
|
stage('Build') {
|
||||||
zip zipFile: 'windows-debug.zip', archive: true, dir: 'build/windows/install'
|
parallel {
|
||||||
}
|
stage('Build Windows') {
|
||||||
|
steps {
|
||||||
stage('Build Linux') {
|
sh 'mkdir -p build/windows'
|
||||||
sh 'mkdir -p build/linux'
|
dir('build/windows') {
|
||||||
dir('build/linux') {
|
sh '''
|
||||||
sh '''
|
cmake \
|
||||||
cmake \
|
-DCMAKE_INSTALL_PREFIX=/install \
|
||||||
-DCMAKE_INSTALL_PREFIX=/install -DCOLOBOT_INSTALL_BIN_DIR=/install -DCOLOBOT_INSTALL_LIB_DIR=/install -DCOLOBOT_INSTALL_DATA_DIR=/install/data -DCOLOBOT_INSTALL_I18N_DIR=/install/lang -DCMAKE_SKIP_INSTALL_RPATH=ON \
|
-DCMAKE_TOOLCHAIN_FILE=/opt/mxe/usr/i686-w64-mingw32.static/share/cmake/mxe-conf.cmake \
|
||||||
-DBOOST_STATIC=ON -DGLEW_STATIC=ON -DGLEW_LIBRARY=/usr/lib64/libGLEW.a \
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=0 ../..
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=1 -DDESKTOP=0 ../..
|
make
|
||||||
make
|
rm -rf install
|
||||||
rm -rf install
|
DESTDIR=. make install
|
||||||
DESTDIR=. make install
|
'''
|
||||||
patchelf --set-rpath '.' install/colobot
|
}
|
||||||
'''
|
}
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
sh 'rm -f windows-debug.zip'
|
||||||
|
zip zipFile: 'windows-debug.zip', archive: true, dir: 'build/windows/install'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build Linux') {
|
||||||
|
steps {
|
||||||
|
sh 'mkdir -p build/linux'
|
||||||
|
dir('build/linux') {
|
||||||
|
sh '''
|
||||||
|
cmake \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=/install -DCOLOBOT_INSTALL_BIN_DIR=/install -DCOLOBOT_INSTALL_LIB_DIR=/install -DCOLOBOT_INSTALL_DATA_DIR=/install/data -DCOLOBOT_INSTALL_I18N_DIR=/install/lang -DCMAKE_SKIP_INSTALL_RPATH=ON \
|
||||||
|
-DBOOST_STATIC=ON -DGLEW_STATIC=ON -DGLEW_LIBRARY=/usr/lib64/libGLEW.a \
|
||||||
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=1 -DDESKTOP=0 ../..
|
||||||
|
make
|
||||||
|
rm -rf install
|
||||||
|
DESTDIR=. make install
|
||||||
|
patchelf --set-rpath '.' install/colobot
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
sh 'rm -f linux-debug.zip'
|
||||||
|
zip zipFile: 'linux-debug.zip', archive: true, dir: 'build/linux/install'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Run colobot-lint
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sh 'rm -f linux-debug.zip'
|
|
||||||
zip zipFile: 'linux-debug.zip', archive: true, dir: 'build/linux/install'
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Doxygen') {
|
stage('Generate docs') {
|
||||||
dir('build/linux') {
|
steps {
|
||||||
sh 'make doc'
|
dir('build/linux') {
|
||||||
|
sh 'make doc'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
publishHTML target: [$class: 'HtmlPublisherTarget', reportName: 'Doxygen', reportDir: 'build/linux/doc/html', reportFiles: 'index.html']
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
publishHTML target: [$class: 'HtmlPublisherTarget', reportName: 'Doxygen', reportDir: 'build/linux/doc/html', reportFiles: 'index.html']
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Run tests') {
|
stage('Run tests') {
|
||||||
dir('build/linux') {
|
steps {
|
||||||
sh './colobot_ut --gtest_output=xml:gtestresults.xml || true'
|
dir('build/linux') {
|
||||||
|
sh './colobot_ut --gtest_output=xml:gtestresults.xml || true'
|
||||||
|
}
|
||||||
|
step([$class: 'XUnitBuilder', testTimeMargin: '3000', thresholdMode: 1, thresholds: [[$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '0'], [$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']], tools: [[$class: 'GoogleTestType', deleteOutputFiles: true, failIfNotNew: true, pattern: 'build/linux/gtestresults.xml', skipNoTestFiles: false, stopProcessingIfError: true]]])
|
||||||
|
}
|
||||||
|
// TODO: Maybe run Windows tests using wine as well?
|
||||||
}
|
}
|
||||||
step([$class: 'XUnitBuilder', testTimeMargin: '3000', thresholdMode: 1, thresholds: [[$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '0'], [$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']], tools: [[$class: 'GoogleTestType', deleteOutputFiles: true, failIfNotNew: true, pattern: 'build/linux/gtestresults.xml', skipNoTestFiles: false, stopProcessingIfError: true]]])
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clean workspace after building pull requests
|
|
||||||
// to save disk space on the Jenkins host
|
|
||||||
if (env.BRANCH_NAME.startsWith('PR-')) {
|
|
||||||
cleanWs()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue