Skip to content

V 1.6.5 - Minor enhancement release 🚧 (#27) #87

V 1.6.5 - Minor enhancement release 🚧 (#27)

V 1.6.5 - Minor enhancement release 🚧 (#27) #87

name: PHP Coding Standards
on:
push:
branches:
- main
pull_request:
jobs:
# Runs PHP coding standards checks.
# Note: Inspired by https://github.com/WordPress/wordpress-develop/blob/master/.github/workflows/coding-standards.yml
#
# Violations are reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Configures caching for Composer.
# - Sets up PHP.
# - Logs debug information.
# - Installs Composer dependencies (from cache if possible).
# - Logs PHP_CodeSniffer debug information.
# - Runs WPCS on the full codebase with warnings suppressed.
phpcs:
name: PHP coding standards
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Set up Composer caching
uses: actions/cache@v3
env:
cache-name: cache-composer-dependencies
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr
- name: Log debug information
run: |
php --version
composer --version
- name: Install Composer dependencies
run: |
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
echo "${PWD}/vendor/bin" >> $GITHUB_PATH
- name: Run WPCS on all files
run: composer lint:wpcs