A single-user continuous integration tool.
While reading James Grenning's "Test Driven Development for Embedded C" I noticed a line that said something to the effect of
every time I save a file, my IDE runs my tests
Well, I loathe IDEs, but I thought this sounded like a pretty cool idea. I
happened to also be playing around with pymacadmin's
at the same time and realized I could steal some code from there to make a very
simple script that would invoke my
Makefile every time I saved a file in
simple-ci is the result. It uses Yesudeep Mangalapilly's
watchdog facility to watch a directory for changes.
The cleanest way to use it is to add a target to your
Makefile, like thus:
ci: /path/to/simple_ci.py . make test
Then invoke the
ci target in a terminal window. Any time you save a file
anywhere in your project, the
test target will be invoked.
==> Running: make test compiling usi_serial.c Building archive ../build/lib/libiswba.a r - ../build/objs/../main/src/8bit_tiny_timer0.o r - ../build/objs/../main/src/ibus_button_adapter.o r - ../build/objs/../main/src/ibus_message_parser.o r - ../build/objs/../main/src/mute_button.o r - ../build/objs/../main/src/relay.o r - ../build/objs/../main/src/usi_serial.o Linking iswba_tests Running iswba_tests .................... OK (20 tests, 20 ran, 46 checks, 0 ignored, 0 filtered out, 1 ms) ==> SUCCESS ==> ready
I went a little further and added a wrapper script that calls
make test and
displays a Growl alert if the tests fail:
#!/bin/bash make test if [ $? -ne 0 ]; then growlnotify -a Xcode -n simple-ci -d bravo5.simpleci -t CI -m "BUILD FAILED" fi
You can use this with any project, not just make-driven ones. Run your Python
nose or JUnit tests with Maven every time you save a file!
pip install .
If you get errors like
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
on OS X, try
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install .