Skip to content

Commit 980d178

Browse files
authored
Merge pull request #22 from WordPress/add/php-lint-workflow
Add PHP lint workflow
2 parents 4c9e57b + d33b5ed commit 980d178

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/php-lint.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: PHP Code Linting
2+
3+
on:
4+
push:
5+
branches:
6+
- trunk
7+
- 'feature/**'
8+
- 'release/**'
9+
# Only run if PHP-related files changed.
10+
paths:
11+
- '.github/workflows/php-lint.yml'
12+
- '**.php'
13+
- 'phpcs.xml.dist'
14+
- 'phpstan.neon.dist'
15+
- 'composer.json'
16+
- 'composer.lock'
17+
pull_request:
18+
# Only run if PHP-related files changed.
19+
paths:
20+
- '.github/workflows/php-lint.yml'
21+
- '**.php'
22+
- 'phpcs.xml.dist'
23+
- 'phpstan.neon.dist'
24+
- 'composer.json'
25+
- 'composer.lock'
26+
types:
27+
- opened
28+
- reopened
29+
- synchronize
30+
31+
concurrency:
32+
group: ${{ github.workflow }}-${{ github.ref }}
33+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
34+
35+
jobs:
36+
php-lint:
37+
name: PHP
38+
runs-on: ubuntu-latest
39+
timeout-minutes: 20
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- uses: shivammathur/setup-php@v2
44+
with:
45+
php-version: 'latest'
46+
47+
- name: Validate Composer configuration
48+
run: composer validate
49+
50+
- name: Install PHP dependencies
51+
uses: ramsey/composer-install@v3
52+
with:
53+
composer-options: '--prefer-dist'
54+
55+
- name: PHPStan
56+
run: composer phpstan
57+
58+
- name: PHP Code Sniffer
59+
run: composer phpcs

0 commit comments

Comments
 (0)