From ba51a8e8e1f6a3eea50ae23fb592fafa7b7a168f Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Thu, 20 Jul 2017 09:30:27 +1200 Subject: [PATCH] FIX Update Travis configuration and coverage whitelist --- .travis.yml | 53 +++++++++++++++++++----------------------------- composer.json | 11 ++++++++-- phpunit.xml.dist | 12 ++++------- 3 files changed, 34 insertions(+), 42 deletions(-) diff --git a/.travis.yml b/.travis.yml index 76a6629..dcb2101 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,50 +1,39 @@ -language: php +# See https://github.com/silverstripe/silverstripe-travis-support for setup details sudo: false -addons: - apt: - packages: - - tidy - -before_install: - - pip install --user codecov +language: php env: global: - # Turn coverage off by default, as it's expensive time wise - - COVERAGE=0 - - # The path of the module when installed by composer - - MODULE_PATH=blog + - COMPOSER_ROOT_VERSION="4.0.x-dev" matrix: include: - php: 5.6 - env: DB=MYSQL CORE_RELEASE=4 COVERAGE=1 + env: DB=MYSQL PHPCS_TEST=1 PHPUNIT_TEST=1 - php: 7.0 - env: DB=PGSQL CORE_RELEASE=4 - - php: 7.1.2 - env: DB=MYSQL CORE_RELEASE=4 + env: DB=PGSQL PHPUNIT_TEST=1 + - php: 7.1 + env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1 before_script: +# Init PHP - phpenv rehash - - composer self-update || true - - git clone git://github.com/silverstripe/silverstripe-travis-support.git ~/travis-support - - php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss --require "silverstripe/comments" --require "silverstripe/widgets" - - cd ~/builds/ss - - mv "$MODULE_PATH/phpunit.xml.dist" . + - phpenv config-rm xdebug.ini + - echo 'memory_limit = 2G' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + +# Install composer dependencies + - composer install --prefer-dist + - composer require --prefer-dist --no-update symfony/config:^3.2 silverstripe/framework:4.0.x-dev silverstripe/cms:4.0.x-dev silverstripe/admin:1.0.x-dev silverstripe/assets:1.0.x-dev silverstripe/versioned:1.0.x-dev + - composer update + + - if [[ $DB == PGSQL ]]; then composer require silverstripe/postgresql:2.0.x-dev --prefer-dist; fi -#Execute tests with or without coverage script: - # Execute tests with no coverage. This is the fastest option - - "if [ \"$COVERAGE\" = \"0\" ]; then vendor/bin/phpunit $MODULE_PATH/tests/; fi" + - if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit tests/; fi + - if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml tests/; fi + - if [[ $PHPCS_TEST ]]; then composer run-script lint; fi - # Execute tests with coverage. Do this for a small - - "if [ \"$COVERAGE\" = \"1\" ]; then vendor/bin/phpunit --coverage-clover=coverage.clover $MODULE_PATH/tests/; fi" - -# Upload code coverage when tests pass after_success: - - "if [ \"$COVERAGE\" = \"1\" ]; then mv coverage.clover ~/build/$TRAVIS_REPO_SLUG/; fi" - - cd ~/build/$TRAVIS_REPO_SLUG - - "if [ \"$COVERAGE\" = \"1\" ]; then travis_retry codecov; fi" + - if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi diff --git a/composer.json b/composer.json index dbaf739..b1417c6 100755 --- a/composer.json +++ b/composer.json @@ -10,10 +10,13 @@ "require": { "silverstripe/cms": "^4.0", "silverstripe/lumberjack": "^2.0", - "silverstripe/tagfield": "^2.0" + "silverstripe/tagfield": "^2.0", + "silverstripe/assets": "^1.0@dev", + "silverstripe/asset-admin": "^1.0@dev" }, "require-dev": { - "phpunit/PHPUnit": "~4.8" + "phpunit/PHPUnit": "^5.7", + "squizlabs/php_codesniffer": "*" }, "extra": { "branch-alias": { @@ -37,6 +40,10 @@ "silverstripe/widgets": "Some widgets come with the blog which are compatible with the widgets module.", "silverstripe/comments": "This module adds comments to your blog." }, + "scripts": { + "lint": "vendor/bin/phpcs src/ tests/", + "lint-clean": "vendor/bin/phpcbf src/ tests/" + }, "replace": { "micmania1/silverstripe-blog": "*" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f7339cb..6dc75e9 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,17 +1,13 @@ - + - blog/tests + tests/ - - - - - blog/src/ + src/ - blog/tests/ + tests/