Skip to content

Commit

Permalink
Added Jenkinsfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
bilke committed Jan 20, 2016
1 parent 5695c19 commit 2a24099
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 55 deletions.
4 changes: 4 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node('master') {
checkout scm
load 'scripts/jenkins/gcc.groovy'
}
79 changes: 24 additions & 55 deletions scripts/jenkins/gcc.groovy
Original file line number Diff line number Diff line change
@@ -1,71 +1,40 @@
defaultCMakeOptions = '-DOGS_LIB_BOOST=System -DOGS_LIB_VTK=System'

node('docker')
{
// Checks out into subdirectory ogs
stage 'Checkout'
checkout([$class: 'GitSCM',
branches: [[name: '*/master']],
doGenerateSubmoduleConfigurations: false,
extensions:
[[$class: 'RelativeTargetDirectory', relativeTargetDir: 'ogs']],
submoduleCfg: [],
userRemoteConfigs:
[[url: 'https://github.com/ufz/ogs']]])


// Multiple configurations are build in parallel
parallel linux: {
docker.image('ogs6/gcc-ogs-cli:latest').inside
{
build 'build', '', 'package'
dir('ogs') {
checkout scm
}

stage 'Test'
sh '''cd build
make tests'''
}
},

linux_gui: {
docker.image('ogs6/gcc-ogs-gui:latest').inside {
build 'build_gui', '-DOGS_BUILD_GUI=ON -DOGS_BUILD_TESTS=OFF -DOGS_BUILD_CLI=OFF', 'package'
}
stage 'Build'
docker.image('ogs6/gcc-ogs-base:latest').inside {
build 'build', '', 'package tests ctest'
}

// windows: {
// docker.image('ogs6/mingw-ogs-gui:latest').inside
// {
// build 'build_win', '-DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE', 'package'
//
// stage 'Test'
// sh '''cd build_win
// rm -rf tests/testrunner.xml
// wine bin/testrunner.exe --gtest_output=xml:./tests/testrunner.xml'''
// }
// },
//
// windows_gui: {
// docker.image('ogs6/mingw-ogs-gui:latest').inside
// {
// build 'build_win_gui',
// '-DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE -DOGS_BUILD_GUI=ON -DOGS_BUILD_TESTS=OFF -DOGS_BUILD_CLI=OFF',
// 'package'
// }
// }
publishTestReports 'build/Testing/**/*.xml', 'build/Tests/testrunner.xml'

// end parallel

step([$class: 'JUnitResultArchiver',
testResults: 'build/tests/testrunner.xml,build_win/tests/testrunner.xml'])

archive 'build*/*.tar.gz,build_win*/*.zip'
} // end node
// archive 'build*/*.tar.gz'
}


def build(buildDir, cmakeOptions, target) {
sh "rm -rf ${buildDir} && mkdir ${buildDir}"

stage 'Configure'
sh "cd ${buildDir} && cmake ../ogs ${cmakeOptions}"
sh "cd ${buildDir} && cmake ../ogs ${defaultCMakeOptions} ${cmakeOptions}"

stage 'Build'
sh "cd ${buildDir} && make -j 2 ${target}"
sh "cd ${buildDir} && make -j 4 ${target}"
}

def publishTestReports(ctestPattern, gtestPattern) {
step([$class: 'XUnitPublisher', testTimeMargin: '3000', thresholdMode: 1,
thresholds: [
[$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: ''],
[$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']],
tools: [
[$class: 'CTestType', deleteOutputFiles: true, failIfNotNew: true, pattern: "${ctestPattern}", skipNoTestFiles: false, stopProcessingIfError: true],
[$class: 'GoogleTestType', deleteOutputFiles: true, failIfNotNew: true, pattern: "${gtestPattern}", skipNoTestFiles: false, stopProcessingIfError: true]]
])
}

0 comments on commit 2a24099

Please sign in to comment.