cpp_ethereum.py
1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 4 import factory 5 reload(factory) 6 from factory import * 7 8 @properties.renderer 9 def get_cpp_revision(props): 10 if 'got_revision' in props: 11 return props['got_revision']['cpp-ethereum'] 12 return None 13 14 @properties.renderer 15 def get_short_revision(props): 16 if 'got_revision' in props: 17 return props['got_revision']['cpp-ethereum'][:7] 18 return None 19 20 21 def testeth_cmd(cmd=[], evmjit=False): 22 if evmjit: 23 cmd += ['--vm', 'jit'] 24 return cmd 25 26 def cmake_cmd(cmd=[], ccache=True, evmjit=False, headless=True): 27 # cmd.append("-DBUNDLE=default") 28 cmd.append("-DFATDB=1") 29 if headless: 30 cmd.append("-DGUI=0") 31 if evmjit: 32 cmd.append("-DEVMJIT=1") 33 elif ccache: 34 cmd.append("-DEVMJIT=0") 35 cmd.append("-DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++") 36 return cmd 37 38 39 def cpp_ethereum_factory(branch='master', deb=False, evmjit=False, headless=True): 40 factory = BuildFactory() 41 42 for step in [ 43 Git( 44 haltOnFailure=True, 45 logEnviron=False, 46 repourl='https://github.com/ethereum/cpp-ethereum.git', 47 branch=branch, 48 mode='full', 49 method='copy', 50 codebase='cpp-ethereum', 51 retry=(5, 3) 52 ), 53 Git( 54 haltOnFailure=True, 55 logEnviron=False, 56 repourl='https://github.com/ethereum/tests.git', 57 branch=branch, 58 mode='incremental', 59 codebase='tests', 60 retry=(5, 3), 61 workdir='tests' 62 ), 63 SetPropertyFromCommand( 64 haltOnFailure=True, 65 logEnviron=False, 66 name="set-protocol", 67 command='sed -ne "s/.*c_protocolVersion = \(.*\);/\\1/p" libethcore/Common.cpp', 68 property="protocol" 69 ), 70 SetPropertyFromCommand( 71 haltOnFailure=True, 72 logEnviron=False, 73 name="set-version", 74 command='sed -ne "s/^set(PROJECT_VERSION \\"\(.*\)\\")$/\\1/p" CMakeLists.txt', 75 property="version" 76 ), 77 Configure( 78 haltOnFailure=True, 79 logEnviron=False, 80 command=cmake_cmd(["cmake", "."], evmjit=evmjit, headless=headless), 81 env={"PATH": "${QTDIR}/bin:${PATH}"} 82 ), 83 Compile( 84 haltOnFailure=True, 85 logEnviron=False, 86 command="make -j $(cat /proc/cpuinfo | grep processor | wc -l)" 87 ), 88 ShellCommand( 89 haltOnFailure=True, 90 logEnviron=False, 91 name="make-install", 92 description="installing", 93 descriptionDone="install", 94 command=["make", "install"] 95 ), 96 ShellCommand( 97 haltOnFailure=True, 98 logEnviron=False, 99 name="ldconfig", 100 description="running ldconfig", 101 descriptionDone="ldconfig", 102 command=["ldconfig"] 103 ), 104 Test( 105 haltOnFailure=True, 106 warnOnFailure=True, 107 logEnviron=False, 108 name="test-cpp", 109 description="testing", 110 descriptionDone="test", 111 command=testeth_cmd(["./testeth"], evmjit=evmjit), 112 env={ 113 'CTEST_OUTPUT_ON_FAILURE': '1', 114 'ETHEREUM_TEST_PATH': Interpolate('%(prop:workdir)s/tests'), 115 'EVMJIT': '-cache=0' 116 }, 117 workdir="build/test", 118 maxTime=900 119 ) 120 ]: factory.addStep(step) 121 122 # Trigger check and integration builders 123 if not evmjit and not headless: 124 for step in [ 125 Trigger( 126 schedulerNames=["cpp-ethereum-%s-check" % branch], 127 waitForFinish=False, 128 set_properties={ 129 "protocol": Interpolate("%(prop:protocol)s"), 130 "version": Interpolate("%(prop:version)s") 131 }) 132 ]: factory.addStep(step) 133 134 # if branch is not 'master': 135 # for step in [ 136 # Trigger( 137 # schedulerNames=["cpp-ethereum-integration"], 138 # waitForFinish=False, 139 # set_properties={ 140 # "database": Interpolate("%(prop:database)s"), 141 # "protocol": Interpolate("%(prop:protocol)s"), 142 # "version": Interpolate("%(prop:version)s") 143 # }) 144 # ]: factory.addStep(step) 145 146 # Trigger deb builders 147 if not evmjit and headless: 148 if deb: 149 for architecture in ['i386', 'amd64']: 150 for distribution in distributions: 151 for step in [ 152 Trigger( 153 schedulerNames=["cpp-ethereum-%s-%s-%s" % (branch, architecture, distribution)], 154 waitForFinish=False, 155 set_properties={ 156 "version": Interpolate("%(prop:version)s") 157 }) 158 ]: factory.addStep(step) 159 160 # Trigger PoC server buildslave 161 if deb and not evmjit and headless: 162 for step in [ 163 Trigger( 164 schedulerNames=["cpp-ethereum-%s-server" % branch], 165 waitForFinish=False, 166 set_properties={ 167 "protocol": Interpolate("%(prop:protocol)s"), 168 "version": Interpolate("%(prop:version)s") 169 } 170 ) 171 ]: factory.addStep(step) 172 173 return factory 174 175 176 def cpp_check_factory(branch='develop'): 177 factory = BuildFactory() 178 179 for step in [ 180 Git( 181 haltOnFailure=True, 182 logEnviron=False, 183 repourl='https://github.com/ethereum/cpp-ethereum.git', 184 branch=branch, 185 mode='full', 186 method='copy', 187 codebase='cpp-ethereum', 188 retry=(5, 3) 189 ), 190 WarningCountingShellCommand( 191 logEnviron=False, 192 name="cppcheck", 193 description="running cppcheck", 194 descriptionDone="cppcheck", 195 command=["cppcheck", "--force", "--enable=all", "--template", "gcc", "."] 196 ) 197 ]: factory.addStep(step) 198 199 return factory