From 86ac971948e95f256117b805bc8c2606f3467310 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 31 Oct 2012 00:18:45 +0100 Subject: [PATCH] Travis support --- .travis.yml | 29 ++++++++++++++++++++ tests/phpcs/ruleset.xml | 33 +++++++++++++++++++++++ tests/travis/_config.php | 22 +++++++++++++++ tests/travis/_ss_environment.php | 37 ++++++++++++++++++++++++++ tests/travis/before_script | 23 ++++++++++++++++ tests/{ => unit}/RestfulServerTest.php | 0 tests/{ => unit}/RestfulServerTest.yml | 0 7 files changed, 144 insertions(+) create mode 100644 .travis.yml create mode 100644 tests/phpcs/ruleset.xml create mode 100644 tests/travis/_config.php create mode 100644 tests/travis/_ss_environment.php create mode 100755 tests/travis/before_script rename tests/{ => unit}/RestfulServerTest.php (100%) rename tests/{ => unit}/RestfulServerTest.yml (100%) diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b8db2c8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,29 @@ +language: php +php: + - 5.3 + - 5.4 + +env: + - TESTDB=MYSQL CORE_RELEASE=3.0 + - TESTDB=MYSQL CORE_RELEASE=master + - TESTDB=PGSQL CORE_RELEASE=master + - TESTDB=SQLITE CORE_RELEASE=master + +matrix: + exclude: + - php: 5.4 + env: TESTDB=PGSQL CORE_RELEASE=master + - php: 5.4 + env: TESTDB=SQLITE CORE_RELEASE=master + - php: 5.4 + env: TESTDB=MYSQL CORE_RELEASE=3.0 + +before_script: + - pear -q install --onlyreqdeps pear/PHP_CodeSniffer + - phpenv rehash + - ./tests/travis/before_script ~/builds/ss + - cd ~/builds/ss + +script: + - phpunit restfulserver/tests/ + - phpcs --encoding=utf-8 --tab-width=4 --standard=restfulserver/tests/phpcs -np restfulserver diff --git a/tests/phpcs/ruleset.xml b/tests/phpcs/ruleset.xml new file mode 100644 index 0000000..383e2f0 --- /dev/null +++ b/tests/phpcs/ruleset.xml @@ -0,0 +1,33 @@ + + + CodeSniffer ruleset for SilverStripe coding conventions. + + + */css/* + css/* + + + thirdparty/* + + + 8 + + + + + + + + 7 + + + 8 + + + + + + + + + diff --git a/tests/travis/_config.php b/tests/travis/_config.php new file mode 100644 index 0000000..3508957 --- /dev/null +++ b/tests/travis/_config.php @@ -0,0 +1,22 @@ + + +BUILD_DIR=$1 + +# Fetch all dependencies +# TODO Replace with different composer.json variations +echo "Checking out installer@$CORE_RELEASE" +git clone --depth=100 --quiet --branch $CORE_RELEASE git://github.com/silverstripe/silverstripe-installer.git $BUILD_DIR +echo "Checking out framework@$CORE_RELEASE" +git clone --depth=100 --quiet --branch $CORE_RELEASE git://github.com/silverstripe/sapphire.git $BUILD_DIR/framework +echo "Checking out sqlite3" +git clone --depth=100 --quiet git://github.com/silverstripe-labs/silverstripe-sqlite3.git $BUILD_DIR/sqlite3 +echo "Checking out postgresql" +git clone --depth=100 --quiet git://github.com/silverstripe/silverstripe-postgresql.git $BUILD_DIR/postgresql + +# Copy setup files +cp ./tests/travis/_ss_environment.php $BUILD_DIR +cp ./tests/travis/_config.php $BUILD_DIR/mysite + +# Copy actual project code into build directory (checked out by travis) +cp -r . $BUILD_DIR/restfulserver + +cd $BUILD_DIR diff --git a/tests/RestfulServerTest.php b/tests/unit/RestfulServerTest.php similarity index 100% rename from tests/RestfulServerTest.php rename to tests/unit/RestfulServerTest.php diff --git a/tests/RestfulServerTest.yml b/tests/unit/RestfulServerTest.yml similarity index 100% rename from tests/RestfulServerTest.yml rename to tests/unit/RestfulServerTest.yml