gitw
gitw copied to clipboard
a small tool that automatically clones and builds local GIT repositories on changes
gitw
Why not other tools?
minimalism: requires one JSON file per repository easily extensible: support for unit tests and stress-testing (long-running tests) Features:
- watch multiple svn/git repositories, located locally on the host machine or on a remote host,
- notify the repository owners with an e-mail on failures,
- browse repository status from a web interface with access to log files.
What's missing:
- dependency checks
- support for benchmarks/stress-testing: this requires a new tool to control the stress-testing as well support in gitw-http to dinamically show the test status and system state.
- Setting up the Go compiler
gitw requires a Go compiler from http://golang.org. Get it with mercurial (version weekly.2012-02-07 works). There are no other external dependencies.
$ hg clone -u weekly.2012-02-07 https://go.googlecode.com/hg/ go Then, set up your environmental variables for Go
export GOHOME=$HOME/go export GOBIN=$GOHOME/bin export GOARCH=amd64 export GOOS=linux export PATH=$PATH:$GOBIN:$GOBIN/tool $ cd $GOHOME/src $ ./all.bash 6g and 6l are the Go compiler and linker for 64-bit systems. Binaries are installed in $GOBIN.
Compiling and configuring gitw
Move to gitw source tree.
Compiling gitw - the CI server
$ 6g gitw.go && 6l -o gitw gitw.6 The gitw server will listen on port 9988.
Compiling gitw-http - the web interface
$ 6g gitw-http.go && 6l -o gitw-http gitw-http.6 Edit config.json:
{ "RepositoriesRoot" : "repositories", "MailAddress" : "[email protected]", "MailHost" : "smtp.example.com", "MailUsername" : "[email protected]", "MailPassword" : "mypassword" } Key explanations:
- RepositoriesRoot: the directory where the repositories JSON files are stored,
- MailAddress: email to use for sending out notifications,
- MailHost: email server hostname,
- MailUsername: username for the email,
- MailPassword: email password.
- The gitw-http HTTP server will listen on port 12345
Adding repositories
Example project repository:
{ "repository" : "svn", "source" : "remote", "name" : "example", "location" : "https://localhost/svn/example", "build" : "make", "test" : "/some/path/run.sh", "outputdirectory" : "/some/path/", "notifyemail" : "[email protected]", "description" : "Build Example and then run unit tests, then a long test" }
Key explanations:
- repository: either svn or git,
- source: remote or local. You can name a branch by appending /<branch_name> to the usual text.
- name: name of the repository,
- location: if source is set to local, enter a valid local path to repository, or an URL if source is remote,
- build: the command to execute after code checkout is done,
- test: the command to execute after build is done,
- outputdirectory: path where to out output files for checkout, build and test. The filename is composed of {name}-{checkout|build|test}-output.txt
- notifyemail - the email to use when sending fail notices or an empty string for no notifications
- description - a short description of the repository, mainly used by gitw-http.
Configuring Subversion for gitw
Using gitw (https://github.com/napsy/gitw), automated testing could be done:
Navigate to your repository's hooks directory. This is almost always a directory cleverly named 'hooks' right inside the top level of your repository:
cd /Users/mwest/svn/my_repository/hooks/
Use the subversion-post-commit.example file (located in repository) for the post-commit script. The script will notify the gitw server whenever a commit will occur on the SVN server. Rename the file to 'post-commit' after putting it into the 'hooks' directory. Make sure the file is executable and owned by the right user.