Exemple #1
0
	def __init__(self, onlyChanged=False, myCommand = None, **kwargs):
		if 'command' in kwargs:
			self.myCommand = kwargs['command']
		
		PyLint.__init__(self, **kwargs)
		self.addFactoryArguments( onlyChanged = onlyChanged,
					  myCommand = myCommand )
		self.onlyChanged = False
		if onlyChanged is not None:
			self.onlyChanged = onlyChanged
		if myCommand is not None:
			self.myCommand = myCommand
def get_buildsteps(working_dir):
    build_steps = BuildFactory()

    repo = Git(repourl="https://github.com/mlakewood/Buildbot-rollout.git",
               branch='master')

    virt_env = working_dir + '/virt/lib'

    slave_python = working_dir + '/virt/bin/python'

    env = {"LD_LIBRARY_PATH": virt_env}

    build_steps.addStep(repo)

    # # Remove the Virtual Environment from the last run
    # command = "rm -Rf %s/virt" % (working_dir)
    # build_steps.addStep(ShellCommand(workdir=working_dir, description="Clear Virtualenv", command=command.split(" ")))

    # # Create the virtual environment for the build
    # command = "virtualenv virt"
    # build_steps.addStep(ShellCommand(workdir=working_dir, description="Create Virtualenv", command=command.split(" ")))

    # # Pip install the python packages from requirements.txt
    # command = '%s/virt/bin/pip install -r requirements.txt' % working_dir
    # build_steps.addStep(ShellCommand(workdir=working_dir, description="Install packages", command=command.split(" ")))

    # Run the tests through coverage to get test coverage at the same time
    command = "../virt/bin/coverage run --include=src -m unittest discover -vf tests"
    build_steps.addStep(
        ShellCommand(workdir=working_dir + '/rollout',
                     description="rollout Unit Tests",
                     command=command.split(" ")))

    # Output the coverage report
    command = "virt/bin/coverage report --omit=*tests* -m"
    build_steps.addStep(
        ShellCommand(workdir=working_dir,
                     description="API Unit Test Coverage Report",
                     command=command.split(" ")))

    # Run pylint. P
    command = "pylint %s/rollout --rcfile=rollout/.pylintrc" % (working_dir)
    build_steps.addStep(
        PyLint(workdir=working_dir,
               description="API pylint",
               command=command.split(" ")))

    command = "./jslint js/*"
    build_steps.addStep(
        ShellCommand(workdir=working_dir + '/rollout',
                     description="Insight JSLint code",
                     command=command))

    return build_steps
Exemple #3
0
	def start(self):
		log.msg( self.build )
		files = []
		if self.build.getSourceStamp().changes:
			for c in self.build.getSourceStamp().changes:
				for fn in c.files: 
					files.append( fn )
		log.msg( "Pylinting files: %s" % files )
		log.msg( "self.onlychanged is %s" % self.onlyChanged )
		if ( (not files) and (self.onlyChanged) ):
			return SKIPPED
		
		if ( (not hasattr( self, 'myCommand')) or (self.myCommand == None )):
			return PyLint.start(self)
	
		self.setCommand( self.myCommand )
		if files and self.onlyChanged:
			log.msg("extending commandline")
			newCommand = self.myCommand + files
			self.setCommand( newCommand )
		
		PyLint.start(self)