|
9 | 9 | branches: |
10 | 10 | - "*.x" |
11 | 11 | - "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" |
12 | 33 |
|
13 | 34 | jobs: |
14 | 35 | 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 |
20 | 66 |
|
0 commit comments