diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3f5f83..9e243c8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -115,7 +115,7 @@ tests_laravel: - cp .env.testing .env - php artisan key:generate - php artisan config:clear - - php artisan test --coverage --colors=never --log-junit=coverage/junit.xml --coverage-cobertura=coverage/cobertura.xml --coverage-html=coverage/html + - php artisan test --coverage --min=85 --colors=never --log-junit=coverage/junit.xml --coverage-cobertura=coverage/cobertura.xml --coverage-html=coverage/html after_script: - if [ "$CI_JOB_STATUS" == "failed" ]; then cat storage/logs/laravel.log; fi artifacts: @@ -128,7 +128,7 @@ tests_laravel: coverage_report: coverage_format: cobertura path: coverage/cobertura.xml - coverage: '/Statement coverage[A-Za-z\.*]\s*:\s*([^%]+)/' + coverage: '/^\s*Total:\s*([\d\.]+)%/' rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_COMMIT_BRANCH == "trunk" || $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "main" diff --git a/composer.json b/composer.json index 769733a..7fb2e59 100644 --- a/composer.json +++ b/composer.json @@ -66,6 +66,10 @@ "@php artisan config:clear --ansi @no_additional_args", "@php artisan test" ], + "test:coverage": [ + "@php artisan config:clear --ansi @no_additional_args", + "@php artisan test --coverage --min=85" + ], "lint": [ "vendor/bin/parallel-lint --exclude vendor --exclude storage --exclude bootstrap --exclude node_modules .", "vendor/bin/phpcs --standard=phpcs.xml --extensions=php --ignore=vendor/*,storage/*,bootstrap/*,node_modules/*",