(or the unbreakable build!)
The goal of ‘git build’ script is to run a command which determine if a commit is good before pushing your commits on the remote.
It could easily configured to build your project and run the unit tests automaticaly in a private build and then assure you that your git history contains only good commits.
The different steps of the script are the following :
1. Clone the current git repository in a temporary folder
2. Rebase on upstream modifications
3. Run a custom command (build, unit tests,…)
4. Push commits only if the custom command succeed
5. Give a feedback of the build by a notification
1. Copy the git-build script in a directory that is in your path (or add the directory to your path) keeping the file name ‘git-build’.
2. Copy the 2 files and
in the same directory keeping the names “git-build_success.png” and “git-build_fail.png”.
3. If you are under windows, install Growl and add growl folder to the path.
For each new git repository you use and only one time, set the command that will be run before pushing.
Example using maven :
git config private-build.command "mvn clean install"
Example using msbuild :
git config private-build.command "msbuild my.build /t:UnitTests /p:Configuration:Debug"
Each time you want to push, instead, call the command :
git build
The advantages of such a solution are :