mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Simplified travis builds (using external script)
This commit is contained in:
parent
538bf01860
commit
9ed8eba253
28
.travis.yml
28
.travis.yml
@ -1,37 +1,37 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
|
||||
env:
|
||||
- TESTDB=MYSQL
|
||||
- TESTDB=SQLITE
|
||||
- DB=MYSQL CORE_RELEASE=master
|
||||
- DB=PGSQL CORE_RELEASE=master
|
||||
- DB=SQLITE3 CORE_RELEASE=master
|
||||
- PHPCS=1 CORE_RELEASE=master
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
- php: 5.4
|
||||
env: TESTDB=PGSQL
|
||||
env: DB=PGSQL CORE_RELEASE=master
|
||||
- php: 5.4
|
||||
env: TESTDB=SQLITE
|
||||
include:
|
||||
env: DB=SQLITE3 CORE_RELEASE=master
|
||||
- php: 5.4
|
||||
env:
|
||||
- PHPCS=1
|
||||
env: PHPCS=1 CORE_RELEASE=master
|
||||
allow_failures:
|
||||
- env: TESTDB=PGSQL
|
||||
- php: 5.4
|
||||
env:
|
||||
- PHPCS=1
|
||||
- env: TESTDB=SQLITE
|
||||
- env: DB=PGSQL CORE_RELEASE=master
|
||||
- env: DB=SQLITE3 CORE_RELEASE=master
|
||||
- env: PHPCS=1 CORE_RELEASE=master
|
||||
|
||||
before_script:
|
||||
- pear install pear/PHP_CodeSniffer
|
||||
- phpenv rehash
|
||||
- ./tests/travis/before.php --target ~/builds/ss --version="dev-master" --installer="master"
|
||||
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
|
||||
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
|
||||
- cd ~/builds/ss
|
||||
|
||||
script:
|
||||
- sh -c "if [ '$PHPCS' != '1' ]; then phpunit -c phpunit.xml.dist; else phpcs --encoding=utf-8 --tab-width=4 --standard=framework/tests/phpcs/ruleset.xml -np framework && phpcs --encoding=utf-8 --standard=framework/tests/phpcs/tabs.xml -np framework; fi"
|
||||
- sh -c "if [ '$PHPCS' != '1' ]; then phpunit framework/tests; else phpcs --encoding=utf-8 --tab-width=4 --standard=framework/tests/phpcs/ruleset.xml -np framework && phpcs --encoding=utf-8 --standard=framework/tests/phpcs/tabs.xml -np framework; fi"
|
||||
|
||||
branches:
|
||||
except:
|
||||
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $project;
|
||||
$project = 'mysite';
|
||||
|
||||
global $database;
|
||||
$database = '';
|
||||
|
||||
require_once('conf/ConfigureFromEnv.php');
|
||||
|
||||
global $databaseConfig;
|
||||
$databaseConfig['memory'] = true;
|
||||
$databaseConfig['path'] = dirname(dirname(__FILE__)) .'/assets/';
|
@ -1,37 +0,0 @@
|
||||
<?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';
|
@ -1,83 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
* Initialises a test project that can be built by travis.
|
||||
*
|
||||
* The local framework checkout's composer file is parsed and used to built a
|
||||
* custom local framework archive which is then installed into an installer
|
||||
* base project.
|
||||
*/
|
||||
|
||||
if (php_sapi_name() != 'cli') {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
exit;
|
||||
}
|
||||
|
||||
$opts = getopt('', array(
|
||||
'target:',
|
||||
'version:',
|
||||
'installer:'
|
||||
));
|
||||
|
||||
if (!$opts) {
|
||||
echo "Invalid arguments specified\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
extract($opts);
|
||||
|
||||
$dir = __DIR__;
|
||||
$framework = dirname(dirname($dir));
|
||||
$parent = dirname($framework);
|
||||
|
||||
// Print out some environment information.
|
||||
printf("Database versions:\n");
|
||||
printf(" * MySQL: %s\n", trim(`mysql --version`));
|
||||
printf(" * PostgreSQL: %s\n", trim(`pg_config --version`));
|
||||
printf(" * SQLite: %s\n\n", trim(`sqlite3 -version`));
|
||||
|
||||
// Extract the package info from the framework composer file, and build a
|
||||
// custom project composer file with the local package explicitly defined.
|
||||
echo "Reading composer information...\n";
|
||||
$package = json_decode(file_get_contents("$framework/composer.json"), true);
|
||||
|
||||
// Override the default framework requirement with the one being built.
|
||||
$package += array(
|
||||
'version' => $version,
|
||||
'dist' => array(
|
||||
'type' => 'tar',
|
||||
'url' => "file://$parent/framework.tar"
|
||||
)
|
||||
);
|
||||
|
||||
// Generate a custom composer file.
|
||||
$composer = json_encode(array(
|
||||
'repositories' => array(array('type' => 'package', 'package' => $package)),
|
||||
'require' => array(
|
||||
'silverstripe/framework' => $version,
|
||||
'silverstripe/postgresql' => '*',
|
||||
'silverstripe/sqlite3' => '*'
|
||||
),
|
||||
'minimum-stability' => 'dev'
|
||||
));
|
||||
|
||||
echo "Generated composer file:\n";
|
||||
echo "$composer\n\n";
|
||||
|
||||
echo "Archiving framework...\n";
|
||||
`cd $framework`;
|
||||
`tar -cf $parent/framework.tar .`;
|
||||
|
||||
echo "Cloning installer@$installer...\n";
|
||||
`git clone --depth=100 --quiet -b $installer git://github.com/silverstripe/silverstripe-installer.git $target`;
|
||||
|
||||
echo "Setting up project...\n";
|
||||
`cp $dir/_ss_environment.php $target`;
|
||||
`cp $dir/_config.php $target/mysite`;
|
||||
|
||||
echo "Replacing composer file...\n";
|
||||
unlink("$target/composer.json");
|
||||
file_put_contents("$target/composer.json", $composer);
|
||||
|
||||
echo "Running composer...\n";
|
||||
`composer install --dev -d $target`;
|
Loading…
Reference in New Issue
Block a user