Created
November 8, 2014 15:23
-
-
Save geerteltink/4762a1d87b58dfe8fbff to your computer and use it in GitHub Desktop.
Using sismo as your personal CI server on windows.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
HASH=`git rev-parse HEAD` | |
SLUG=<project-slug> | |
php path/to/sismo.php build --force --quiet $SLUG $HASH 2>&1 & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SISMO_DATA_PATH "/path/to/sismo/data" | |
SISMO_CONFIG_PATH "/path/to/sismo/config.php" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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