Summary: last month I set up Hudson as our continuous integration server. And I constantly show Hudson’s front page on a laptop in a visible location, which increased interest and usage a lot!
Somewhere in February, after working here for a month, I set up a buildbot. I’m all in favour of some practical project automation. Having some machine automatically testing your code every time you make a change is one of the essentials. It also forces you to make your builds repeatable without any manual steps (so: buildout!), which is a good thing, too.
Problem: it did test everything pretty fine, but almost nobody looked at it.
I saw Hudson a couple of times already in some blog posts, but last May’s djangocon.eu in Berlin made sure I wanted to replace buildbot with Hudson, see for instance Eric Holscher’s talk.
There are a couple of how-to-integrate-hudson-with-django-or-python tutorials on-line, just google for them. I’ll just make some quick comments here:
There’s not only python in there! A colleague added R projects in there.
You’ll need to get your tests to spit out xml output. We now run our tests with the “nose” test runner by using django-nose. Next to the setup.py I added a setup.cfg with the following content, this tells nose to spit out xml:
[nosetests]
with-xunit=1
Cobertura plug-in: code coverage measurement. This also needs xml output. With coverage.py, you just need to call coverage xml.
“Violations” plug-in: switch on ‘pylint’ checking for your code. I don’t actually use pylint: I run pep8 and pyflakes over the code. You do need to redirect both tools’ output to a text file and fix the output up a bit to match what the plug-in expects. Effectively: every line that contains [E is an error, [W is a warning. I copied someone’s perl command-line for this. Pep8 is warning level, pyflakes is error level:
pep8 dir_with_python | perl -ple 's/: [WE](\\d+)/: [W$1]/' > pep8.txt
pyflakes dir_with_python | perl -ple 's/:\\ /: [E] /' >> pep8.txt
I included the rhino command line version of jslint. An error here means the script returns with a non-zero exit code, which means a test failure for Hudson.
All the above items are run in two or three script steps in Hudson. In the end I grouped everything together a bit in python scripts, btw.
Hurray for Hudson!
My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.
Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):
Social effects¶
In August I installed Hudson and everyone started loving it. What did I do?
What was the effect?
Visibility? Just when I was about to make a photograph, our sysadmin shut down the machine. “What?” “Oh, I’m just attaching a bigger monitor”. Hurray! I had not even requested that and suddenly we have a nicer bigger more visible monitor.