Skip to content

Commit

Permalink
Update PHP, PHPUnit and Travis config
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Dec 5, 2019
1 parent db4acb3 commit bb95186
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 9 deletions.
50 changes: 43 additions & 7 deletions .travis.yml
@@ -1,8 +1,17 @@
language: php

php:
- 7.2
- 7.3
env:
global:
- DEFAULT_COMPOSER_FLAGS="--prefer-dist --no-interaction --no-progress --optimize-autoloader"
- TASK_STATIC_ANALYSIS=0
- TASK_TESTS_COVERAGE=0

matrix:
include:
- php: "7.4"
env:
- TASK_STATIC_ANALYSIS=0 # set to 1 to enable static analysis
- TASK_TESTS_COVERAGE=1

# faster builds on new travis setup not using sudo
sudo: false
Expand All @@ -12,18 +21,45 @@ cache:
directories:
- $HOME/.composer/cache

before_install:
- phpenv config-rm xdebug.ini || echo "xdebug is not installed"

install:
- travis_retry composer self-update && composer --version
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- travis_retry composer install --prefer-dist --no-interaction
- travis_retry composer install $DEFAULT_COMPOSER_FLAGS
- |
if [ $TASK_STATIC_ANALYSIS == 1 ]; then
pecl install ast
fi
before_script:
- php --version
- composer --version
# enable code coverage
- |
if [ $TASK_TESTS_COVERAGE == 1 ]; then
PHPUNIT_COVERAGE_FLAG="--coverage-clover=coverage.clover"
fi
script:
- phpdbg -qrr vendor/bin/phpunit --verbose $PHPUNIT_COVERAGE_FLAG
- |
if [ $TASK_STATIC_ANALYSIS == 1 ]; then
composer phan
fi
- |
vendor/bin/phpunit $PHPUNIT_FLAGS --coverage-clover=coverage.clover
if [ $TASK_STATIC_ANALYSIS == 1 ]; then
cat analysis.txt
fi
after_script:
- wget -c https://scrutinizer-ci.com/ocular.phar
- php php-ocular code-coverage:upload --format=php-clover coverage.clover
- |
if [ $TASK_TESTS_COVERAGE == 1 ]; then
travis_retry wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
fi
notifications:
slack:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -18,12 +18,12 @@
"source": "https://github.com/yiisoft/i18n"
},
"require": {
"php": "^7.2",
"php": "^7.4",
"psr/event-dispatcher": "1.0.0",
"ext-intl": "*"
},
"require-dev": {
"phpunit/phpunit": "^7.2"
"phpunit/phpunit": "^8.4"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit bb95186

Please sign in to comment.