diff --git a/.docker/Makefile b/.docker/Makefile new file mode 100644 index 0000000..ec1d8fc --- /dev/null +++ b/.docker/Makefile @@ -0,0 +1,22 @@ +VERSIONS = php-5.6 php-7.0 php-7.1 nightly + +all: build test clean + +build: + @echo ">> building images" + docker-compose build + +test: + @- $(foreach version,$(VERSIONS), \ + echo ">> run tests with $(version)"; \ + docker-compose run --rm $(version) php bin/security-checker.phar security:check ./composer.lock --end-point=http://security.sensiolabs.org/check_lock; \ + docker-compose run --rm $(version) php bin/phpcs.phar --standard=PSR2 ./src -v; \ + docker-compose run --rm $(version) php bin/phpmd.phar ./src text ./phpmd.xml; \ + docker-compose run --rm $(version) php bin/phpcpd.phar ./src; \ + docker-compose run --rm $(version) php bin/phpunit.phar; \ + printf "\033c"; \ + ) + +clean: + @echo ">> cleanup" + docker-compose rm -f &>/dev/null diff --git a/.docker/README.md b/.docker/README.md index f1665e7..f7590de 100644 --- a/.docker/README.md +++ b/.docker/README.md @@ -10,32 +10,7 @@ To avoid development failures you can use this tiny suite which executes all nee ## Usage ``` -$ chmod +x ./run.sh -$ ./run.sh -``` - -## Example output - -On success - -``` -Run checks with PHP 5.6.25 [ INFO ] -Run security-checker [ OK ] -Check PSR2 codestyle [ OK ] -Run copy paste detection [ OK ] -Run tests [ OK ] -Run checks with PHP 7.0.10 [ INFO ] -Run security-checker [ OK ] -... -``` - -or on failure: - -``` -Run checks with PHP 5.6.25 [ INFO ] -Run security-checker [ OK ] -Check PSR2 codestyle [ FAIL ] -Failed command: docker-compose run php-5.6 php bin/phpcs.phar --standard=PSR2 ./src -v[ FAIL ] +$ make ``` ## Source diff --git a/.docker/run.sh b/.docker/run.sh deleted file mode 100755 index 80627b5..0000000 --- a/.docker/run.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env bash - -print_task() { - printf "%-80s" "${1}" - return 0 -} - -print_info() { - STATUS="[ INFO ]"; - COLOR="\x1b[36;01m"; - COLOR_RESET="\x1b[39;49;00m" - - print_task "${1}" - echo -e "${COLOR}${STATUS}${COLOR_RESET}" - return 0 -} - -print_ok() { - STATUS="[ OK ]"; - COLOR="\x1b[33;32m"; - COLOR_RESET="\x1b[39;49;00m" - - echo -e "${COLOR}${STATUS}${COLOR_RESET}" - return 0 -} - -print_fail() { - STATUS="[ FAIL ]"; - COLOR="\x1b[31;31m"; - COLOR_RESET="\x1b[39;49;00m" - - echo -e "${COLOR}${STATUS}${COLOR_RESET}" - printf "%-80s" "${1}" - echo -e "${COLOR}${STATUS}${COLOR_RESET}" - return 0 -} - -execute() { - OUTPUT=`${1} &>/dev/null` - if [ ! "$?" == 0 ]; then - print_fail "Failed command: $1" - exit 1 - fi - print_ok -} - -docker-compose build &>/dev/null - -VERSIONS=( "php-5.6" "php-7.0" "php-7.1" "nightly" "hhvm" ) -for VERSION in "${VERSIONS[@]}" -do - printf "\033c" - print_info "Run checks with PHP $(docker-compose run $VERSION php -r 'echo phpversion();')" - - if [ ! $VERSION == "hhvm" ]; then - print_task "Run security-checker" - execute "docker-compose run --rm $VERSION php bin/security-checker.phar security:check ./composer.lock" - - print_task "Check PSR2 codestyle" - execute "docker-compose run --rm $VERSION php bin/phpcs.phar --standard=PSR2 ./src -v" - - print_task "Check phpmd rules" - execute "docker-compose run --rm $VERSION php bin/phpmd.phar ./src text ./phpmd.xml " - - print_task "Run copy paste detection" - execute "docker-compose run --rm $VERSION php bin/phpcpd.phar ./src" - fi - - print_task "Run tests" - execute "docker-compose run --rm $VERSION php bin/phpunit.phar" -done - -docker-compose stop &>/dev/null -docker-compose rm -f &>/dev/null