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,20 +1,25 @@
|
||||||
#!/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('Check pull request target') {
|
||||||
|
when { changeRequest() }
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
if (env.CHANGE_TARGET == 'master') {
|
||||||
|
throw "This pull request targets the wrong branch. Please reopen the pull request targetting the dev branch."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Build') {
|
||||||
|
parallel {
|
||||||
stage('Build Windows') {
|
stage('Build Windows') {
|
||||||
|
steps {
|
||||||
sh 'mkdir -p build/windows'
|
sh 'mkdir -p build/windows'
|
||||||
dir('build/windows') {
|
dir('build/windows') {
|
||||||
sh '''
|
sh '''
|
||||||
|
@ -27,11 +32,17 @@ node('master') {
|
||||||
DESTDIR=. make install
|
DESTDIR=. make install
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
success {
|
||||||
sh 'rm -f windows-debug.zip'
|
sh 'rm -f windows-debug.zip'
|
||||||
zip zipFile: 'windows-debug.zip', archive: true, dir: 'build/windows/install'
|
zip zipFile: 'windows-debug.zip', archive: true, dir: 'build/windows/install'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('Build Linux') {
|
stage('Build Linux') {
|
||||||
|
steps {
|
||||||
sh 'mkdir -p build/linux'
|
sh 'mkdir -p build/linux'
|
||||||
dir('build/linux') {
|
dir('build/linux') {
|
||||||
sh '''
|
sh '''
|
||||||
|
@ -45,27 +56,40 @@ node('master') {
|
||||||
patchelf --set-rpath '.' install/colobot
|
patchelf --set-rpath '.' install/colobot
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
success {
|
||||||
sh 'rm -f linux-debug.zip'
|
sh 'rm -f linux-debug.zip'
|
||||||
zip zipFile: 'linux-debug.zip', archive: true, dir: 'build/linux/install'
|
zip zipFile: 'linux-debug.zip', archive: true, dir: 'build/linux/install'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('Doxygen') {
|
// TODO: Run colobot-lint
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Generate docs') {
|
||||||
|
steps {
|
||||||
dir('build/linux') {
|
dir('build/linux') {
|
||||||
sh 'make doc'
|
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') {
|
||||||
|
steps {
|
||||||
dir('build/linux') {
|
dir('build/linux') {
|
||||||
sh './colobot_ut --gtest_output=xml:gtestresults.xml || true'
|
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]]])
|
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?
|
||||||
// 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