Skip to content

Commit

Permalink
Updated travis config (#73)
Browse files Browse the repository at this point in the history
* Test better on symfony 4

* Fixed tests

* Better deps

* Bugfix
  • Loading branch information
Nyholm authored Jan 15, 2018
1 parent a90d14d commit 8be6400
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 46 deletions.
91 changes: 58 additions & 33 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,76 @@ services:
- redis-server
- memcached

php:
- 7.1
- 7.0
- 5.6
cache:
directories:
- $HOME/.composer/cache/files
- $HOME/symfony-bridge/.phpunit

env:
global:
- COMPOSER_COMMAND="composer install --prefer-dist"
- TEST_COMMAND="php vendor/bin/phpunit"
- COVERAGE=false
matrix:
- SYMFONY_VERSION=2.7.*
- SYMFONY_VERSION=2.8.*
- SYMFONY_VERSION=3.3.*
- SYMFONY_VERSION=4.0.*
global:
- TEST_COMMAND="composer test"
- SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"
- SYMFONY_DEPRECATIONS_HELPER="weak"

branches:
except:
- /^analysis-.*$/
- /^patch-.*$/
except:
- /^analysis-.*$/

matrix:
fast_finish: true
include:
- php: 5.6
env: COMPOSER_COMMAND="composer update --prefer-lowest --prefer-stable" COVERAGE=true TEST_COMMAND="php -dzend_extension=xdebug.so vendor/bin/phpunit --coverage-clover=coverage.xml" SYMFONY_VERSION=2.7.*
- php: hhvm
env: SYMFONY_VERSION=3.3.*
dist: trusty
fast_finish: true
include:
# Minimum supported Symfony version and latest PHP version
- php: 7.2
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak"
- php: 5.6
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak"

cache:
directories:
- $HOME/.composer/cache
# Test the latest stable release
- php: 5.6
- php: 7.0
env: SYMFONY_PHPUNIT_VERSION="6.3"
- php: 7.1
env: SYMFONY_PHPUNIT_VERSION="6.3"
- php: 7.2
env: COVERAGE=true TEST_COMMAND="composer test-ci"

# Test LTS versions
- php: 7.2
env: DEPENDENCIES="dunglas/symfony-lock:^2"
- php: 7.2
env: DEPENDENCIES="dunglas/symfony-lock:^3"
- php: 7.2
env: DEPENDENCIES="dunglas/symfony-lock:^4"

# Latest commit to master
- php: 7.2
env: STABILITY="dev"

allow_failures:
# dev stability is allowed to fail.
- env: STABILITY="dev"

before_install:
- if [[ $TRAVIS_PHP_VERSION != 'hhvm' ]]; then phpenv config-add .travis/phpconfig.ini; fi;
- if [[ $TRAVIS_PHP_VERSION != 'hhvm' ]]; then phpenv config-rm xdebug.ini; fi;
- pip install --user codecov
- composer require symfony/symfony:${SYMFONY_VERSION} --no-update
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
- if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi;
- if ! [ -v "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi;
- pip install --user codecov

install:
- travis_retry ${COMPOSER_COMMAND} --no-interaction
# To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355
- if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi
- composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
- vendor/bin/simple-phpunit install

script:
- $TEST_COMMAND
- composer validate --strict --no-check-lock
- $TEST_COMMAND

after_success:
- if [[ "$COVERAGE" = true ]]; then codecov; fi
- if [[ $COVERAGE = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [[ $COVERAGE = true ]]; then php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml; fi
- if [[ "$COVERAGE" = true ]]; then codecov; fi

after_script:
- wget http://tnyholm.se/reporter.phar
- php reporter.phar build:upload
26 changes: 15 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,13 @@
"require": {
"php": "^5.6 || ^7.0",
"cache/array-adapter": "^1.0",
"symfony/framework-bundle": "^2.7 || ^3.0 || ^4.0",
"symfony/options-resolver": "^2.7 || ^3.0 || ^4.0",
"cache/namespaced-cache": "^1.0",
"psr/cache": "^1.0",
"psr/log": "^1.0",
"cache/namespaced-cache": "^1.0"
"symfony/framework-bundle": "^2.7 || ^3.0 || ^4.0",
"symfony/options-resolver": "^2.7 || ^3.0 || ^4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36 || ^5.5",
"symfony/symfony": "^2.7 || ^3.0 || ^4.0",
"matthiasnoback/symfony-dependency-injection-test": "^1.0",
"nyholm/symfony-bundle-test": "^1.2.0",
"cache/apc-adapter": "^1.0",
"cache/apcu-adapter": "^1.0",
"cache/chain-adapter": "^1.0",
Expand All @@ -39,11 +35,14 @@
"cache/memcache-adapter": "^1.0",
"cache/memcached-adapter": "^1.0",
"cache/predis-adapter": "^1.0",
"cache/prefixed-cache": "^1.0",
"cache/redis-adapter": "^1.0",
"cache/void-adapter": "^1.0",
"cache/prefixed-cache": "^1.0",
"doctrine/cache": "^1.6",
"predis/predis": "^1.1"
"matthiasnoback/symfony-dependency-injection-test": "^1.1 || ^2.3",
"nyholm/symfony-bundle-test": "^1.2.0",
"predis/predis": "^1.1",
"symfony/phpunit-bridge": "^3.3 || ^4.0"
},
"suggest": {
"cache/*-adapter": "A actual implementation of PSR-6 cache",
Expand All @@ -59,6 +58,11 @@
"Cache\\AdapterBundle\\Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true
"scripts": {
"test": "vendor/bin/simple-phpunit",
"test-ci": "vendor/bin/simple-phpunit --coverage-text --coverage-clover=build/coverage.xml"
},
"config": {
"sort-packages": true
}
}
6 changes: 4 additions & 2 deletions src/DependencyInjection/CacheAdapterExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Cache\AdapterBundle\DummyAdapter;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Reference;
Expand Down Expand Up @@ -52,11 +53,12 @@ public function load(array $configs, ContainerBuilder $container)

$def = $container->register('cache.provider.'.$name, DummyAdapter::class);
$def->setFactory([new Reference($arguments['factory']), 'createAdapter'])
->addArgument($arguments['options']);
->addArgument($arguments['options'])
->setPublic(true);

$def->addTag('cache.provider');
foreach ($arguments['aliases'] as $alias) {
$container->setAlias($alias, 'cache.provider.'.$name);
$container->setAlias($alias, new Alias('cache.provider.'.$name, true));
}
}

Expand Down

0 comments on commit 8be6400

Please sign in to comment.