def MakeWinLegacyBuilder(): f = BuildFactory() f.addSteps(svn_co_legacy) f.addStep(ShellCommand( name = 'revision', command = ['cmd', '/c', 'revision.cmd'], workdir = 'build/os/win32', env = { 'SCHAT_VERSION': SCHAT_VERSION_LEGACY, 'SCHAT_REVISION': Property('got_revision') }, haltOnFailure = True, )) f.addStep(ShellCommand( name = 'qmake', command = ['qmake', '-r'], haltOnFailure = True, )) f.addStep(Compile( command = ['jom', '-j3', '/NOLOGO'], haltOnFailure = True, )) f.addStep(ShellCommand( name = 'nsis', command = ['cmd', '/c', 'nsis.cmd'], workdir = 'build/os/win32', env = { 'SCHAT_SIGN_FILE': schat_passwords.SIGN_FILE, 'SCHAT_SIGN_PASSWORD': schat_passwords.SIGN_PASSWORD, 'SCHAT_VERSION': SCHAT_VERSION_LEGACY, 'SCHAT_REVISION': Property('got_revision') }, haltOnFailure = True, logEnviron = False, )) f.addStep(FileUpload( mode = 0644, slavesrc = WithProperties('os/win32/out/schat-%(version_legacy)s.%(got_revision)s.exe'), masterdest = UploadFileNameLegacy('schat-%(version_legacy)s.%(got_revision)s.exe'), ))
def MakeWinBuilder(): f = BuildFactory() f.addSteps(svn_co) f.addStep(ShellCommand( name = 'revision', command = ['cmd', '/c', 'revision.cmd'], workdir = 'build/os/win32', env = { 'SCHAT_REVISION': Property('got_revision') }, haltOnFailure = True, )) f.addStep(ShellCommand( name = 'qmake', command = ['qmake', '-r'], haltOnFailure = True, )) f.addStep(Compile( command = ['jom', '-j3', '/NOLOGO'], haltOnFailure = True, )) f.addStep(ShellCommand( name = 'nsis', command = ['cmd', '/c', 'nsis.cmd'], workdir = 'build/os/win32', env = { 'SCHAT_SIGN_FILE': schat_passwords.SIGN_FILE, 'SCHAT_SIGN_PASSWORD': schat_passwords.SIGN_PASSWORD, 'SCHAT_VERSION': SCHAT_VERSION, 'SCHAT_REVISION': Property('got_revision') }, haltOnFailure = True, logEnviron = False, )) f.addStep(FileUpload( mode = 0644, slavesrc = WithProperties('os/win32/out/schat2-%(version)s.exe'), masterdest = UploadFileName('schat2-%(version)s%(suffix)s.exe'), url = WithProperties('https://download.schat.me/schat2/snapshots/%(version)s/r%(got_revision)s/schat2-%(version)s%(suffix)s.exe'), ))
def test_addSteps(self): factory = BuildFactory() factory.addSteps([BuildStep(), BuildStep()]) self.assertEqual( factory.steps, [_BuildStepFactory(BuildStep), _BuildStepFactory(BuildStep)])
def masterConfig(use_with=False): c = {} from buildbot.config import BuilderConfig from buildbot.process.factory import BuildFactory from buildbot.plugins import schedulers, steps c['schedulers'] = [ schedulers.ForceScheduler( name="force", builderNames=["testy"])] c['secretsProviders'] = [FakeSecretStorage( secretdict={"foo": "bar", "something": "more"})] f = BuildFactory() if use_with: secrets_list = [("pathA", Interpolate('%(secret:something)s'))] with f.withSecrets(secrets_list): f.addStep(steps.ShellCommand(command=Interpolate('echo %(secret:foo)s'))) else: f.addSteps([steps.ShellCommand(command=Interpolate('echo %(secret:foo)s'))], withSecrets=[("pathA", Interpolate('%(secret:something)s'))]) c['builders'] = [ BuilderConfig(name="testy", workernames=["local1"], factory=f)] return c
def create_factory(): factory = BuildFactory() factory.addSteps(common.initTargetProperty()) factory.addSteps(common.initNameProperty()) factory.addStep( steps.Trigger(name="Call the 'build' scheduler", schedulerNames=['build'], waitForFinish=True, haltOnFailure=True, copy_properties=COMMON_PROPERTIES, set_properties={ 'virtual_builder_name': util.Interpolate('Build for %(prop:box)s'), })) factory.addStep( steps.Trigger(name="Call the 'run_test' scheduler", schedulerNames=['run_test'], waitForFinish=True, copy_properties=COMMON_PROPERTIES, set_properties={ 'test_branch': util.Property('branch'), "test_set": common.renderTestSet, "use_valgrind": util.Property("use_valgrind"), "use_callgrind": util.Property("use_callgrind"), "backend_ssl": util.Property("backend_ssl") })) return factory
def createFactory(): factory = BuildFactory() factory.addSteps(common.initTargetProperty()) factory.addStep(steps.Trigger( name="Call the 'build' scheduler. Build CentOS", schedulerNames=['build'], waitForFinish=True, haltOnFailure=True, copy_properties=COMMON_BUILD_AND_TEST_SNAPSHOT_PROPERTIES, set_properties={ "box": util.Property("box"), 'try_already_running': 'yes', "target": util.Property("target"), 'virtual_builder_name': util.Interpolate('Build for %(prop:box)s'), } )) factory.addStep(steps.Trigger( name="Call the 'run_test_snapshot' scheduler. Run functional tests", schedulerNames=['run_test_snapshot'], waitForFinish=True, copy_properties=COMMON_BUILD_AND_TEST_SNAPSHOT_PROPERTIES, set_properties={ "box": util.Property("box"), "target": util.Property("target"), "test_branch": util.Property("branch"), "test_set": common.renderTestSet, "backend_ssl": util.Property("backend_ssl"), "use_valgrind": util.Property("use_valgrind"), } )) return factory
def MakeMacBuilder(): f = BuildFactory() f.addSteps(svn_co) f.addStep( ShellCommand( name='revision', command=['bash', 'revision.sh'], workdir='build/os/macosx', haltOnFailure=True, env={'SCHAT_REVISION': Property('got_revision')}, )) f.addStep( ShellCommand( name='dmg', command=['bash', 'deploy.sh'], workdir='build/os/macosx', haltOnFailure=True, )) f.addStep( FileUpload( mode=0644, slavesrc=WithProperties( 'os/macosx/dmg/SimpleChat2-%(version)s.dmg'), masterdest=UploadFileName('SimpleChat2-%(version)s%(suffix)s.dmg'), url=WithProperties( 'https://download.schat.me/schat2/snapshots/%(version)s/r%(got_revision)s/SimpleChat2-%(version)s%(suffix)s.dmg' ), ))
def masterConfig(use_with=False): c = {} from buildbot.config import BuilderConfig from buildbot.process.factory import BuildFactory from buildbot.plugins import schedulers, steps c['schedulers'] = [ schedulers.ForceScheduler(name="force", builderNames=["testy"]) ] c['secretsProviders'] = [ FakeSecretStorage(secretdict={ "foo": "bar", "something": "more" }) ] f = BuildFactory() if use_with: secrets_list = [("pathA", Interpolate('%(secret:something)s'))] with f.withSecrets(secrets_list): f.addStep( steps.ShellCommand(command=Interpolate('echo %(secret:foo)s'))) else: f.addSteps( [steps.ShellCommand(command=Interpolate('echo %(secret:foo)s'))], withSecrets=[("pathA", Interpolate('%(secret:something)s'))]) c['builders'] = [ BuilderConfig(name="testy", workernames=["local1"], factory=f) ] return c
def create_factory(): factory = BuildFactory() factory.addSteps(common.initTargetProperty()) factory.addStep( steps.Trigger(name="Call the 'build' scheduler", schedulerNames=['build'], waitForFinish=True, haltOnFailure=True, copy_properties=COMMON_PROPERTIES, set_properties={ 'virtual_builder_name': util.Interpolate('Build for %(prop:box)s'), 'box': 'ubuntu_bionic_libvirt', 'try_already_running': 'no', })) factory.addStep( steps.Trigger(name="Call the 'run_performance_test' scheduler", schedulerNames=['run_performance_test_trigger'], waitForFinish=True, copy_properties=COMMON_PROPERTIES, set_properties={ 'test_branch': util.Property('branch'), 'host': 'max-tst-01', })) return factory
def MakeDebBuilder(): f = BuildFactory() f.addSteps(svn_co) f.addStep( ShellCommand( name='revision', command=['bash', 'revision.sh'], workdir='build/os/ubuntu', haltOnFailure=True, env={'SCHAT_REVISION': Property('got_revision')}, )) f.addStep( ShellCommand( name='deb', command=['bash', 'build.sh'], workdir='build/os/ubuntu', env={'SCHAT_VERSION': SCHAT_VERSION}, haltOnFailure=True, )) f.addStep( FileUpload( mode=0644, slavesrc=WithProperties( 'os/ubuntu/deb/schat2_%(version)s-1~%(codename)s_%(arch)s.deb' ), masterdest=UploadFileName( 'schat2_%(version)s-1~%(codename)s%(suffix)s_%(arch)s.deb'), url=WithProperties( 'https://download.schat.me/schat2/snapshots/%(version)s/r%(got_revision)s/schat2_%(version)s-1~%(codename)s%(suffix)s_%(arch)s.deb' ), ))
def make_bundler_builder(self): builder_name = "builder_bundler" factory = BuildFactory() repo_name = "bitmask_bundler" repo_url = "https://github.com/leapcode/" + repo_name + ".git" branch = "develop" workdir = "build" repo_dir = workdir + "/" + repo_name bundler_output_dir = "bundler_output" sumo_tarball = "leap.bitmask-latest-SUMO.tar.gz" publish_bundle = self._publish_bundle_command( '`ls -t *.tar.gz | head -1`') factory.addSteps([ steps.Git(repourl=repo_url, branch=branch, workdir=repo_dir, mode='full', method='clobber', shallow=True, haltOnFailure=True, name="Pull " + repo_url), steps.ShellCommand(command="rm -rf " + bundler_output_dir, workdir=workdir, name="Remove previous bundler dir"), steps.ShellCommand(command="mkdir " + bundler_output_dir, workdir=workdir, name="Create bundler dir"), steps.ShellCommand(command="cp bundle_pyinstaller.sh ../" + bundler_output_dir, workdir=repo_dir, haltOnFailure=True, name="Copy bundle_pyinstaller"), steps.ShellCommand(command="mkdir files", workdir=workdir + '/' + bundler_output_dir, name="Create auxiliary folder"), steps.ShellCommand( command="wget http://lizard.leap.se/sumo-tarball/%s" % sumo_tarball, workdir=workdir + '/' + bundler_output_dir, haltOnFailure=True, name="Download sumo"), steps.ShellCommand(command="./bundle_pyinstaller.sh " + sumo_tarball, workdir=workdir + '/' + bundler_output_dir, name="Create bundle"), steps.ShellCommand(command=publish_bundle, workdir=workdir + '/' + bundler_output_dir, name="Publish bundle") ]) return BuilderConfig(name=builder_name, slavenames=self.slaves.leap_names(), factory=factory)
def MakeObsBuilder(): f = BuildFactory() f.addSteps(svn_co) f.addStep(ShellCommand( name = 'upload', command = ['bash', 'os/obs/obs-upload.sh', Property('project'), WithProperties('%(version)s.%(got_revision)s')], haltOnFailure = True, logEnviron = False )) return f
class TestBuildFactory(unittest.TestCase): def setUp(self): self.factory = BuildFactory() def test_init(self): step = BuildStep() self.factory = BuildFactory([step]) self.assertEqual(self.factory.steps, [_BuildStepFactory(BuildStep)]) def test_addStep(self): # create a string random string that will probably not collide # with what is already in the factory string = ''.join(choice(ascii_uppercase) for x in range(6)) length = len(self.factory.steps) step = BuildStep(name=string) self.factory.addStep(step) # check if the number of nodes grew by one self.assertTrue(length + 1, len(self.factory.steps)) # check if the 'right' node added in the factory self.assertEqual(self.factory.steps[-1], _BuildStepFactory(BuildStep, name=string)) def test_s(self): """ L{s} is deprecated, but pass keyword arguments to the first argument, to construct a step. """ stepFactory = s(BuildStep, name='test') self.assertEqual(stepFactory, _BuildStepFactory(BuildStep, name='test')) warnings = self.flushWarnings([self.test_s]) self.assertEqual(len(warnings), 1) self.assertEqual(warnings[0]['category'], DeprecationWarning) def test_addStep_notAStep(self): # This fails because object isn't adaptable to IBuildStepFactory with self.assertRaises(TypeError): self.factory.addStep(object()) def test_addStep_ArgumentsInTheWrongPlace(self): with self.assertRaises(TypeError): self.factory.addStep(BuildStep(), name="name") # this also raises a deprecation error, which we don't care about (see # test_s) self.flushWarnings() def test_addSteps(self): self.factory.addSteps([BuildStep(), BuildStep()]) self.assertEqual( self.factory.steps[-2:], [_BuildStepFactory(BuildStep), _BuildStepFactory(BuildStep)])
def MakeObsBuilder(): f = BuildFactory() f.addSteps(svn_co) f.addStep( ShellCommand(name='upload', command=[ 'bash', 'os/obs/obs-upload.sh', Property('project'), WithProperties('%(version)s.%(got_revision)s') ], haltOnFailure=True, logEnviron=False)) return f
def MakeMacLegacyBuilder(): f = BuildFactory() f.addSteps(svn_co_legacy) f.addStep(ShellCommand( name = 'dmg', command = ['bash', 'deploy.sh'], workdir = 'build/os/macosx', haltOnFailure = True, )) f.addStep(FileUpload( mode = 0644, slavesrc = WithProperties('os/macosx/dmg/SimpleChat-%(version_legacy)s.dmg'), masterdest = UploadFileNameLegacy('SimpleChat-%(version_legacy)s.dmg'), ))
def make_factory(branch, python, database): """ Generates the BuildFactory (e.g. set of build steps) for this (branch, python, database) combo. The series of steps is described in the module docstring, above. """ f = BuildFactory() f.addSteps([ buildsteps.DjangoSVN(branch=branch), buildsteps.DownloadVirtualenv(), buildsteps.UpdateVirtualenv(python=python, db=database), buildsteps.GenerateSettings(python=python, db=database), buildsteps.TestDjango(python=python, db=database, verbosity=1), ]) return f
def MakeSrcBuilder(): f = BuildFactory() f.addSteps(svn_co) f.addStep(ShellCommand( name = 'tarball', command = ['bash', 'os/source/tarball.sh'], env = {'SCHAT_SOURCE': WithProperties('schat2-src-%(version)s%(suffix)s')}, haltOnFailure = True, )) f.addStep(FileUpload( mode = 0644, slavesrc = WithProperties('schat2-src-%(version)s%(suffix)s.tar.bz2'), masterdest = UploadFileName('schat2-src-%(version)s%(suffix)s.tar.bz2'), url = WithProperties('https://download.schat.me/schat2/snapshots/%(version)s/r%(got_revision)s/schat2-src-%(version)s%(suffix)s.tar.bz2'), ))
def MakeWinLegacyBuilder(): f = BuildFactory() f.addSteps(svn_co_legacy) f.addStep( ShellCommand( name='revision', command=['cmd', '/c', 'revision.cmd'], workdir='build/os/win32', env={ 'SCHAT_VERSION': SCHAT_VERSION_LEGACY, 'SCHAT_REVISION': Property('got_revision') }, haltOnFailure=True, )) f.addStep( ShellCommand( name='qmake', command=['qmake', '-r'], haltOnFailure=True, )) f.addStep(Compile( command=['jom', '-j3', '/NOLOGO'], haltOnFailure=True, )) f.addStep( ShellCommand( name='nsis', command=['cmd', '/c', 'nsis.cmd'], workdir='build/os/win32', env={ 'SCHAT_SIGN_FILE': schat_passwords.SIGN_FILE, 'SCHAT_SIGN_PASSWORD': schat_passwords.SIGN_PASSWORD, 'SCHAT_VERSION': SCHAT_VERSION_LEGACY, 'SCHAT_REVISION': Property('got_revision') }, haltOnFailure=True, logEnviron=False, )) f.addStep( FileUpload( mode=0644, slavesrc=WithProperties( 'os/win32/out/schat-%(version_legacy)s.%(got_revision)s.exe'), masterdest=UploadFileNameLegacy( 'schat-%(version_legacy)s.%(got_revision)s.exe'), ))
def MakeMacLegacyBuilder(): f = BuildFactory() f.addSteps(svn_co_legacy) f.addStep( ShellCommand( name='dmg', command=['bash', 'deploy.sh'], workdir='build/os/macosx', haltOnFailure=True, )) f.addStep( FileUpload( mode=0644, slavesrc=WithProperties( 'os/macosx/dmg/SimpleChat-%(version_legacy)s.dmg'), masterdest=UploadFileNameLegacy( 'SimpleChat-%(version_legacy)s.dmg'), ))
def MakeWinBuilder(): f = BuildFactory() f.addSteps(svn_co) f.addStep( ShellCommand( name='revision', command=['cmd', '/c', 'revision.cmd'], workdir='build/os/win32', env={'SCHAT_REVISION': Property('got_revision')}, haltOnFailure=True, )) f.addStep( ShellCommand( name='qmake', command=['qmake', '-r'], haltOnFailure=True, )) f.addStep(Compile( command=['jom', '-j3', '/NOLOGO'], haltOnFailure=True, )) f.addStep( ShellCommand( name='nsis', command=['cmd', '/c', 'nsis.cmd'], workdir='build/os/win32', env={ 'SCHAT_SIGN_FILE': schat_passwords.SIGN_FILE, 'SCHAT_SIGN_PASSWORD': schat_passwords.SIGN_PASSWORD, 'SCHAT_VERSION': SCHAT_VERSION, 'SCHAT_REVISION': Property('got_revision') }, haltOnFailure=True, logEnviron=False, )) f.addStep( FileUpload( mode=0644, slavesrc=WithProperties('os/win32/out/schat2-%(version)s.exe'), masterdest=UploadFileName('schat2-%(version)s%(suffix)s.exe'), url=WithProperties( 'https://download.schat.me/schat2/snapshots/%(version)s/r%(got_revision)s/schat2-%(version)s%(suffix)s.exe' ), ))
def create_factory(): factory = BuildFactory() factory.addSteps(common.initTargetProperty()) factory.addSteps(common.initNameProperty()) factory.addStep(common.determineBuildId()) buildProperties = COMMON_PROPERTIES.copy() buildProperties.update({ 'virtual_builder_name': util.Interpolate('Build for %(prop:box)s'), }) factory.addStep( steps.Trigger( name="Call the 'build' scheduler", schedulerNames=['build'], waitForFinish=True, set_properties=buildProperties, )) runTestProperties = COMMON_PROPERTIES.copy() runTestProperties.update({ "appendTestRunId": util.Property("appendTestRunId"), "backend_ssl": util.Property("backend_ssl"), "buildHosts": ["bb-host"], "buildId": util.Property("buildId"), "test_branch": util.Property('branch'), "use_callgrind": util.Property("use_callgrind"), "use_valgrind": util.Property("use_valgrind"), }) factory.addStep( ParallelRunTestTrigger( name="Call the 'run_test' for each test set", schedulerNames=['run_test'], waitForFinish=True, set_properties=runTestProperties, )) return factory
def MakeMacBuilder(): f = BuildFactory() f.addSteps(svn_co) f.addStep(ShellCommand( name = 'revision', command = ['bash', 'revision.sh'], workdir = 'build/os/macosx', haltOnFailure = True, env = { 'SCHAT_REVISION': Property('got_revision') }, )) f.addStep(ShellCommand( name = 'dmg', command = ['bash', 'deploy.sh'], workdir = 'build/os/macosx', haltOnFailure = True, )) f.addStep(FileUpload( mode = 0644, slavesrc = WithProperties('os/macosx/dmg/SimpleChat2-%(version)s.dmg'), masterdest = UploadFileName('SimpleChat2-%(version)s%(suffix)s.dmg'), url = WithProperties('https://download.schat.me/schat2/snapshots/%(version)s/r%(got_revision)s/SimpleChat2-%(version)s%(suffix)s.dmg'), ))
def MakePpaBuilder(): f = BuildFactory() f.addSteps(svn_co) f.addStep(ShellCommand( name = 'revision', command = ['bash', 'revision.sh'], workdir = 'build/os/ubuntu', haltOnFailure = True, env = { 'SCHAT_REVISION': Property('got_revision') }, )) f.addStep(ShellCommand( name = 'ppa', command = ['bash', 'ppa.sh'], workdir = 'build/os/ubuntu', env = { 'SCHAT_VERSION': SCHAT_VERSION, 'SCHAT_REVISION': Property('got_revision'), 'SCHAT_PPA': Property('ppa'), }, haltOnFailure = True, )) return f
def MakeDebBuilder(): f = BuildFactory() f.addSteps(svn_co) f.addStep(ShellCommand( name = 'revision', command = ['bash', 'revision.sh'], workdir = 'build/os/ubuntu', haltOnFailure = True, env = { 'SCHAT_REVISION': Property('got_revision') }, )) f.addStep(ShellCommand( name = 'deb', command = ['bash', 'build.sh'], workdir = 'build/os/ubuntu', env = { 'SCHAT_VERSION': SCHAT_VERSION }, haltOnFailure = True, )) f.addStep(FileUpload( mode = 0644, slavesrc = WithProperties('os/ubuntu/deb/schat2_%(version)s-1~%(codename)s_%(arch)s.deb'), masterdest = UploadFileName('schat2_%(version)s-1~%(codename)s%(suffix)s_%(arch)s.deb'), url = WithProperties('https://download.schat.me/schat2/snapshots/%(version)s/r%(got_revision)s/schat2_%(version)s-1~%(codename)s%(suffix)s_%(arch)s.deb'), ))
def MakePpaBuilder(): f = BuildFactory() f.addSteps(svn_co) f.addStep( ShellCommand( name='revision', command=['bash', 'revision.sh'], workdir='build/os/ubuntu', haltOnFailure=True, env={'SCHAT_REVISION': Property('got_revision')}, )) f.addStep( ShellCommand( name='ppa', command=['bash', 'ppa.sh'], workdir='build/os/ubuntu', env={ 'SCHAT_VERSION': SCHAT_VERSION, 'SCHAT_REVISION': Property('got_revision'), 'SCHAT_PPA': Property('ppa'), }, haltOnFailure=True, )) return f
def MakeSrcBuilder(): f = BuildFactory() f.addSteps(svn_co) f.addStep( ShellCommand( name='tarball', command=['bash', 'os/source/tarball.sh'], env={ 'SCHAT_SOURCE': WithProperties('schat2-src-%(version)s%(suffix)s') }, haltOnFailure=True, )) f.addStep( FileUpload( mode=0644, slavesrc=WithProperties( 'schat2-src-%(version)s%(suffix)s.tar.bz2'), masterdest=UploadFileName( 'schat2-src-%(version)s%(suffix)s.tar.bz2'), url=WithProperties( 'https://download.schat.me/schat2/snapshots/%(version)s/r%(got_revision)s/schat2-src-%(version)s%(suffix)s.tar.bz2' ), ))
class TestBuildFactory(unittest.TestCase): def setUp(self): self.factory = BuildFactory() def test_init(self): step = BuildStep() self.factory = BuildFactory([step]) self.assertEqual(self.factory.steps, [_BuildStepFactory(BuildStep)]) def test_addStep(self): # create a string random string that will probably not collide # with what is already in the factory string = ''.join(choice(ascii_uppercase) for x in range(6)) length = len(self.factory.steps) step = BuildStep(name=string) self.factory.addStep(step) # check if the number of nodes grew by one self.assertTrue(length + 1, len(self.factory.steps)) # check if the 'right' node added in the factory self.assertEqual(self.factory.steps[-1], _BuildStepFactory(BuildStep, name=string)) def test_addStep_deprecated_withArguments(self): """ Passing keyword arguments to L{BuildFactory.addStep} is deprecated, but pass the arguments to the first argument, to construct a step. """ self.factory.addStep(BuildStep, name='test') self.assertEqual(self.factory.steps[-1], _BuildStepFactory(BuildStep, name='test')) warnings = self.flushWarnings( [self.test_addStep_deprecated_withArguments]) self.assertEqual(len(warnings), 1) self.assertEqual(warnings[0]['category'], DeprecationWarning) def test_addStep_deprecated(self): """ Passing keyword arguments to L{BuildFactory.addStep} is deprecated, but pass the arguments to the first argument, to construct a step. """ self.factory.addStep(BuildStep) self.assertEqual(self.factory.steps[-1], _BuildStepFactory(BuildStep)) warnings = self.flushWarnings([self.test_addStep_deprecated]) self.assertEqual(len(warnings), 1) self.assertEqual(warnings[0]['category'], DeprecationWarning) def test_s(self): """ L{s} is deprecated, but pass keyword arguments to the first argument, to construct a step. """ stepFactory = s(BuildStep, name='test') self.assertEqual( stepFactory, _BuildStepFactory(BuildStep, name='test')) warnings = self.flushWarnings([self.test_s]) self.assertEqual(len(warnings), 1) self.assertEqual(warnings[0]['category'], DeprecationWarning) def test_addStep_notAStep(self): # This fails because object isn't adaptable to IBuildStepFactory self.assertRaises(TypeError, self.factory.addStep, object()) def test_addStep_ArgumentsInTheWrongPlace(self): self.assertRaises( TypeError, self.factory.addStep, BuildStep(), name="name") # this also raises a deprecation error, which we don't care about (see # test_s) self.flushWarnings() def test_addSteps(self): self.factory.addSteps([BuildStep(), BuildStep()]) self.assertEqual(self.factory.steps[-2:], [_BuildStepFactory(BuildStep), _BuildStepFactory(BuildStep)])
def test_addSteps(self): factory = BuildFactory() factory.addSteps([BuildStep(), BuildStep()]) self.assertEqual(factory.steps, [(BuildStep, {}), (BuildStep, {})])
def create_builder(self, repo_name): builder_name = 'builder_' + repo_name venv_name = "virtualenv_ci_" + builder_name venv_path = {'PATH': "./" + venv_name + '/bin' + ':${PATH}'} venv_path_factory = {'PATH': "../" + venv_name + '/bin' + ':${PATH}'} factory = BuildFactory() factory.addSteps([ steps.ShellCommand(command=["rm", "-rf", venv_name], haltOnFailure=True, workdir=".", name="Remove previous virtualenv"), steps.ShellCommand( command=["virtualenv", "--python=python2", venv_name], haltOnFailure=True, workdir=".", name="Create new virtualenv"), steps.ShellCommand(command=[ 'pip', 'install', '-U', 'pip', 'setuptools', 'coverage' ], env=venv_path, workdir=".", name="Update setuptools") ]) repo_index = [ repo[order_repos_index] for repo in self.repos if repo[0] is repo_name ][0] repo_info = sorted( self.repos, key=lambda repo: repo[order_repos_index])[0:repo_index] for repo_name, repo_branch, _, namespace, in repo_info: _add_repo_to_factory(factory, repo_name, repo_branch, namespace, venv_name) factory.addSteps([ steps.ShellCommand(command=['pep8', '.'], env=venv_path_factory, haltOnFailure=False, workdir=repo_name, name="pep8 on " + repo_name) ]) if namespace is not '': if repo_name is 'bitmask_client': factory.addStep( steps.ShellCommand(command=[ 'xvfb-run', 'coverage', 'run', '--omit=*/' + venv_name + '/*', venv_name + '/bin/trial', namespace ], env=venv_path, workdir='.', name="trial " + namespace)) else: factory.addStep( steps.ShellCommand(command=[ 'coverage', 'run', '--omit=*/' + venv_name + '/*', venv_name + '/bin/trial', namespace ], env=venv_path, workdir='.', name="trial " + namespace)) factory.addSteps([ steps.ShellCommand(command=['coverage', 'html'], env=venv_path, workdir='.', name="generate html coverage report for " + namespace), steps.ShellCommand( command=self._publish_coverage_reports_command( 'htmlcov', repo_name), workdir='.', doStepIf=(lambda step: self.slaves.is_leap( step.getProperty('slavename')))) ]) self._publish_leap_wheels(factory, repo_name, venv_path_factory, doStepIf=(lambda step: self.slaves.is_leap( step.getProperty('slavename')))) if repo_name == 'bitmask_client': publish_sumo = self._publish_sumo_command( '`ls -t *SUMO.tar.gz | head -1`') factory.addSteps([ steps.ShellCommand(command=['make', 'sumo_tarball_latest'], env=venv_path_factory, workdir=repo_name, doStepIf=(lambda step: self.slaves.is_leap( step.getProperty('slavename'))), name="make sumo tarball"), steps.ShellCommand(command=publish_sumo, env=venv_path_factory, workdir=repo_name + "/dist", doStepIf=(lambda step: self.slaves.is_leap( step.getProperty('slavename'))), name="publish sumo to ftp") ]) return BuilderConfig(name=builder_name, slavenames=self.slaves.names(), factory=factory)
def createFactory(): factory = BuildFactory() factory.addSteps(createBuildSteps()) return factory
def get_builders(): bld = [] # extract all slavenames # slaves = config.slaves.get_build_slaves() # slavenames = [] # for i in slaves: # slavenames.append(i.slavename) defaultslaves=[] defaultslaves.append("localhost") if mastertype == '"llvmlinux-bot"': defaultslaves.append("vm-builder") bfactory = BuildFactory() bfactory.addStep(ShellCommand(workdir="./", haltOnFailure=False, command="if test ! -d build ; then git clone http://git.linuxfoundation.org/llvmlinux.git build; fi", description="checkout")) bfactory.addStep(ShellCommand(workdir="./build/", haltOnFailure=False, command="git pull", description="update")) bfactory.addStep(ShellCommand(workdir="./build/targets/x86_64-linux-next", haltOnFailure=False, command="make sync-all", description="checkout2")) bfactory.addStep(Git(repourl='git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git', mode='incremental', alwaysUseLatest=True, logEnviron=False, workdir="./build/targets/x86_64-linux-next/src/linux")) for i in TF.get_steps("x86_64-linux-next", llvmclang="stable", runtest=1, runhwtest=0): bfactory.addStep(i) if mastertype == '"llvmlinux-bot"': bld.append( BuilderConfig(name="4_linux-next", slavenames=["target.x86_64-linux-next"], factory=bfactory)) afactory = BuildFactory() afactory.addStep(Git(repourl='http://git.linuxfoundation.org/llvmlinux.git', mode='incremental', alwaysUseLatest=True, logEnviron=False, clobberOnFailure=True)) for i in TF.get_steps("vexpress", llvmclang="stable", runtest=1, runhwtest=0): afactory.addStep(i) afactory.addStep(ShellCommand(workdir="../", haltOnFailure=False, command="if test ! -d common ; then git clone 1_llvmlinux/build/.git common; fi", description="checkout")) afactory.addStep(ShellCommand(workdir="../common/", haltOnFailure=True, logEnviron=False, command=["git", "remote", "-v", "update"], description="update common")) afactory.addStep(ShellCommand(workdir="../common/", haltOnFailure=True, logEnviron=False, command=["git", "pull"], description=["pull", "update"])) afactory.addStep(ShellCommand(workdir="../common/targets/vexpress", haltOnFailure=True, logEnviron=False, command=["make", "kernel-sync", "llvm-sync", "clang-sync"], description="sync common")) bld.append( BuilderConfig(name="1_llvmlinux", slavenames=defaultslaves, factory=afactory)) common_commands = [ ShellCommand(workdir="../common", command=["make", "-C", "targets/vexpress", "GIT_HARD_RESET=1", "kernel-sync"], description='kernel-clean', haltOnFailure=True, logEnviron=False, timeout=2400) , ShellCommand(workdir="../common", command=["make", "-C", "targets/vexpress", "GIT_HARD_RESET=1", "test-boot-poweroff"], description='clang-boot-poweroff', haltOnFailure=True, logEnviron=False, timeout=2400), # ShellCommand(workdir="../common", command=["make", "-C", "targets/x86_64", "CONFIG=", "GIT_HARD_RESET=1", "kernel-sync"], # description='kernel-clean', # haltOnFailure=True, # logEnviron=False, # timeout=2400) , # ShellCommand(workdir="../common", command=["make", "-C", "targets/x86_64", "GIT_HARD_RESET=1", "test-boot-poweroff"], # description='test-clang-boot-poweroff', # haltOnFailure=True, # logEnviron=False, # timeout=2400), ShellCommand(workdir="../common/targets/vexpress", command="make llvm-settings | tee toolchain.cfg", description='export stable toolchain', haltOnFailure=False, logEnviron=False, timeout=2400), FileUpload(slavesrc="../common/targets/vexpress/toolchain.cfg", masterdest="public_html/toolchain.cfg") ] # build factory for llvm builder factory_llvm = BuildFactory() factory_llvm.addStep(ShellCommand(workdir="../common/toolchain/clang/src/llvm", command=["git", "remote", "-v", "update"], description='gitup', haltOnFailure=True, logEnviron=False, timeout=3600)) factory_llvm.addStep(Git(repourl='http://llvm.org/git/llvm.git', mode='incremental', clobberOnFailure=True, logEnviron=False, workdir="../common/toolchain/clang/src/llvm")) factory_llvm.addStep(ShellCommand(workdir="../common", command=["make", "-C", "targets/vexpress", "llvm-clean"], description='llvm-clean', haltOnFailure=True, logEnviron=False, timeout=3600)) factory_llvm.addSteps(common_commands) # build factory for clang builder factory_clang = BuildFactory() factory_clang.addStep(ShellCommand(workdir="../common/toolchain/clang/src/clang", command=["git", "remote", "-v", "update"], description='gitup', haltOnFailure=True, logEnviron=False, timeout=3600)) factory_clang.addStep(Git(repourl='http://llvm.org/git/clang.git', mode='incremental', logEnviron=False, clobberOnFailure=True, workdir="../common/toolchain/clang/src/clang")) factory_clang.addStep(ShellCommand(workdir="../common", command=["make", "-C", "targets/vexpress", "clang-clean"], description='clang-clean', haltOnFailure=True, logEnviron=False, timeout=3600)) factory_clang.addSteps(common_commands) bld.append( BuilderConfig(name="2_llvm", slavenames=defaultslaves, factory=factory_llvm)) bld.append( BuilderConfig(name="3_clang", slavenames=defaultslaves, factory=factory_clang)) ### resetup Factories factory_resetup_common = BuildFactory() factory_resetup_common.addStep(ShellCommand(workdir="../", description="rm", logEnviron=False, command=["rm", "-rRf", "common"])) factory_resetup_common.addStep(ShellCommand(workdir="../", description="clone", logEnviron=False, command=["git", "clone", "1_llvmlinux/build/.git", "common"])) factory_resetup_common.addStep(ShellCommand(workdir="../common", logEnviron=False, timeout=3600, description="refetch", command=["make", "-C", "targets/vexpress", "clang-fetch", "qemu-fetch", "kernel-fetch"])) bld.append( BuilderConfig(name="0_resetup", slavenames=defaultslaves, factory=factory_resetup_common)) return bld
def test_addSteps(self): factory = BuildFactory() factory.addSteps([BuildStep(), BuildStep()]) self.assertEqual(factory.steps, [_BuildStepFactory(BuildStep), _BuildStepFactory(BuildStep)])