In my current set up, my development server has a bunch of bare git repositories from which me and some other users push to. However, now, I’d like to integrate PHPUnit testing on the server itself.
My initial idea was to have a sub directory in each repo named tests, then have something like VisualPHPUnit run the tests so I can see the results through the server’s “website”. However, seeing as the remote repositories are bare, I can’t exactly tell VPHPU to look for the test directories — as they aren’t really there.
Is there a better way of doing things? I was thinking of maybe having another repository that would contain tests for all the projects and just making it not bare — but that goes against git standards and could possibly break stuff.
I’d think you’d do better to setup Jenkins or QuickBuild. Jenkins is open-source, whereas QuickBuild is not. But QuickBuild does have a free version, and I’ve found it to be more reliable than the former. Both will allow you to checkout your source, run tests, and post the results. And over the long haul, it’ll allow you to do more, such as packaging your product for deployment.
If you’re dead set on trying to make your current idea work, you’ll need a post-receive hook that will checkout the code somewhere, run your tests against the checkout, and post the results to a known location. You’ll need to think about a few things though. For instance, do you want to test every branch? Just a single one? The post-receive hook will tell you about all branches being updated, so you might need to filter if you only want to test
master. Pro Git has some information on hooks and how to customize them.I’d avoid using a bare repository. You’ll have to deal with things like pushing into a bare repository, which is frowned upon. I think in the end, you’ll really want Jenkins or QuickBuild to help you.