1def pull() { 2 try { 3 checkout scm: [$class: 'MercurialSCM', 4 source: 'https://bitbucket.org/sinbad/ogre', 5 revision: 'default', 6 clean: false] 7 } catch(Exception e) { 8 // mac runner is flaky 9 } 10} 11 12def test_android() { 13 node("Ubuntu") { 14 pull() 15 16 stage("Android Build") { 17 env.ANDROID_NDK = pwd()+"/android-ndk-r13b" 18 env.ANDROID_SDK = "none" 19 sh "ANDROID=TRUE cmake -P ci-build.cmake" 20 sh "cmake --build ." 21 } 22 } 23} 24 25def test_ios() { 26 node("mac") { 27 pull() 28 29 stage("ios Build") { 30 sh "IOS=TRUE cmake -P ci-build.cmake" 31 sh "cmake --build ." 32 } 33 } 34} 35 36def test_platform(label, isstatic) { 37 node(label) { 38 pull() 39 40 def type = isstatic == "TRUE" ? "static" : "shared" 41 42 stage("${label} (${type}) Build") { 43 def common = " -DOGRE_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DOGRE_STATIC=${isstatic} ." 44 if(isUnix()) { 45 if(label == "mac") { 46 common += " -G Xcode" 47 } 48 49 sh "cmake -DOGRE_BUILD_DEPENDENCIES=OFF -DCMAKE_CXX_FLAGS=-Werror ${common}" 50 51 if(label == "mac") { 52 sh "cmake --build . -- ONLY_ACTIVE_ARCH=YES" 53 } else { 54 sh "cmake --build ." 55 } 56 } else { 57 def cxxflags = '-DGTEST_HAS_TR1_TUPLE=0 -EHsc' 58 if(isstatic == "FALSE") { 59 cxxflags += " -WX" 60 } 61 62 bat """cmake -DOGRE_BUILD_COMPONENT_PROPERTY=FALSE -DOGRE_BUILD_RENDERSYSTEM_GL=FALSE -DCMAKE_CXX_FLAGS="${cxxflags}" ${common}""" 63 bat "cmake --build ." 64 } 65 } 66 if(label == "Ubuntu") { 67 stage("${label} (${type}) Test") { 68 sh "xvfb-run -a bin/Test_Ogre" 69 } 70 } 71 } 72} 73 74bitbucketStatusNotify ( buildState: 'INPROGRESS' ) 75try { 76 parallel (failFast: false, 77 linux_static: { test_platform("Ubuntu", "TRUE") }, 78 linux_dynamic: { test_platform("Ubuntu", "FALSE") }, 79 android: { test_android() }, 80 mac_dynamic: { test_platform("mac", "FALSE") }, 81 mac_static: { test_platform("mac", "TRUE") }, 82 ios: { test_ios() }, 83 windows_static: { test_platform("windows", "TRUE") }, 84 windows_dynamic: { test_platform("windows", "FALSE") } 85 ) 86 bitbucketStatusNotify ( buildState: 'SUCCESSFUL' ) 87} catch(Exception e) { 88 bitbucketStatusNotify ( buildState: 'FAILED' ) 89} 90