From bced835b8e5a14dfa188ab9a4f55c725bd49baad Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Tue, 8 Aug 2017 16:28:08 +1200 Subject: [PATCH] Add Travis configuration, phpcs and phpunit configuration, new build badges in readme --- .travis.yml | 35 +++++++++++++++++++++++++++----- composer.json | 52 ++++++++++++++++++++++++++---------------------- phpcs.xml.dist | 22 ++++++++++++++++++++ phpunit.xml.dist | 13 ++++++++++++ readme.md | 8 ++++---- 5 files changed, 97 insertions(+), 33 deletions(-) create mode 100644 phpcs.xml.dist create mode 100644 phpunit.xml.dist diff --git a/.travis.yml b/.travis.yml index ba163a46..e83cb812 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,32 @@ -sudo: false - language: php -branches: - except: - develop +env: + global: + - COMPOSER_ROOT_VERSION=4.0.x-dev + +matrix: + include: + - php: 5.6 + env: DB=MYSQL PHPCS_TEST=1 PHPUNIT_TEST=1 + - php: 7.0 + env: DB=MYSQL PHPUNIT_TEST=1 + - php: 7.1 + env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1 + +before_script: + # Init PHP + - phpenv rehash + - phpenv config-rm xdebug.ini + + # Install composer dependencies + - composer install --prefer-dist + - composer require --prefer-dist --no-update silverstripe/framework:4.0.x-dev silverstripe/cms:4.0.x-dev silverstripe/admin:1.0.x-dev silverstripe/versioned:1.0.x-dev + - composer update + +script: + - if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit tests/php; fi + - if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml tests/php; fi + - if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/; fi + +after_success: + - 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 a4026f82..2ee9417b 100644 --- a/composer.json +++ b/composer.json @@ -1,31 +1,35 @@ { - "name": "tractorcow/silverstripe-fluent", - "description": "Simple localisation for Silverstripe", - "type": "silverstripe-module", - "keywords": [ + "name": "tractorcow/silverstripe-fluent", + "description": "Simple localisation for Silverstripe", + "type": "silverstripe-module", + "keywords": [ "silverstripe", "localisation", "localization", "translation", "language", "locale", "multilingual", "translatable", "i18n", "internationalisation", "internationalization" ], - "license": "BSD-3-Clause", - "authors": [ - { - "name": "Damian Mooyman", - "email": "damian.mooyman@gmail.com" - } - ], - "support": { - "issues": "http://github.com/tractorcow/silverstripe-fluent/issues" - }, - "require": { - "silverstripe/framework": "^4@dev", - "silverstripe/cms": "^4@dev" - }, - "extra": { - "branch-alias": { - "dev-develop": "4.0.x-dev" - }, - "installer-name": "fluent" - }, + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Damian Mooyman", + "email": "damian.mooyman@gmail.com" + } + ], + "support": { + "issues": "http://github.com/tractorcow/silverstripe-fluent/issues" + }, + "require": { + "silverstripe/framework": "^4@dev", + "silverstripe/cms": "^4@dev" + }, + "require-dev": { + "phpunit/phpunit": "^5.7", + "squizlabs/php_codesniffer": "*" + }, + "extra": { + "branch-alias": { + "dev-develop": "4.0.x-dev" + }, + "installer-name": "fluent" + }, "autoload": { "psr-4": { "TractorCow\\Fluent\\": "src/", diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 00000000..c4c9ca11 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,22 @@ + + + CodeSniffer ruleset for SilverStripe coding conventions. + + + + + + + + + + + + + + + + + + + diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 00000000..110f952a --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,13 @@ + + + tests/php/ + + + + src/ + + tests/ + + + + diff --git a/readme.md b/readme.md index ca99badf..3ae75340 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,8 @@ # Fluent -[![Build Status](https://travis-ci.org/tractorcow/silverstripe-fluent.svg?branch=master)](https://travis-ci.org/tractorcow/silverstripe-fluent) - -[![Codewake](https://www.codewake.com/badges/ask_question.svg)](https://www.codewake.com/p/silverstripe-fluent) +[![Build Status](https://travis-ci.org/tractorcow/silverstripe-fluent.svg?branch=develop)](https://travis-ci.org/tractorcow/silverstripe-fluent) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/tractorcow/silverstripe-fluent/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/tractorcow/silverstripe-fluent/?branch=develop) +[![codecov](https://codecov.io/gh/tractorcow/silverstripe-fluent/branch/develop/graph/badge.svg)](https://codecov.io/gh/tractorcow/silverstripe-fluent) ## Simple Silverstripe Localisation @@ -14,7 +14,7 @@ Locales are distinguished by a url prefix, that of the selected locale, at the s of all page links. E.g. `http://damian.geek.nz/en_NZ/about-me` would be the NZ English version of a page. This could be localised into Maori at `http://damian.geek.nz/mi_NZ/about-me` -Fluent also integrates nicely with Google Sitemaps module, linking localisations for each page as per +Fluent also integrates nicely with Google Sitemaps module, linking localisations for each page as per [Google's internationalisation guidelines](https://support.google.com/webmasters/answer/182192?hl=en&ref_topic=2370587) Fluent also supports the use of multiple domains to assist in locale filtering