diff --git a/.scrutinizer.yml b/.scrutinizer.yml index a8881e8..1707b92 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,37 +1,15 @@ inherit: true -#Copied from https://www.adayinthelifeof.nl/2013/11/20/external-code-coverage-with-travis-scrutinizer/ -tools: - external_code_coverage: - timeout: 600 - php_code_sniffer: - config: - standard: PSR2 - php_cs_fixer: - extensions: - # Default: - - php - fixers: [] - enabled: false - filter: - paths: [tests/*,code/*] - excluded_paths: [] -coding_style: - php: - indentation: - general: - use_tabs: false - -checks: - php: - code_rating: true - duplication: true - build: nodes: analysis: tests: override: [php-scrutinizer-run] +checks: + php: + code_rating: true + duplication: true + filter: - paths: [tests/*,code/*] + paths: [src/*, tests/*] \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 6e72e2c..e213a47 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,34 +1,39 @@ language: php +services: + - mysql + - postgresql + env: global: - - COMPOSER_ROOT_VERSION=4.0.x-dev - - CODECOV_TOKEN= - - SCRUT_TOKEN= + - TRAVIS_NODE_VERSION="10" matrix: include: + - php: 5.6 + env: DB=MYSQL RECIPE_VERSION=4.3.x-dev PHPUNIT_TEST=1 + - php: 7.0 + env: DB=PGSQL RECIPE_VERSION=4.3.x-dev PHPUNIT_TEST=1 - php: 7.1 - env: DB=MYSQL PHPUNIT_TEST=1 + env: DB=MYSQL RECIPE_VERSION=4.3.x-dev PHPUNIT_TEST=1 PHPCS_TEST=1 - php: 7.2 - env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1 + env: DB=PGSQL RECIPE_VERSION=4.4.x-dev PHPUNIT_TEST=1 - php: 7.3 - env: DB=MYSQL PHPCS_TEST=1 PHPUNIT_TEST=1 + env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_COVERAGE_TEST=1 before_script: - # Init PHP - phpenv rehash - phpenv config-rm xdebug.ini - - echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - # Install composer dependencies - - composer require --prefer-dist --no-update silverstripe-themes/simple:~3.2 - - composer update --no-suggest --prefer-dist + - composer validate + - composer require --no-update silverstripe/recipe-cms:"$RECIPE_VERSION" + - if [[ $DB == PGSQL ]]; then composer require --no-update silverstripe/postgresql:2.1.x-dev; fi + - composer install --prefer-source --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile script: - if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi - - if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml && wget https://scrutinizer-ci.com/ocular.phar; fi - - if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/; fi + - if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi + - if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/ *.php; fi after_success: - - if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml -t $CODECOV_TOKEN && travis_retry php ocular.phar code-coverage:upload --format=php-clover --access-token=$SCRUT_TOKEN coverage.xml; fi + - if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml -F php; fi diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..e2847b5 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,83 @@ +pipeline { + agent any + stages { + + stage('Build') { + steps { + sh 'mkdir silverstripe-cache' + sh 'composer require --prefer-dist --no-update silverstripe-themes/simple:~3.2' + sh 'composer update --no-suggest --prefer-dist' + } + } + + stage('PHPUnit') { + steps { + sh 'vendor/bin/phpunit --log-junit=build/logs/junit.xml --coverage-xml=build/logs/coverage' + } + } + + stage('Checkstyle Report') { + steps { + sh 'vendor/bin/phpcs --report=checkstyle --report-file=build/logs/checkstyle.xml --standard=phpcs.xml.dist --extensions=php,inc --ignore=autoload.php --ignore=vendor/ src/ tests/ || exit 0' + } + } + + stage('Mess Detection Report') { + steps { + sh 'vendor/bin/phpmd src xml codesize,unusedcode,naming --reportfile build/logs/pmd.xml --exclude vendor/ --exclude autoload.php || exit 0' + } + } + + stage('CPD Report') { + steps { + sh 'vendor/bin/phpcpd --log-pmd build/logs/pmd-cpd.xml --exclude vendor src/ tests/ || exit 0' + } + } + + stage('Lines of Code') { + steps { + sh 'vendor/bin/phploc --count-tests --exclude vendor/ --log-csv build/logs/phploc.csv --log-xml build/logs/phploc.xml src/ tests/' + } + } + + stage('Software metrics') { + steps { + sh 'mkdir build/pdepend' + sh 'vendor/bin/pdepend --jdepend-xml=build/logs/jdepend.xml --jdepend-chart=build/pdepend/dependencies.svg --overview-pyramid=build/pdepend/overview-pyramid.svg --ignore=vendor src' + } + } + + stage('Generate documentation') { + steps { + sh 'vendor/bin/phpdox -f phpdox.xml' + } + } + + stage('Publish Documentation') { + steps { + publishHTML (target: [ + allowMissing: false, + alwaysLinkToLastBuild: false, + keepAll: true, + reportDir: 'docs/html', + reportFiles: 'index.html', + reportName: "API" + ]) + } + } + + stage('Cleanup') { + steps { + sh 'rm -rf silverstripe-cache' + } + } + } + + post { + always { + junit 'build/logs/*.xml' + recordIssues enabledForFailure: true, tool: checkStyle(pattern: '**/logs/checkstyle.xml') + recordIssues enabledForFailure: true, tool: cpd(pattern: '**/logs/pmd-cpd.xml') + } + } +} \ No newline at end of file diff --git a/README.md b/README.md index 7dba14b..ba3dc45 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,10 @@ The FlexSlider module allows a developer to attach a [Woothemes FlexSlider](http `composer require dynamic/flexslider ^4.0` +## License + +See [License](license.md) + ## Documentation See the [docs/en](docs/en/index.md) folder. @@ -34,6 +38,17 @@ See the [docs/en](docs/en/index.md) folder. - Be sure you have run a `dev/build?flush=all` - If this is an existing site installation and `FlexSlider` is being applied to existing records, be sure to run `dev/tasks/SlideThumbnailNavMigrationTask`. This will ensure default values expected for the module are setup for the existing records. +## Translations + +The translations for this project are managed via [Transifex](https://www.transifex.com/dynamicagency/silverstripe-flexslider/) +and are updated automatically during the release process. To contribute, please head to the link above and get +translating!## Development and contribution +If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers. + +## Maintainer Contact + + * [Dynamic](http://www.dynamicagency.com) () + ## Bugtracker Bugs are tracked in the issues section of this repository. Before submitting an issue please read over existing issues to ensure yours is unique. @@ -48,15 +63,6 @@ If the issue does look like a new bug: Please report security issues to the module maintainers directly. Please don't file security issues in the bugtracker. -## Maintainer Contact - - * [Dynamic](http://www.dynamicagency.com) () -## License -See [License](license.md) - -## Translations - -The translations for this project are managed via [Transifex](https://www.transifex.com/dynamicagency/silverstripe-flexslider/) -and are updated automatically during the release process. To contribute, please head to the link above and get -translating! \ No newline at end of file +## Development and contribution +If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers. \ No newline at end of file diff --git a/composer.json b/composer.json index ac96498..cfa8f70 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,12 @@ }, "require-dev": { "phpunit/phpunit": "^5.7", - "squizlabs/php_codesniffer": "*" + "squizlabs/php_codesniffer": "^3.0", + "phpmd/phpmd": "^2.6", + "sebastian/phpcpd": "^3.0", + "phploc/phploc": "^4.0", + "pdepend/pdepend": "^2.5", + "theseer/phpdox": "^0.11.0" }, "autoload": { "psr-4": { diff --git a/phpdox.xml b/phpdox.xml new file mode 100644 index 0000000..cc263d6 --- /dev/null +++ b/phpdox.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +