-
Notifications
You must be signed in to change notification settings - Fork 193
86 lines (74 loc) · 2.46 KB
/
lint-php.yml
File metadata and controls
86 lines (74 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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@5ef0c079ce82195b2a36a210272d6b661572d83e
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
54.185.253.63:443
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1
with:
php-version: latest
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@3cf229dc2919194e9e36783941438d17239e8520
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