Sismo Setup As Personal CI: Behat + PHPSpec Powered!

Update notice: I was told by fabpot that: “The command can be any valid script. So, you can run whatever you want here. The best way is probably to create a script and call it as the command to run.”

I struggled several hours with Sismo but got it to do what I wanted.
I went in and configured a config.php file into .sismo/config.php introducing my project not as a github project but as a custom project since everything is local for me for this particular project. I also have it on github but I want to be able to *assert* the situation locally as we are developing with BDD.
So working on a particular branch of my project ‘composition’ I init bare a local repository in a repos folder ‘/home/cordoval/sites-2/repos/bdd-local.git’ and then assign the command to run phpspec on a folder Spec under the corresponding subproject.

$projects = array();
// create a DBus notifier (for Linux)
$notifier = new Sismo\DBusNotifier();
// add a project with custom settings
$sf2 = new Sismo\Project('bdd-local');
// builds command for phpspec
$phpspecCommand = '/home/cordoval/sites-2/FormModelProjectBundle/vendor/phpspec/scripts/phpspec.php';
$phpspecFolder = '/home/cordoval/sites-2/FormModelProjectBundle/vendor/PHPAutotest/demo/PHPSpec/MineSweeper/Specs/';
$longCommand = 'find ' . $phpspecFolder . '*.php -exec ' . $phpspecCommand . ' \'{}\' -f documentation --color \\;';
// sets command, slug for web interface, links to individual commit, and notifier popup
$projects[] = $sf2;
return $projects;

The setup for the phpspec and behat is custom and it is discussed for a later post. However, it is shown here to show that we are successfully using PHPSpec and Behat on our BDD design cycle with Sismo.

The git post-commit hook used is quoted here commented:

# This hook script is called after a successful
# commit is made.

# sets the environment variables for sismo
. /home/cordoval/sites-2/sismo/sismoenv
# pushes the latest commit on the current branch whichever this is 
# up to the .git repository that sismo is cloning/fetching?
/usr/bin/git push local
# runs sismo with .sismo/config.php configuration (aka Behat, PHPSpec, PHPUnit, or other as sismo is tool agnostic)
/home/cordoval/sites-2/sismo/sismo --verbose build bdd-local `git log -1 HEAD --pretty="%H"` &

I added the push step in order to make it work since without this push step sismo would be cloning (and not sure if fetching after it clones in the first processing step) a repository out of sync since the last commit we made it is still on the working directory and has not been pushed upstream.

Result, it works like a charm.

And on a behat cycle:

I should acknowledge the brainstorming time with NordishByNature on the channels and overall to my God for providing me grace time for this. Currently listening …

Leave a Reply

Your email address will not be published. Required fields are marked *