Skip to content

[pull] main from google:main #3574

[pull] main from google:main

[pull] main from google:main #3574

Workflow file for this run

name: Lint PHP
on:
push:
# Only run if PHP-related files changed.
paths:
- '**.php'
- 'phpcs.xml.dist'
- 'phpmd.xml'
- 'phpstan.neon.dist'
- 'composer.json'
- 'composer.lock'
- '.github/workflows/lint-php.yml'
branches:
- main
- release/*
pull_request:
# Only run if PHP-related files changed.
paths:
- '**.php'
- 'phpcs.xml.dist'
- 'phpmd.xml'
- 'phpstan.neon.dist'
- 'composer.json'
- 'composer.lock'
- '.github/workflows/lint-php.yml'
permissions:
contents: read
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the (target) branch name.
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7
with:
disable-file-monitoring: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
objects.githubusercontent.com:443
packagist.org:443
repo.packagist.org:443
getcomposer.org:443
dl.cloudsmith.io:443
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Setup PHP
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35
with:
php-version: '8.0'
coverage: none
tools: composer, cs2pr
- name: Validate composer.json
run: composer --no-interaction validate --no-check-all
- name: Install PHP dependencies
uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a
with:
composer-options: '--prefer-dist --no-progress --no-interaction'
- name: Detect coding standard violations (PHPCS)
run: vendor/bin/phpcs -q --report=checkstyle --severity=1 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 | cs2pr --graceful-warnings
- name: Static Analysis (PHPStan)
run: composer phpstan
- name: Static Analysis (PHPMD)
run: composer phpmd
- name: Normalize composer.json
run: composer normalize --no-interaction --dry-run