“Sismo has been optimized to run locally on your computer for your Git projects. Even if it can test remote repositories, Sismo is better used as a local post-commit hook. Whenever you commit changes locally, Sismo runs the tests and give you immediate feedback before you actually push your modifications to the remote repository. So, Sismo is a nice complement to your Continuous Integration Server.” - sismo.sensiolabs.org
I like it because:
- it’s simple to install: only one file,
- it shows build history by projects in the web interface
- it can track multiple branches
- it can build remote repositories
- it’s simple to config: ~/.sismo/config.php` (by default)
- Git projects build are in
.sismo ├── config.php └── data └── build │ └── ... └── sismo.db
- its web interface is great to get an overview of your repositories
Your project unit tested with atoum versioned with git
For this exemple, I’ll use the same project “Unit test with atoum installed with composer” which is located in
~/test-project with this files structure:
. ├── .git │ └── ... ├── .gitignore ├── .gitmodules ├── bin │ └── atoum -> ../vendor/mageekguy/atoum/bin/atoum ├── classes │ └── helloWorld.php ├── composer.json ├── composer.lock ├── composer.phar ├── tests │ └── units │ └── testHelloWorld.php └── vendor ├── autoload.php ├── composer │ └── ... └── mageekguy └── atoum ...
It’s very important to not ignore
vendor/, at least
bin/atoum is a symbolic link to
Dependencies installed with composer are Git projects. It means that you need to map these dependencies / modules in
.gitmodules file. We only have atoum here so let’s map it. Create this file if you don’t have it.
[submodule "vendor/mageekguy/atoum"] path = vendor/mageekguy/atoum url = git://github.com/mageekguy/atoum.git
Let’s install Sismo
sismo.php wherever in your web directory - for instance
$ mkdir -p /var/www/sismo $ wget -P !!:2 http://sismo.sensiolabs.org/get/sismo.php
Let’s configure this project in Sismo
We need to configure this project (title, slug and path - change the user name), select a branch (master) and the command (atoum of course) to launch afterwards. It also possible to set a notification, let’s say we use Growl. Edit
$projects = array(); $notifier = new Sismo\Notifier\GrowlNotifier('pa$$word'); $helloWorldProject = new Sismo\Project('Hello World'); $helloWorldProject->setRepository('/home/antoine/test-project'); $helloWorldProject->setBranch('master'); $helloWorldProject->setCommand('./bin/atoum -d ./tests'); $helloWorldProject->setSlug('hello-world-local'); $helloWorldProject->addNotifier($notifier); $projects = $helloWorldProject; return $projects;
Let’s run Sismo when you commit some changes
~/test-project/.git/hooks/post-commit and add:
#!/bin/sh php /var/www/sismo/sismo.php --quiet build hello-world-local `git log -1 HEAD --pretty="%H"` &
$ chmod a+x ~/test-project/.git/hooks/post-commit
Let’s build !
$ php /var/www/sismo/sismo.php build --verbose
If his build fails, Sismo will send notifications. Use the output command to see the latest build output of a project (slug):
$ php /var/www/sismo/sismo.php output hello-world-local
If you get “Hmmm, looks like something went wrong - an error occured” like this screenshot:
Please check the right of your webserver for
~/.sismo/data/sismo.db which should be writable.
If your web server runs under a different user than the one you use on the CLI, you will need to set some environment variables in your apache virtual host configuration:
SetEnv SISMO_DATA_PATH "/path/to/sismo/data" SetEnv SISMO_CONFIG_PATH "/path/to/sismo/config"
As you can see Sismo works like a charm with atoum ! There is no more excuse to not use atoum if you are a Sismo user ;) Thanks to Fabien Potencier (@fabpot) and Frédéric Hardy (@mageekguy) for their tools & frameworks !