diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..e10a62948c694c64f3edf14d3aa8220febe2393a --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,101 @@ +stages: + - test + - publish + +phpunit: + stage: test + needs: [] + parallel: + matrix: + - PHP_VERSION: ['7.3', '7.4', '8.0', '8.1', '8.2'] + image: iras/php-composer:${PHP_VERSION} + cache: + key: php-dependencies-${PHP_VERSION} + paths: + - ./storage/composer + before_script: + - export COMPOSER_CACHE_DIR=$(pwd)/storage/composer + # basically we are ignoring the composer.lock in tests + - composer update --no-interaction --ansi + script: + - php -dzend_extension=xdebug.so -dxdebug.mode=coverage + vendor/bin/phpunit -c phpunit.xml --color=always + --coverage-text --coverage-cobertura=coverage/cobertura.xml + --coverage-html=coverage/html | tee /tmp/phpunit.out + - sed -r 's~\x01?(\x1B\(B)?\x1B\[([0-9;]*)?[JKmsu]\x02?~~g' /tmp/phpunit.out|grep '^ Lines' + artifacts: + paths: + - coverage/html + reports: + coverage_report: + coverage_format: cobertura + path: coverage/cobertura.xml + coverage: '/^\s*Lines:\s*\d+.\d+\%/' + + +phpunit-old: + stage: test + needs: [] + parallel: + matrix: + - PHP_VERSION: ['7.1', '7.2'] + image: iras/php-composer:${PHP_VERSION} + cache: + key: php-dependencies-${PHP_VERSION} + paths: + - ./storage/composer + before_script: + - export COMPOSER_CACHE_DIR=$(pwd)/storage/composer + # basically we are ignoring the composer.lock in tests + - composer update --no-interaction --ansi + script: + - php -dzend_extension=xdebug.so -dxdebug.mode=coverage + vendor/bin/phpunit -c phpunit.xml --color=always + --coverage-text + --coverage-html=coverage/html | tee /tmp/phpunit.out + - sed -r 's~\x01?(\x1B\(B)?\x1B\[([0-9;]*)?[JKmsu]\x02?~~g' /tmp/phpunit.out|grep '^ Lines' + artifacts: + paths: + - coverage/html + coverage: '/^\s*Lines:\s*\d+.\d+\%/' + +#quality: +# stage: test +# needs: [ ] +# image: iras/php-composer:8.2 +# cache: +# key: php-dependencies-8.2 +# paths: +# - ./storage/composer +# before_script: +# - export COMPOSER_CACHE_DIR=$(pwd)/storage/composer +# # basically we are ignoring the composer.lock in tests +# - composer update --no-interaction --ansi +# script: +# - composer run code-quality + +style: + stage: test + needs: [] + image: iras/php-composer:8.2 + cache: + key: php-dependencies-8.2 + paths: + - ./storage/composer + before_script: + - export COMPOSER_CACHE_DIR=$(pwd)/storage/composer + # basically we are ignoring the composer.lock in tests + - composer update --no-interaction --ansi + script: + - composer run code-style + +packagist: + stage: publish + needs: [phpunit] + image: alpine:3.18 + before_script: + - apk add --no-cache curl + script: + - curl -XPOST -H'content-type:application/json' + 'https://packagist.org/api/update-package?username=tflori&apiToken='${PACKAGIST_API_TOKEN} + -d'{"repository":{"url":"https://gitlab.w00tserver.org/tflori/nb-sessions.git"}}' diff --git a/README.md b/README.md index 1c7d53ac0de23027c0b1ace3d681170a5f9a6268..29b97fedb45fb03950386f1940a95bc97b780473 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # tflori/verja -[](https://github.com/tflori/verja/actions/workflows/push.yml) -[](https://codeclimate.com/github/tflori/verja/test_coverage) -[](https://codeclimate.com/github/tflori/verja/maintainability) +[](https://gitlab.w00tserver.org/tflori/verja/-/pipelines) +[](https://gitlab.w00tserver.org/tflori/verja/-/pipelines) [](https://packagist.org/packages/tflori/verja) [](https://packagist.org/packages/tflori/verja) [](https://packagist.org/packages/tflori/verja) diff --git a/composer.json b/composer.json index cb5bbde2673f6c665b42445807b0c12b25c6419a..d31c4ecebb11d704c179466125bf3a20fd0cbd28 100644 --- a/composer.json +++ b/composer.json @@ -9,9 +9,10 @@ "require-dev": { "phpunit/phpunit": "*", "tflori/phpunit-printer": "*", - "mockery/mockery": "^1.1", - "squizlabs/php_codesniffer": "^3.5", + "mockery/mockery": "*", + "squizlabs/php_codesniffer": "*", "tflori/dependency-injector": "^2.2", + "phpmd/phpmd": "*", "nesbot/carbon": "^2.53" }, "autoload": { @@ -25,8 +26,9 @@ } }, "scripts": { - "code-style": "phpcs --standard=PSR2 src && phpcs --standard=PSR2 --ignore=Examples tests", - "test": "phpunit", - "coverage": "phpunit --coverage-text" + "code-style": "phpcs --colors --standard=PSR2 src tests", + "code-quality": "phpmd src,tests ansi ruleset.xml", + "test": "phpunit --stderr", + "coverage": "phpunit --stderr --coverage-text" } }