Skip to content

Commit

Permalink
Added travis support
Browse files Browse the repository at this point in the history
  • Loading branch information
chillu committed Nov 9, 2012
1 parent 22095da commit 21791e4
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .travis.yml
@@ -0,0 +1,28 @@
language: php
php:
- 5.3

env:
- TESTDB=MYSQL
- TESTDB=PGSQL

before_script:
- phpenv rehash
- ./tests/travis/before_script ~/builds/ss
- cd ~/builds/ss

script:
- phpunit -c phpunit.xml.dist

branches:
except:
- 2.1
- 2.2
- 2.3
- post-2.4
- translation-staging

notifications:
irc:
channels:
- "irc.freenode.org#silverstripe"
22 changes: 22 additions & 0 deletions tests/travis/_config.php
@@ -0,0 +1,22 @@
<?php

global $project;
$project = 'mysite';

global $database;
$database = '';

require_once('conf/ConfigureFromEnv.php');

global $databaseConfig;
$databaseConfig['memory'] = true;
$databaseConfig['path'] = dirname(dirname(__FILE__)) .'/assets/';

MySQLDatabase::set_connection_charset('utf8');

// Set the current theme. More themes can be downloaded from
// http://www.silverstripe.org/themes/
SSViewer::set_theme('blackcandy');

// Enable nested URLs for this site (e.g. page/sub-page/)
if(class_exists('SiteTree')) SiteTree::enable_nested_urls();
Empty file added tests/travis/_manifest_exclude
Empty file.
37 changes: 37 additions & 0 deletions tests/travis/_ss_environment.php
@@ -0,0 +1,37 @@
<?php
ob_start();

define('SS_ENVIRONMENT_TYPE', 'dev');

/* Database connection */
$db = getenv('TESTDB');
switch($db) {
case "PGSQL";
define('SS_DATABASE_CLASS', 'PostgreSQLDatabase');
define('SS_DATABASE_USERNAME', 'postgres');
define('SS_DATABASE_PASSWORD', '');
break;

case "MYSQL":
define('SS_DATABASE_CLASS', 'MySQLDatabase');
define('SS_DATABASE_USERNAME', 'root');
define('SS_DATABASE_PASSWORD', '');
break;

default:
define('SS_DATABASE_CLASS', 'SQLitePDODatabase');
define('SS_DATABASE_USERNAME', 'root');
define('SS_DATABASE_PASSWORD', '');
}

echo SS_DATABASE_CLASS;

define('SS_DATABASE_SERVER', 'localhost');
define('SS_DATABASE_CHOOSE_NAME', true);


/* Configure a default username and password to access the CMS on all sites in this environment. */
define('SS_DEFAULT_ADMIN_USERNAME', 'username');
define('SS_DEFAULT_ADMIN_PASSWORD', 'password');

$_FILE_TO_URL_MAPPING[dirname(__FILE__)] = 'http://localhost';
9 changes: 9 additions & 0 deletions tests/travis/before_script
@@ -0,0 +1,9 @@
BUILD_DIR=$1
git clone --depth=100 --branch 2.4 --quiet git://github.com/silverstripe/silverstripe-installer.git $BUILD_DIR
git clone --depth=100 --branch 1.2 --quiet git://github.com/silverstripe-labs/silverstripe-sqlite3.git $BUILD_DIR/sqlite3
git clone --depth=100 --branch 1.0 --quiet git://github.com/silverstripe/silverstripe-postgresql.git $BUILD_DIR/postgresql
cp ./tests/travis/_ss_environment.php $BUILD_DIR
cp ./tests/travis/_config.php $BUILD_DIR/mysite
cp -r . $BUILD_DIR/sapphire

cd $BUILD_DIR

0 comments on commit 21791e4

Please sign in to comment.