Skip to content
Open
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
49 changes: 38 additions & 11 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: PHP Quality Assurance

on:
pull_request:
push:
paths:
- '**workflows/qa.yml'
Expand All @@ -10,6 +9,14 @@ on:
- '**phpunit.xml.dist'
- '**psalm.xml'
- '**composer.json'
pull_request:
paths:
- '**workflows/qa.yml'
- '**.php'
- '**phpcs.xml.dist'
- '**phpunit.xml.dist'
- '**psalm.xml'
- '**composer.json'
workflow_dispatch:
inputs:
jobs:
Expand All @@ -21,27 +28,47 @@ on:
- 'Run all'
- 'Run PHPCS only'
- 'Run Psalm only'
- 'Run static analysis (PHPCS + Psalm)'
- 'Run unit tests only'
- 'Run lint only'
- 'Run static analysis (Lint + PHPCS + Psalm)'
- 'Run unit tests'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
coding-standards-analysis-php:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs != 'Run unit tests only') && (github.event.inputs.jobs != 'Run Psalm only')) }}
lint:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run lint only') || (github.event.inputs.jobs == 'Run static analysis')) }}
uses: inpsyde/reusable-workflows/.github/workflows/lint-php.yml@main
strategy:
matrix:
php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
with:
PHP_VERSION: ${{ matrix.php }}
LINT_ARGS: '-e php --colors --show-deprecated ./src'

coding-standards-analysis:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run PHPCS only') || (github.event.inputs.jobs == 'Run static analysis')) }}
uses: inpsyde/reusable-workflows/.github/workflows/coding-standards-php.yml@main
with:
PHP_VERSION: '8.3'

static-code-analysis-php:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs != 'Run unit tests only') && (github.event.inputs.jobs != 'Run PHPCS only')) }}
static-code-analysis:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run Psalm only') || (github.event.inputs.jobs == 'Run static analysis')) }}
uses: inpsyde/reusable-workflows/.github/workflows/static-analysis-php.yml@main
strategy:
matrix:
php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
with:
PHP_VERSION: ${{ matrix.php }}
PSALM_ARGS: --output-format=github --no-suggestions --no-cache --no-diff --find-unused-psalm-suppress

tests-unit-php:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run unit tests only')) }}
unit-tests:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run unit tests')) }}
uses: inpsyde/reusable-workflows/.github/workflows/tests-unit-php.yml@main
strategy:
matrix:
php: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
with:
PHP_VERSION: ${{ matrix.php }}
PHPUNIT_ARGS: '--no-coverage'
31 changes: 20 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,27 @@
"role": "Developer"
}
],
"repositories": [
{
"type": "composer",
"url": "https://raw.githubusercontent.com/inpsyde/wp-stubs/main",
"only": [
"inpsyde/wp-stubs-versions"
]
}
],
"require": {
"php": ">=7.2.5 < 9",
"php": ">=7.4 < 8.4",
"ext-json": "*",
"inpsyde/wp-context": "^1.2.0",
"pimple/pimple": "^3"
"inpsyde/wp-context": "^1.5.0",
"pimple/pimple": "^v3.5.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5.22",
"inpsyde/php-coding-standards": "^1",
"vimeo/psalm": "^4.26.0",
"phpunit/phpunit": "^9.6.19",
"inpsyde/php-coding-standards": "^2@dev",
"vimeo/psalm": "^5.24.0",
"brain/monkey": "^2.6.1",
"inpsyde/wp-stubs": "dev-main"
"inpsyde/wp-stubs-versions": "dev-latest"
},
"autoload": {
"psr-4": {
Expand All @@ -42,13 +51,13 @@
"minimum-stability": "stable",
"scripts": {
"cs": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs",
"psalm": "@php ./vendor/vimeo/psalm/psalm --no-cache --output-format=compact",
"tests": "@php ./vendor/phpunit/phpunit/phpunit",
"tests:no-cov": "@php ./vendor/phpunit/phpunit/phpunit --no-coverage",
"psalm": "@php ./vendor/vimeo/psalm/psalm --no-suggestions --report-show-info=false --find-unused-psalm-suppress --no-diff --no-cache --no-file-cache --output-format=compact",
"tests": "@php ./vendor/phpunit/phpunit/phpunit --no-coverage",
"tests:coverage": "@php ./vendor/phpunit/phpunit/phpunit",
"qa": [
"@cs",
"@psalm",
"@tests:no-cov"
"@tests"
]
},
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<arg value="sp"/>
<arg name="colors"/>
<config name="testVersion" value="7.2-"/>
<config name="testVersion" value="7.4-"/>

<rule ref="Inpsyde">
<exclude name="WordPressVIPMinimum.Constants.ConstantString.NotCheckingConstantName" />
Expand Down
17 changes: 9 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true">
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd">

<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</include>
</coverage>

<testsuites>
<testsuite name="all">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>

</phpunit>
7 changes: 6 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
ignoreInternalFunctionFalseReturn="false"
ignoreInternalFunctionNullReturn="false"
hideExternalErrors="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand All @@ -17,12 +19,15 @@
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<stubs>
<file name="vendor/inpsyde/wp-stubs/stubs/latest.php" />
<file name="vendor/inpsyde/wp-stubs-versions/latest.php" />
</stubs>

<issueHandlers>
<MixedAssignment errorLevel="suppress" />
<RedundantCastGivenDocblockType errorLevel="suppress" />
<RedundantCast errorLevel="suppress" />
<MissingClassConstType errorLevel="suppress" />
</issueHandlers>
</psalm>
Loading