How to setup Continuous Integration with RocketGit
Below we will show you an example on how to setup RocketGit to build, test
and deploy your application. We will use a simple 'bash' application and
also a simple deploy script using 'rsync' to deploy it to some servers
when you push a branch of your repository and your tests pass.
First, you will have to create an account and then a repository and
setup your local environment for Git and SSH. Also, we assume that you
already cloned the repository locally.
These steps are not covered by this tutorial (see the hints on the repo page).
Now, we assume you are in the just cloned repository's local folder.
We can start with a simple application, stored in file 'main.sh':
#!/bin/bash
case "${1}" in
a) echo "A" ;;
b) echo "B" ;;
c) echo "C" ;;
*) echo "BAD" ;;
esac
As you can see, it is a simple script. Now, we will add another script,
'test.sh', that will test our main script:
#!/bin/bash
if [ "`./main.sh xx`" != "BAD" ]; then
echo "Test 'xx' failed!"
exit 1
fi
if [ "`./main.sh b`" != "B" ]; then
echo "Test 'b' failed!"
exit 1
fi
echo "Tests passed!"
Next, we will add the deploy script, 'deploy.sh':
#!/bin/bash
for s in server1 server2 server3; do
rsync -a main.sh ${s}:/usr/local/bin/
done
deploy.sh script will propagate our
main.sh file to multiple
servers.