Skip to content

Instantly share code, notes, and snippets.

@geerteltink
Created November 8, 2014 15:23
Show Gist options
  • Save geerteltink/4762a1d87b58dfe8fbff to your computer and use it in GitHub Desktop.
Save geerteltink/4762a1d87b58dfe8fbff to your computer and use it in GitHub Desktop.
Using sismo as your personal CI server on windows.
<?php
// Create a custom notifier using toast
require('ToastNotifier.php');
$notifiers = array(
new Sismo\Contrib\ToastNotifier()
);
// Set default command: Run composer and phing if there is a composer file
Sismo\Project::setDefaultCommand('if [ -f composer.json ]; then composer install --dev --prefer-source && ./vendor/bin/phing; fi');
// Initialize projects
$projects = array();
// Add projects with custom settings
$projects['project-slug'] = new Sismo\Project('My Project', 'path\to\repository', $notifiers, 'project-slug');
$projects['project-slug']->setBranch('develop');
return $projects;
#!/bin/sh
HASH=`git rev-parse HEAD`
SLUG=<project-slug>
php path/to/sismo.php build --force --quiet $SLUG $HASH 2>&1 &
SISMO_DATA_PATH "/path/to/sismo/data"
SISMO_CONFIG_PATH "/path/to/sismo/config.php"
<?php
namespace Sismo\Contrib;
use Sismo\Commit;
use Sismo\Notifier\Notifier;
/**
* Notifies build status via toast notifications
*
* Toast binaries need to be available in your PATH and can be downloaded at
* https://github.com/nels-o/toaster
*
* @author Geert Eltink <https://xtreamwayz.github.io>
*/
class ToastNotifier extends Notifier
{
private $application;
private $notifications;
private $format;
public function __construct($application = 'sismo', $format = "%message% by %author%")
{
$this->application = $application;
$this->format = $format;
$this->notifications = array(
array('status' => 'Success', 'enabled' => true),
array('status' => 'Fail', 'enabled' => true),
);
}
public function notify(Commit $commit)
{
return $this->doNotify($commit->isSuccessful() ? true : false, $commit->getProject()->getName(), $this->format($this->format, $commit));
}
private function doNotify($status, $title, $message)
{
$dir = dirname(__FILE__);
$command = sprintf('toast -t "%s" -m "%s" -p "%s/%s"',
$title,
$message,
$dir,
$status ? 'icon-success.png' : 'icon-fail.png'
);
exec($command, $output, $return_var);
}
}
SetEnv SISMO_DATA_PATH "/path/to/sismo/data"
SetEnv SISMO_CONFIG_PATH "/path/to/sismo/config.php"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment