Merge pull request #2403 from jrfnl/feature/setup-php-linting

GH Actions: add PHP linting job
This commit is contained in:
Marcus Bointon 2021-07-04 14:50:43 +02:00 committed by GitHub
commit f4eba3a68c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 3 deletions

View File

@ -35,8 +35,45 @@ jobs:
- name: Show PHPCS results in PR
run: cs2pr ./phpcs-report.xml
lint:
runs-on: ubuntu-18.04
strategy:
matrix:
php: ['5.5', '7.2', '8.0']
experimental: [false]
include:
- php: '8.1'
experimental: true
name: "Lint: PHP ${{ matrix.php }}"
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: cs2pr
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies
uses: "ramsey/composer-install@v1"
- name: Lint against parse errors
if: ${{ matrix.php != '8.1' }}
run: composer lint -- --checkstyle | cs2pr
- name: Lint against parse errors (PHP 8.1)
if: ${{ matrix.php == '8.1' }}
run: composer lint
test:
needs: ['coding-standard']
needs: ['coding-standard', 'lint']
runs-on: ubuntu-18.04
strategy:
matrix:
@ -47,7 +84,7 @@ jobs:
- php: '8.1'
experimental: true
name: PHP ${{ matrix.php }}
name: "Test: PHP ${{ matrix.php }}"
continue-on-error: ${{ matrix.experimental }}

View File

@ -34,6 +34,8 @@
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"doctrine/annotations": "^1.2",
"php-parallel-lint/php-console-highlighter": "^0.5.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpcompatibility/php-compatibility": "^9.3.5",
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.6.0",
@ -60,6 +62,9 @@
"license": "LGPL-2.1-only",
"scripts": {
"check": "./vendor/bin/phpcs",
"test": "./vendor/bin/phpunit"
"test": "./vendor/bin/phpunit",
"lint": [
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php,phps --exclude vendor --exclude .git --exclude build"
]
}
}