Skip to content

Commit

Permalink
Merge pull request overblog#22 from mcg-web/travis_ci
Browse files Browse the repository at this point in the history
Travis CI
  • Loading branch information
mcg-web authored Oct 24, 2016
2 parents 480a0e6 + 5069557 commit 1e3ba21
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 49 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/Thrift/ext/thrift_protocol/.libs/
/vendor
/build
/Tests/thrift
composer.phar
composer.lock
.gitignore
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

55 changes: 55 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
language: php

sudo: required

dist: xenial

php:
- nightly
- hhvm

branches:
only:
- master
- /^\d+\.\d+$/
env:
global:
- THRIFT_VERSION=0.9.2

matrix:
fast_finish: true
include:
- php: 5.4
env: SYMFONY_VERSION=2.3.*
- php: 5.5
env: SYMFONY_VERSION=2.7.*
- php: 5.6
env: SYMFONY_VERSION=3.0.*
- php: 7.0
env: SYMFONY_VERSION=3.0.*
- php: 7.1
env: SYMFONY_VERSION=3.1.*

allow_failures:
- php: nightly

cache:
directories:
- $HOME/.composer/cache

before_install:
- travis_retry sudo apt-get update
- travis_retry sudo apt-get install automake bison flex g++ git libboost1.55-all-dev libevent-dev libssl-dev libtool make pkg-config openjdk-7-jdk php5-dev php5-cli phpunit
- cd /tmp && (curl http://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz | tar zx) && cd thrift-${THRIFT_VERSION}/ && ./configure --without-qt4 --without-c_glib --without-csharp --without-java --without-erlang --without-python --without-perl --with-php --with-php_extension --without-ruby --without-haskell --without-go --without-d --without-cpp && make && sudo make install && cd ${TRAVIS_BUILD_DIR}
- if [[ "$TRAVIS_PHP_VERSION" != "5.6" && "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini || true; fi
- composer selfupdate
- if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
- composer require "apache/thrift:${THRIFT_VERSION}"

install:
- composer update --prefer-dist --no-interaction

script: if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then phpunit -d xdebug.max_nesting_level=1000 --debug --coverage-clover=coverage.clover; else phpunit --debug; fi

#after_script:
# - if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
1 change: 0 additions & 1 deletion Fixtures/symfony
Submodule symfony deleted from 0999ea
1 change: 0 additions & 1 deletion Fixtures/thrift
Submodule thrift deleted from 591e20
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# OverBlog Thrift Bundle #

[![Build Status](https://travis-ci.org/overblog/ThriftBundle.svg?branch=master)](https://travis-ci.org/overblog/ThriftBundle)

What is this repository ?
----------------------

Expand Down
8 changes: 1 addition & 7 deletions Tests/Client/ThriftClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,6 @@ public function testSocketClient()
}
}


protected function onNotSuccessfulTest($e)
{
parent::onNotSuccessfulTest($e);
}

public function testMultiSocketClient()
{
$thriftClient = new ThriftClient($this->factory, array(
Expand Down Expand Up @@ -260,4 +254,4 @@ public function testMultiSocketClient()
$this->assertInstanceOf('Thrift\Exception\TException', $e);
}
}
}
}
6 changes: 4 additions & 2 deletions Tests/ThriftBundleTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ protected function compile()
//Build cache
$this->compiler = new ThriftCompiler();
$this->compiler->setModelPath($this->modelPath);
$this->compiler->compile($this->definitionPath, true);
if (!$this->compiler->compile($this->definitionPath, true)) {
throw new \RuntimeException(sprintf('Compile failed: "%s".', json_encode($this->compiler->getLastOutput())));
}

// Init Loader
$l = new MapClassLoader(ClassMapGenerator::createMap($this->modelPath));
Expand All @@ -42,4 +44,4 @@ protected function onNotSuccessfulTest($e)

parent::onNotSuccessfulTest($e);
}
}
}
18 changes: 1 addition & 17 deletions Tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
<?php

require_once $_SERVER['SYMFONY'].'/Symfony/Component/ClassLoader/ClassLoader.php';

use Symfony\Component\ClassLoader\ClassLoader;

$loader = new ClassLoader();
$loader->addPrefix('Symfony', $_SERVER['SYMFONY']);
$loader->addPrefix('Thrift', $_SERVER['THRIFT']);
$loader->register();

spl_autoload_register(function($class)
{
if (0 === strpos($class, 'Overblog\\ThriftBundle\\')) {
$path = implode('/', array_slice(explode('\\', $class), 2)).'.php';
require_once __DIR__.'/../'.$path;
return true;
}
});
$loader = require __DIR__.'/../vendor/autoload.php';
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@
"exclude-from-classmap": [
"/Tests/"
]
},
"require-dev": {
}
}
24 changes: 10 additions & 14 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./Tests/bootstrap.php">
<php>
<server name="SYMFONY" value="./Fixtures/symfony/src" />
<server name="THRIFT" value="./Fixtures/thrift/lib/php/lib" />
</php>
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./Tests/bootstrap.php">
<testsuites>
<testsuite name="OverblogThriftBundle Test Suite">
<directory suffix="Test.php">./Tests</directory>
Expand All @@ -23,7 +19,7 @@
<directory>./</directory>
<exclude>
<directory>./Tests</directory>
<directory>./Fixtures</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
Expand Down

0 comments on commit 1e3ba21

Please sign in to comment.