-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #7
- Loading branch information
Showing
27 changed files
with
2,043 additions
and
345 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Contributing | ||
|
||
[](https://github.com/cssllc/mu-plugins/actions/workflows/phpcs.yml) | ||
[](https://github.com/cssllc/mu-plugins/actions/workflows/phpstan.yml) | ||
|
||
## Checks | ||
|
||
There are two checks run on pull requests: | ||
|
||
1. PHPCS | ||
1. PHPStan | ||
|
||
PHPCS and PHPStan are managed via Composer. | ||
|
||
### Setup | ||
|
||
To setup the checks locally, run the install command with the root of the WordPress install (directory with `composer.json`): | ||
|
||
``` | ||
composer install | ||
``` | ||
|
||
### Run | ||
|
||
#### PHPCS | ||
|
||
``` | ||
vendor/bin/phpcs | ||
``` | ||
|
||
#### PHPStan | ||
|
||
``` | ||
vendor/bin/phpstan --memory-limit=-1 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# MU-Plugins | ||
|
||
Collection of WordPress mu-plugins to enhance and customize a WordPress install. | ||
|
||
## Contributing | ||
|
||
Please read the [Contributing doc](contributing.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: PHPCS | ||
run-name: Run PHPCS on `${{ github.head_ref }}` | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'src/*.php' | ||
- '.github/workflows/phpcs.yml' | ||
- 'phpcs.xml' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
phpcs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Detect File Changes | ||
uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
list-files: shell | ||
filters: | | ||
wpcontent: | ||
- added|modified: 'src/**/*.php' | ||
- name: Setup PHP | ||
if: ${{ steps.filter.outputs.wpcontent == 'true' }} | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "8.2" | ||
ini-values: "memory_limit=1G" | ||
coverage: none | ||
|
||
- name: Validate composer.json and composer.lock | ||
if: ${{ steps.filter.outputs.wpcontent == 'true' }} | ||
run: composer validate --no-check-publish | ||
|
||
- name: Install Composer dependencies | ||
if: ${{ steps.filter.outputs.wpcontent == 'true' }} | ||
run: | | ||
composer install --prefer-dist --no-progress --no-suggest --optimize-autoloader | ||
- name: Run PHPCS checks | ||
if: ${{ steps.filter.outputs.wpcontent == 'true' }} | ||
run: ./vendor/bin/phpcs ${{ steps.filter.outputs.wpcontent_files }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: PHPStan | ||
run-name: Run PHPStan on `${{ github.head_ref }}` | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'dev/phpstan-bootstrap.php' | ||
- 'dev/wordpress-overrides.stub' | ||
- 'dev/patches/**/*.patch' | ||
- 'src/**/*.php' | ||
- '.github/workflows/phpstan.yml' | ||
- 'phpstan-baseline.neon' | ||
- 'phpstan.neon' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
phpstan: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Detect File Changes | ||
uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
list-files: shell | ||
filters: | | ||
wpcontent: | ||
- added|modified: 'src/**/*.php' | ||
- name: Setup PHP | ||
if: ${{ steps.filter.outputs.wpcontent == 'true' }} | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "8.2" | ||
ini-values: "memory_limit=1G" | ||
coverage: none | ||
|
||
- name: Validate composer.json and composer.lock | ||
if: ${{ steps.filter.outputs.wpcontent == 'true' }} | ||
run: composer validate --no-check-publish | ||
|
||
- name: Install Composer dependencies | ||
if: ${{ steps.filter.outputs.wpcontent == 'true' }} | ||
run: | | ||
composer install --prefer-dist --no-progress --no-suggest --optimize-autoloader | ||
- name: Run PHPStan checks | ||
if: ${{ steps.filter.outputs.wpcontent == 'true' }} | ||
run: ./vendor/bin/phpstan analyse ${{ steps.filter.outputs.wpcontent_files }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
/acf-json | ||
/.phpstan-cache | ||
/acf-json | ||
/vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "cssllc/mu-plugins", | ||
"description": "CSSLLC MU-Plugins", | ||
"require-dev": { | ||
"automattic/vipwpcs": "^3.0", | ||
"szepeviktor/phpstan-wordpress": "^1.1", | ||
"phpstan/extension-installer": "^1.1", | ||
"php-stubs/acf-pro-stubs": "^6.0", | ||
"php-stubs/wordpress-stubs": "^6.0", | ||
"squizlabs/php_codesniffer": "^3.7", | ||
"mediawiki/mediawiki-codesniffer": "^41.0", | ||
"cweagans/composer-patches": "~1.0" | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"dealerdirect/phpcodesniffer-composer-installer": true, | ||
"phpstan/extension-installer": true, | ||
"cweagans/composer-patches": true | ||
} | ||
}, | ||
"license": "proprietary", | ||
"extra": { | ||
"patches": { | ||
"php-stubs/acf-pro-stubs": { | ||
"PHPStan return types": "dev/patches/acf-pro-stubs.patch" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.