Skip to content

Commit ec82092

Browse files
committed
Refactor of code quality workflow.
1 parent 5c04e9c commit ec82092

File tree

2 files changed

+39
-23
lines changed

2 files changed

+39
-23
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: 'PHP Code Quality'
2+
description: 'Sets up PHP and runs code quality tools'
3+
inputs:
4+
working-directory:
5+
description: 'Directory to run composer and quality tools in'
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Setup PHP
11+
uses: shivammathur/setup-php@v2
12+
with:
13+
php-version: '7.4'
14+
tools: composer:v2
15+
coverage: none
16+
17+
- name: Install dependencies
18+
uses: ramsey/composer-install@v2
19+
with:
20+
working-directory: ${{ inputs.working-directory }}
21+
composer-options: "--no-progress"
22+
23+
- name: Run PHPStan
24+
working-directory: ${{ inputs.working-directory }}
25+
run: composer run-script phpstan
26+
shell: bash
27+
28+
- name: Run Psalm
29+
working-directory: ${{ inputs.working-directory }}
30+
run: composer run-script php:psalm
31+
shell: bash
32+
33+
- name: Run PHP CodeSniffer
34+
working-directory: ${{ inputs.working-directory }}
35+
run: composer run-script check-cs
36+
shell: bash

.github/workflows/code-quality.yml

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,7 @@ jobs:
2121
plugin=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^plugins/' | head -1 | cut -d/ -f2)
2222
echo "slug=$plugin" >> $GITHUB_OUTPUT
2323
24-
- name: Setup PHP
25-
uses: shivammathur/setup-php@v2
24+
- name: PHP Code Quality
25+
uses: ./.github/actions/php-code-quality
2626
with:
27-
php-version: '7.4'
28-
tools: composer:v2
29-
coverage: none
30-
31-
- name: Install dependencies
32-
uses: ramsey/composer-install@v2
33-
with:
34-
working-directory: plugins/${{ steps.plugin.outputs.slug }}
35-
composer-options: "--no-progress"
36-
37-
- name: Run PHPStan
38-
working-directory: plugins/${{ steps.plugin.outputs.slug }}
39-
run: composer run-script phpstan
40-
41-
- name: Run Psalm
42-
working-directory: plugins/${{ steps.plugin.outputs.slug }}
43-
run: composer run-script php:psalm
44-
45-
- name: Run PHP CodeSniffer
46-
working-directory: plugins/${{ steps.plugin.outputs.slug }}
47-
run: composer run-script check-cs
27+
working-directory: plugins/${{ steps.plugin.outputs.slug }}

0 commit comments

Comments
 (0)