Skip to content

Merge pull request #27 from Automattic/standardize/add-dependabot #9

Merge pull request #27 from Automattic/standardize/add-dependabot

Merge pull request #27 from Automattic/standardize/add-dependabot #9

Workflow file for this run

name: CS & Lint
on:
pull_request:
paths:
- '.github/workflows/cs-lint.yml'
- '**.php'
- '.phpcs.xml.dist'
- 'phpunit.xml.dist'
- 'composer.json'
push:
branches:
- develop
- trunk
paths:
- '.github/workflows/cs-lint.yml'
- '**.php'
- '.phpcs.xml.dist'
- 'phpunit.xml.dist'
- 'composer.json'
workflow_dispatch:
permissions:
contents: read
jobs:
checkcs:
name: "Basic CS and QA checks"
runs-on: ubuntu-latest
env:
XMLLINT_INDENT: " "
strategy:
matrix:
php: ['8.2', 'latest', '8.5']
fail-fast: false
continue-on-error: ${{ matrix.php == '8.5' }}
steps:
- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
with:
php-version: ${{ matrix.php }}
coverage: none
tools: cs2pr
# Show PHP lint violations inline in the file diff.
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
- name: Register PHP lint violations to appear as file diff comments
uses: korelstar/phplint-problem-matcher@cb2b753750ec7bf13a7cde0a476df8c5605bdfb1 # v1.2.0
# Show XML violations inline in the file diff.
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
- name: Register XML violations to appear as file diff comments
uses: korelstar/xmllint-problem-matcher@1bd292d642ddf3d369d02aaa8b262834d61198c0 # v1.2.0
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
# Validate the composer.json file.
# @link https://getcomposer.org/doc/03-cli.md#validate
- name: Validate Composer installation
run: composer validate --no-check-all
# 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@3cf229dc2919194e9e36783941438d17239e8520 # 3.1.1
# Lint PHP.
- name: Lint PHP against parse errors
run: composer lint-ci | cs2pr
# Needed as runs-on: system doesn't have xml-lint by default.
# @link https://github.com/marketplace/actions/xml-lint
- name: Lint phpunit.xml.dist
uses: ChristophWurst/xmllint-action@7c54ff113fc0f6d4588a15cb4dfe31b6ecca5212 # v1.2.1
with:
xml-file: ./phpunit.xml.dist
xml-schema-file: ./vendor/phpunit/phpunit/phpunit.xsd
# Check the code-style consistency of the PHP files.
- name: Check PHP code style
continue-on-error: true
run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml
- name: Show PHPCS results in PR
run: cs2pr ./phpcs-report.xml