Sunday, February 17, 2008

Continuous Integration for D

You don't need to use Agile to benefit from a Continuous Integration server. The basic idea is, you've got a server that checks out your code whenever there are updates, builds it according to a build script, and (almost always) runs some scripted tests on it.

I'm pondering how to set one up for D, using a daemon of some sort. The approach looks something like this:


  • A config file with the repository information and where to check it out to.

  • A DSSS file in the root of the repository.

  • A list of directories that contain tests. These should only contain tests; perhaps an exclude option for files and directories that contain helper methods.



The build process isn't that exciting:

  • Check for updates; if none, sleep.

  • Run dsss build.

  • Recursively go through the test directories, running rebuild on each .d file and executing the resulting executable.

  • Publish the results.



This requires that each test file contain a main() method. However, it has the benefit that the main executable does not contain unit tests, enforcing or at least encouraging separation of concerns and design practices that do require tests to have private access to the tested modules.

No comments: