forked from colobot/colobot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
71 lines (64 loc) · 3.1 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
#!/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') {
error("This pull request targets the wrong branch. Please reopen the pull request targetting the dev branch.")
}
node('master') {
stage('Pull changes') {
checkout scm
}
stage('Build Windows') {
sh 'mkdir -p build/windows'
dir('build/windows') {
sh '''
cmake \
-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 ../..
make
rm -rf install
DESTDIR=. make install
'''
}
sh 'rm -f windows-debug.zip'
zip zipFile: 'windows-debug.zip', archive: true, dir: 'build/windows/install'
}
stage('Build Linux') {
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
'''
}
sh 'rm -f linux-debug.zip'
zip zipFile: 'linux-debug.zip', archive: true, dir: 'build/linux/install'
}
stage('Doxygen') {
dir('build/linux') {
sh 'make doc'
}
publishHTML target: [$class: 'HtmlPublisherTarget', reportName: 'Doxygen', reportDir: 'build/linux/doc/html', reportFiles: 'index.html']
}
stage('Run tests') {
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]]])
}
// Clean workspace after building pull requests
// to save disk space on the Jenkins host
if (env.BRANCH_NAME.startsWith('PR-')) {
cleanWs()
}
}