Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/php-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: PHP Linting

on:
push:
branches:
- main
- 'feature/**'
- 'release/**'
paths:
- '.github/workflows/php-lint.yml'
- '**.php'
- 'phpcs.xml.dist'
- 'composer.json'
- 'composer.lock'
pull_request:
paths:
- '.github/workflows/php-lint.yml'
- '**.php'
- 'phpcs.xml.dist'
- 'composer.json'
- 'composer.lock'
types:
- opened
- reopened
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
phpcs:
name: PHPCS
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
tools: cs2pr

- name: Install PHP dependencies
uses: ramsey/composer-install@v3
with:
composer-options: '--prefer-dist'

- name: Run PHPCS
run: composer phpcs -- -q --report=checkstyle | cs2pr
63 changes: 63 additions & 0 deletions .github/workflows/php-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: PHP Unit Testing

on:
push:
branches:
- main
- 'feature/**'
- 'release/**'
paths:
- '.github/workflows/php-test.yml'
- '**.php'
- 'phpunit.xml.dist'
- 'composer.json'
- 'composer.lock'
pull_request:
paths:
- '.github/workflows/php-test.yml'
- '**.php'
- 'phpunit.xml.dist'
- 'composer.json'
- 'composer.lock'
types:
- opened
- reopened
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
test:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
php:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
- '8.3'
- '8.4'
steps:
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Validate Composer configuration
run: composer validate --strict

- name: Install PHP dependencies
uses: ramsey/composer-install@v3
with:
composer-options: '--prefer-dist'

- name: Run tests
run: composer test
18 changes: 16 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
"require-dev": {
"phpunit/phpunit": "^9.0 || ^10.0",
"brain/monkey": "^2.6",
"mockery/mockery": "^1.6"
"mockery/mockery": "^1.6",
"squizlabs/php_codesniffer": "^3.7",
"wp-coding-standards/wpcs": "^3.0",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0"
},
"autoload": {
"psr-4": {
Expand All @@ -21,8 +25,18 @@
"WeDevs\\WPKit\\Tests\\": "tests/phpunit/tests/"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"minimum-stability": "stable",
"scripts": {
"test": "phpunit"
"test": "phpunit",
"phpcs": "phpcs",
"phpcbf": "phpcbf",
"lint": [
"@phpcs"
]
}
}
Loading