Wednesday, 17 July 2013

Continuous Integration with python and blink(1)

I've been a big fan of Continuous Integration / Continuous Deployment (CI/CD) for some time now, and we've been using it with great success in my day job building something awesome. But that setup is team-focussed, uses a build server, is triggered from revision code checkin, with promotion between development, test, staging and production environments gated by passing all the regression suite tests.  We even spam the team over Jabber when tests fail.

At the other end of the scale is personal software development on my laptop.  Here I want something more lightweight that the excellent Jenkins, and I want builds triggered not on revision control checkins, but on every save.  In essence, something compatible with the team-focussed environment, but something even more agile and lightweight.

My personal development is more likely to be in Python than anything else, and I like to write my code test-first. Normally I have three windows open - one editor for code, one editor for test code, and one shell with onchange.pl running to automatically run tests every time a change is made to tests or code.  This is all well and good, but it still requires me to take my focus off the editors and check that tests succeeded in the shell window.  This can be improved upon.

Enter my latest toy, blink(1).  It's a USB multi-coloured RGB LED, that's easily programmable with code available.  But they provide a command-line tool which is sufficient for many use cases.

With a small script that checks the result of the test run, it's very easy to get blink(1) to give me a quick visual indication of the result of my development efforts.  It's as simple as...

#!/bin/bash
nosetests
if [ "$?" -eq "1" ]
then
    blink1-tool --red --blink 5 2>&1 >/dev/null
else
    blink1-tool --green 2>&1 >/dev/null
    sleep 5
fi
blink1-tool --off 2>&1 >/dev/null



Maybe it's a bit gimmicky, but so far I'm loving it!

2 comments:

  1. I am glad that I saw this post. It is informative blog for us and we need this type of blog thanks for share this blog, Keep posting such instructional blogs and I am looking forward for your future posts. Python Projects for Students Data analytics is the study of dissecting crude data so as to make decisions about that data. Data analytics advances and procedures are generally utilized in business ventures to empower associations to settle on progressively Python Training in Chennai educated business choices. In the present worldwide commercial center, it isn't sufficient to assemble data and do the math; you should realize how to apply that data to genuine situations such that will affect conduct. In the program you will initially gain proficiency with the specialized skills, including R and Python dialects most usually utilized in data analytics programming and usage; Python Training in Chennai at that point center around the commonsense application, in view of genuine business issues in a scope of industry segments, for example, wellbeing, promoting and account. Project Center in Chennai

    ReplyDelete