Skip to content

feat: (phpcs): *use yoast configuration #1

feat: (phpcs): *use yoast configuration

feat: (phpcs): *use yoast configuration #1

Workflow file for this run

name: PHP Lint
on:
workflow_call:
inputs:
PROJECT:
type: string
required: true
PATH:
type: string
required: false
default: .
COMPOSER_PATH:
type: string
required: false
default: .
COMPOSER_PHP_VERSION:
type: string
required: false
default: "7.4"
COMPOSER_VERSION:
type: string
required: false
default: "1.x"
COMPOSER_DEV:
type: string
required: false
default: "no"
COMPOSER_MEMORY_LIMIT:
type: string
required: false
default: "256M"
PHP_EXTENSIONS:
type: string
required: false
default: "amqp"
PHPCS_PATH:
type: string
required: false
default: .
FLAVOUR:
type: string
required: false
default: phpcs
description: "one of phpcs, phpstan"
secrets:
SSH_KEY:
required: false
SSH_KEY_PUB:
required: false
jobs:
php-lint:
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v4.1.1
- name: Cache Composer dependencies
uses: actions/cache@v4.0.0
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- uses: php-actions/composer@v6.1.2
run: composer config http-basic.my.yoast.com token ${YOAST_COMPOSER_TOKEN}
with:
php_version: ${{inputs.COMPOSER_PHP_VERSION}}
version: ${{inputs.COMPOSER_VERSION}}
args: "--ignore-platform-reqs --working-dir ${{inputs.COMPOSER_PATH}}"
php_extensions: ${{inputs.PHP_EXTENSIONS}}
dev: ${{inputs.COMPOSER_DEV}}
ssh_key: ${{secrets.SSH_KEY}}
ssh_key_pub: ${{secrets.SSH_KEY_PUB}}
memory_limit: ${{inputs.COMPOSER_MEMORY_LIMIT}}
- uses: php-actions/phpstan@v3.0.2
with:
path: ${{inputs.PATH}}
memory_limit: ${{inputs.COMPOSER_MEMORY_LIMIT}}
if: inputs.FLAVOUR == 'phpstan'
- name: phpcs
run: ./vendor/bin/phpcs --standard=${{inputs.PATH}}/phpcs.xml.dist ${{inputs.PHPCS_PATH}}
if: inputs.FLAVOUR == 'phpcs'