-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
71 lines (66 loc) · 3.03 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: 'Drupal 8+ code quality check'
description: 'Verify custom code and theme quality on a Drupal composer-base repository'
inputs:
phplint:
description: 'Run PHP Lint'
required: true
default: 'true'
phpmd:
description: 'Run PHP Mess Detector'
required: true
default: 'true'
phpcs:
description: 'Run PHP Code Sniffer'
required: true
default: 'true'
phpcs_standards:
description: 'List of standards for PHP Code Sniffer'
required: false
default: 'Drupal,DrupalPractice'
phpcs_extensions:
description: 'List of extensions for PHP Code Sniffer'
required: false
default: 'php,module,inc,install,profile,theme,test,info,yml'
phpstan:
description: 'Run PHPStan'
required: true
default: 'true'
phpstan_level:
description: 'PHPStan level of rule options - the higher the stricter (1..9)'
required: true
default: '5'
runs:
using: 'composite'
steps:
- name: 'Install required tools'
run: |
composer require --dev drupal/coder overtrue/phplint phpmd/phpmd phpstan/phpstan phpstan/extension-installer mglaman/phpstan-drupal phpstan/phpstan-deprecation-rules
shell: bash
- name: 'PHPLint'
if: ${{ inputs.phplint == 'true' }}
run: |
./vendor/bin/phplint --version
if [ -d ./web/modules/custom ]; then ./vendor/bin/phplint --no-cache --no-progress --extensions=php --extensions=module --extensions=inc --extensions=install --extensions=test --extensions=theme ./web/modules/custom/; fi
if [ -d ./web/themes/custom ]; then ./vendor/bin/phplint --no-cache --no-progress --extensions=php --extensions=module --extensions=inc --extensions=install --extensions=test --extensions=theme ./web/themes/custom/; fi
shell: bash
- name: 'PHPMD'
if: ${{ inputs.phpmd == 'true' }}
run: |
./vendor/bin/phpmd --version
if [ -d ./web/modules/custom ] && [ ! -f phpmd.xml ]; then curl https://raw.githubusercontent.com/eaudeweb/drupal-code-qa-action/2.x/phpmd.xml > phpmd.xml; fi
if [ -d ./web/modules/custom ]; then ./vendor/bin/phpmd ./web/modules/custom/ github phpmd.xml; fi
shell: bash
- name: 'PHPCS'
if: ${{ inputs.phpcs == 'true' }}
run: |
./vendor/bin/phpcs --version
if [ -d ./web/modules/custom ]; then ./vendor/bin/phpcs --standard=${{ inputs.phpcs_standards }} --extensions=${{ inputs.phpcs_extensions }} ./web/modules/custom/; fi
if [ -d ./web/themes/custom ]; then ./vendor/bin/phpcs --standard=${{ inputs.phpcs_standards }} --extensions=${{ inputs.phpcs_extensions }} --ignore=node_modules ./web/themes/custom/; fi
shell: bash
- name: 'PHPStan'
if: ${{ inputs.phpstan == 'true' }}
run: |
./vendor/bin/phpstan --version
if [ -d ./web/modules/custom ] && [ ! -f phpstan.neon ]; then curl https://raw.githubusercontent.com/eaudeweb/drupal-code-qa-action/2.x/phpstan.neon > phpstan.neon; fi
if [ -d ./web/modules/custom ]; then ./vendor/bin/phpstan analyze --level ${{ inputs.phpstan_level }}; fi
shell: bash