Skip to content

Commit cd6e9d8

Browse files
committed
Update coding standards workflow
1 parent 4a06c1b commit cd6e9d8

File tree

1 file changed

+51
-5
lines changed

1 file changed

+51
-5
lines changed

.github/workflows/coding-standards.yml

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,58 @@ on:
99
branches:
1010
- "*.x"
1111
- "main"
12+
workflow_call:
13+
inputs:
14+
php-version:
15+
description: "The PHP version to use when running the job"
16+
default: "8.3"
17+
required: false
18+
type: "string"
19+
composer-root-version:
20+
description: "The version of the package being tested, in case of circular dependencies."
21+
required: false
22+
type: "string"
23+
composer-dependency-versions:
24+
description: "whether the job should install the locked, highest, or lowest versions of Composer dependencies."
25+
default: "highest"
26+
required: false
27+
type: "string"
28+
composer-options:
29+
description: "Additional flags for the composer install command."
30+
default: "--prefer-dist"
31+
required: false
32+
type: "string"
1233

1334
jobs:
1435
coding-standards:
15-
name: "Coding Standards"
16-
uses: "doctrine/.github/.github/workflows/[email protected]"
17-
with:
18-
php-version: '8.3'
19-
composer-options: '--prefer-dist --ignore-platform-req=php'
36+
name: "Coding Standards (PHP: ${{ inputs.php-version }})"
37+
runs-on: "ubuntu-22.04"
38+
39+
steps:
40+
- name: "Checkout"
41+
uses: "actions/checkout@v5"
42+
43+
- name: "Install PHP"
44+
uses: "shivammathur/setup-php@v2"
45+
with:
46+
coverage: "none"
47+
ini-file: development
48+
php-version: "${{ inputs.php-version }}"
49+
tools: "cs2pr"
50+
51+
- name: "Set COMPOSER_ROOT_VERSION"
52+
run: |
53+
echo "COMPOSER_ROOT_VERSION=${{ inputs.composer-root-version }}" >> $GITHUB_ENV
54+
if: "${{ inputs.composer-root-version }}"
55+
56+
- name: "Install dependencies with Composer"
57+
uses: "ramsey/composer-install@v3"
58+
with:
59+
dependency-versions: "${{ inputs.composer-dependency-versions }}"
60+
composer-options: "${{ inputs.composer-options }}"
61+
62+
- name: "Run PHP_CodeSniffer"
63+
run: |
64+
vendor/bin/phpcs --report-emacs --report-diff || true
65+
vendor/bin/phpcs --no-colors --report=checkstyle | cs2pr
2066

0 commit comments

Comments
 (0)