From 643804d787e7971208111f38d05cba9b5a50c13d Mon Sep 17 00:00:00 2001 From: Milos Tomic Date: Tue, 9 Feb 2016 14:33:56 +0100 Subject: [PATCH] CI --- .travis.yml | 20 ++++++++++++++++---- composer.json | 10 ++-------- contrib/pre-commit | 39 --------------------------------------- contrib/setup.sh | 12 ------------ 4 files changed, 18 insertions(+), 63 deletions(-) delete mode 100644 contrib/pre-commit delete mode 100644 contrib/setup.sh diff --git a/.travis.yml b/.travis.yml index 7d64a6e..8bbe55f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,15 +3,27 @@ language: php php: - 5.5 - 5.6 + - 7.0 + - hhvm -before_script: +matrix: + allow_failures: + - php: hhvm + include: + - php: 5.5 + env: COMPOSER_FLAGS="--prefer-lowest" + +before_install: + - composer self-update + - composer --version - wget http://get.sensiolabs.org/php-cs-fixer.phar -O php-cs-fixer.phar - - COMPOSER_ROOT_VERSION=dev-master composer install + +install: + - COMPOSER_ROOT_VERSION=dev-master composer update --prefer-source $COMPOSER_FLAGS script: - php php-cs-fixer.phar fix --dry-run -v - bin/phpunit --coverage-clover build/logs/clover.xml after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml + - php bin/coveralls -v diff --git a/composer.json b/composer.json index a30790a..85e93c7 100644 --- a/composer.json +++ b/composer.json @@ -15,14 +15,8 @@ }, "require-dev": { "phpunit/phpunit": "~4.5", - "monolog/monolog": "~1.3" - }, - "scripts": { - "post-install-cmd": [ - "bash contrib/setup.sh" - ], - "post-update-cmd": [ - ] + "monolog/monolog": "~1.3", + "satooshi/php-coveralls": "~0.6" }, "config": { "bin-dir": "bin" diff --git a/contrib/pre-commit b/contrib/pre-commit deleted file mode 100644 index f5e7c29..0000000 --- a/contrib/pre-commit +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# Pre-commit Git hook. -# Runs PHP CS Fixer on PHP files. -# -# If you absolutely must commit without testing, -# use: git commit --no-verify - -# This will check only staged files to be commited. -filenames=($(git diff --staged --name-only HEAD)) - -# This will set text to red in terminal. -text_red=`tput setaf 1` -# This will set the text to green in terminal. -text_green=`tput setaf 2` -# This will reset the terminal text to normal. -text_reset=`tput sgr0` - -numberFilesChanged="${#filenames[@]}" - -if [[ $numberFilesChanged > 0 ]]; -then - echo "$numberFilesChanged files were changed, running php-cs-fixer" - # PHP CS Fixer. - for i in "${filenames[@]}" - do - if [[ $i == *.php ]]; - then - php php-cs-fixer.phar fix $i - - if [ $? -ne 0 ]; - then - # File had some issues. Now it is fine. Add this file to git again. - git add $i - fi - fi - done -fi - -echo "${text_green}PHP CS Fixer finished execution successfully.${text_reset}" diff --git a/contrib/setup.sh b/contrib/setup.sh deleted file mode 100644 index 9fa9c63..0000000 --- a/contrib/setup.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -if [ ! -f php-cs-fixer.phar ]; then - echo "The php-cs-fixer.phar is required... downloading..." - wget http://get.sensiolabs.org/php-cs-fixer.phar -O php-cs-fixer.phar || curl http://get.sensiolabs.org/php-cs-fixer.phar -o php-cs-fixer.phar || { echo >&2 "I require wget or curl but they are not installed. Aborting."; exit 1; } -fi - -# Copy the pre-commit hook to the current repository hooks directory. -cp contrib/pre-commit .git/hooks/pre-commit - -# Add execution permission for pre-commit file. -chmod +x .git/hooks/pre-commit \ No newline at end of file