Skip to content

Commit b75a69d

Browse files
authored
Merge pull request #260 from jrfnl/feature/ghactions-only-run-phpcs-once
GH Actions: only run PHPCS once + update CS dependencies
2 parents e35bb9f + 6151cf2 commit b75a69d

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

.github/workflows/main.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,38 @@ on:
1010
workflow_dispatch:
1111

1212
jobs:
13+
phpcs:
14+
name: 'PHPCS'
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up PHP environment
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: 'latest'
25+
coverage: none
26+
tools: cs2pr
27+
28+
- name: Install Composer dependencies & cache dependencies
29+
uses: "ramsey/composer-install@v3"
30+
with:
31+
composer-options: "--prefer-dist"
32+
env:
33+
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
34+
35+
- name: Run Code Sniffer
36+
id: phpcs
37+
run: ./vendor/bin/phpcs -ps --report-full --report-checkstyle=./phpcs-report.xml
38+
39+
- name: Show PHPCS results in PR
40+
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
41+
run: cs2pr ./phpcs-report.xml
42+
1343
build:
14-
44+
1545
strategy:
1646
matrix:
1747
php: ['5.6', '7.3', '7.4', '8.0', '8.1']
@@ -41,9 +71,6 @@ jobs:
4171

4272
- name: Run Test Suite
4373
run: XDEBUG_MODE=coverage ./vendor/bin/phpunit tests --coverage-text
44-
45-
- name: Run Code Sniffer
46-
run: ./vendor/bin/phpcs
47-
74+
4875
#- name: Run Static Analysis
4976
# run: ./vendor/bin/psalm

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
},
2323
"require-dev": {
2424
"mf2/tests": "dev-master#e9e2b905821ba0a5b59dab1a8eaf40634ce9cd49",
25-
"squizlabs/php_codesniffer": "^3.6.2",
26-
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
25+
"squizlabs/php_codesniffer": "^3.10.2",
26+
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
2727
"phpcompatibility/php-compatibility": "^9.3",
2828
"yoast/phpunit-polyfills": "^1.0"
2929
},

0 commit comments

Comments
 (0)