From 58d6bf04053d6de49cb61cf8e97952ec64e52f2d Mon Sep 17 00:00:00 2001 From: Jean Valverde <28034-mogtofu33@users.noreply.drupalcode.org> Date: Wed, 31 Jul 2024 18:35:08 +0000 Subject: [PATCH] Issue #3464879 by mogtofu33: Ci add PHPMD job --- .gitlab-ci.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9ef2300ef..4f106d72d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,3 +7,37 @@ include: - "/includes/include.drupalci.main.yml" - "/includes/include.drupalci.variables.yml" - "/includes/include.drupalci.workflows.yml" + +.skip-phpmd-rule: &skip-phpmd-rule + if: '$SKIP_PHPMD == "1"' + when: never + +.phpmd-base: + stage: validate + rules: + - !reference [.opt-in-current-rule] + - *skip-phpmd-rule + - !reference [.php-files-exist-rule] + needs: + - composer + before_script: + - curl -fsSL https://phpmd.org/static/latest/phpmd.phar -o vendor/bin/phpmd + - chmod +x vendor/bin/phpmd + script: + - php --version + - vendor/bin/phpmd --version + - vendor/bin/phpmd $_WEB_ROOT/modules/custom/$CI_PROJECT_NAME gitlab $_WEB_ROOT/modules/custom/$CI_PROJECT_NAME/.phpmd.xml --exclude 'tests/*,**/tests/*' > phpmd-quality-report.json || true + - vendor/bin/phpmd $_WEB_ROOT/modules/custom/$CI_PROJECT_NAME text $_WEB_ROOT/modules/custom/$CI_PROJECT_NAME/.phpmd.xml --exclude 'tests/*,**/tests/*' + allow_failure: true + artifacts: + expose_as: phpmd + when: always + expire_in: 6 mos + reports: + codequality: phpmd-quality-report.json + name: artifacts-$CI_PIPELINE_ID-$CI_JOB_NAME_SLUG + paths: + - phpmd-quality-report.json + +phpmd: + extends: .phpmd-base -- GitLab