Skip to content

Commit

Permalink
Merge pull request #260 from jrfnl/feature/ghactions-only-run-phpcs-once
Browse files Browse the repository at this point in the history
GH Actions: only run PHPCS once + update CS dependencies
  • Loading branch information
gRegorLove authored Sep 30, 2024
2 parents e35bb9f + 6151cf2 commit b75a69d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
37 changes: 32 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,38 @@ on:
workflow_dispatch:

jobs:
phpcs:
name: 'PHPCS'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up PHP environment
uses: shivammathur/setup-php@v2
with:
php-version: 'latest'
coverage: none
tools: cs2pr

- name: Install Composer dependencies & cache dependencies
uses: "ramsey/composer-install@v3"
with:
composer-options: "--prefer-dist"
env:
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}

- name: Run Code Sniffer
id: phpcs
run: ./vendor/bin/phpcs -ps --report-full --report-checkstyle=./phpcs-report.xml

- name: Show PHPCS results in PR
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
run: cs2pr ./phpcs-report.xml

build:

strategy:
matrix:
php: ['5.6', '7.3', '7.4', '8.0', '8.1']
Expand Down Expand Up @@ -41,9 +71,6 @@ jobs:

- name: Run Test Suite
run: XDEBUG_MODE=coverage ./vendor/bin/phpunit tests --coverage-text

- name: Run Code Sniffer
run: ./vendor/bin/phpcs


#- name: Run Static Analysis
# run: ./vendor/bin/psalm
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
},
"require-dev": {
"mf2/tests": "dev-master#e9e2b905821ba0a5b59dab1a8eaf40634ce9cd49",
"squizlabs/php_codesniffer": "^3.6.2",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"squizlabs/php_codesniffer": "^3.10.2",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"phpcompatibility/php-compatibility": "^9.3",
"yoast/phpunit-polyfills": "^1.0"
},
Expand Down

0 comments on commit b75a69d

Please sign in to comment.