It's a little bit more than that ("a little bit" meant literally rather than as understatement ;-). It's a hook that checks out the new commit, then runs a run_integration_tests
script taken from the repo. If that succeeds then it calls a script called promote_to_live
, and if it fails then it calls handle_integration_error
with the output of the test. So basically a minimum viable continuous deployment script. Nothing terribly complicated, but there were a bunch of weird edge cases that made it harder than I'd expected.
The fun bit was making it self-hosting. Basically, I have a repo called development
and a bare repo called integration
. The origin
remote on both of them is the GitHub repo, but development
has the integration
repo as a remote called integration
. The integration
repo has the hook installed. The codebase defines its own run_integration_tests
(which in turn creates repositories with appropriate relationships and checks that pushing between them runs the scripts appropriately), handle_integration_error
(which emails me test failures) and promote_to_live
, which pushes the integration repo to GitHub.
All that means that I can work on it in the development
repo, and do a git push integration master
every now and then. That runs the tests and pushes to GitHub if they pass. Which means I can be sure that the version on GitHub always passes its own tests.
Not rocket science, but it was interesting how many bits of weirdness cropped up when I was trying to make it all hang together properly.