Update Jenkinsfile for dockerized build environment (#1240)

1008-fix
krzys_h 2019-02-18 19:18:53 +01:00 committed by GitHub
parent a46750ede2
commit e02a3373fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 7 deletions

28
Jenkinsfile vendored
View File

@ -1,7 +1,7 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
pipeline { pipeline {
agent { label 'colobot-build' } agent none
options { options {
buildDiscarder(logRotator(artifactDaysToKeepStr: '30', artifactNumToKeepStr: '20')) buildDiscarder(logRotator(artifactDaysToKeepStr: '30', artifactNumToKeepStr: '20'))
} }
@ -19,13 +19,17 @@ pipeline {
stage('Build') { stage('Build') {
parallel { parallel {
stage('Build Windows') { stage('Build Windows') {
agent {
docker { image 'krzysh/colobot-build:latest' }
}
steps { steps {
sh 'mkdir -p build/windows' sh 'mkdir -p build/windows'
dir('build/windows') { dir('build/windows') {
sh ''' sh '''
cmake \ # FIXME: without -lsetupapi linking sdl2 fails
/opt/mxe/usr/bin/i686-w64-mingw32.static-cmake \
-DCMAKE_CXX_STANDARD_LIBRARIES="-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -lsetupapi" \
-DCMAKE_INSTALL_PREFIX=/install \ -DCMAKE_INSTALL_PREFIX=/install \
-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 ../.. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=0 ../..
make make
rm -rf install rm -rf install
@ -42,13 +46,15 @@ pipeline {
} }
stage('Build Linux') { stage('Build Linux') {
agent {
docker { image 'krzysh/colobot-build:latest' }
}
steps { steps {
sh 'mkdir -p build/linux' sh 'mkdir -p build/linux'
dir('build/linux') { dir('build/linux') {
sh ''' sh '''
cmake \ 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 \ -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 ../.. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=1 -DDESKTOP=0 ../..
make make
rm -rf install rm -rf install
@ -68,6 +74,9 @@ pipeline {
} }
stage('Generate docs') { stage('Generate docs') {
agent {
docker { image 'krzysh/colobot-build:latest' }
}
steps { steps {
dir('build/linux') { dir('build/linux') {
sh 'make doc' sh 'make doc'
@ -81,6 +90,9 @@ pipeline {
} }
stage('Run tests') { stage('Run tests') {
agent {
docker { image 'krzysh/colobot-build:latest' }
}
steps { 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'
@ -91,6 +103,9 @@ pipeline {
} }
stage('Run colobot-lint') { stage('Run colobot-lint') {
agent {
label 'colobot-build'
}
environment { environment {
CC = '/usr/lib/llvm-3.6/bin/clang' CC = '/usr/lib/llvm-3.6/bin/clang'
CXX = '/usr/lib/llvm-3.6/bin/clang++' CXX = '/usr/lib/llvm-3.6/bin/clang++'
@ -245,11 +260,10 @@ exit $ret
} }
} }
// TODO: cppcheck publisher STILL doesn't have pipeline support publishCppcheck pattern: 'build/lint/colobot_lint_report.xml'
// There is an open pull request though, merged but no release yet... https://github.com/jenkinsci/cppcheck-plugin/pull/36
publishHTML([reportName: 'Colobot-lint HTML report', reportDir: 'build/lint/html_report', reportFiles: 'index.html', reportTitles: '', allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true]) publishHTML([reportName: 'Colobot-lint HTML report', reportDir: 'build/lint/html_report', reportFiles: 'index.html', reportTitles: '', allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true])
} }
} }
} }
} }