Skip to content
Snippets Groups Projects
Verified Commit 40cdb1f9 authored by Bartek Jaskulski's avatar Bartek Jaskulski
Browse files

feat: add phpstan and phpcs to CI checks

parent 4fe9b4d4
No related branches found
No related tags found
No related merge requests found
variables:
WPDESK_CI_VERSION: "2023.11.10"
WPDESK_CI_VERSION: "2023.11.17"
MYSQL_ROOT_PASSWORD: "mysql"
MYSQL_DATABASE: "wptest"
MYSQL_USER: "mysql"
......@@ -30,6 +30,7 @@ include:
file:
- '/includes/prepare.yml'
- '/includes/translations.yml'
- '/includes/tests/static-analysis.yml'
- '/includes/tests/lint.yml'
- '/includes/tests/unit.yml'
- '/includes/metrics.yml'
......
.static-analysis:
image: gitlab.wpdesk.dev:5050/wpdesk/docker-tests/php-box:8.2
needs:
- prepare prefixed vendor
stage: tests
# Run phpstan in strict mode (failing pipeline) only if we have baseline, otherwise allow to fail with a warning, suggesting to create one. This behavior will change at the end of the year, when any PHPStan failure will be considered fatal
phpstan:
extends: .static-analysis
script:
- |
if [ -f "vendor/bin/phpstan" ]; then
vendor/bin/phpstan analyse --memory-limit=2G
elif [ -f "vendor/wpdesk/wp-wpdesk-composer/director/vendor/bin/phpstan" ]; then
# PHPStan installed by director
vendor/wpdesk/wp-wpdesk-composer/director/vendor/bin/phpstan analyse --memory-limit=2G
else
echo "PHPStan not found! Install it with 'composer require --dev wpdesk/phpstan-rules'."
# We will be able to use custom exit after removing rules.allow_failure part
# exit 125
fi
allow_failure: true
rules:
- exists:
- .phpstan-baseline.php
- .phpstan-baseline.neon
allow_failure: false
phpcs:
extends: .static-analysis
script:
- vendor/bin/phpcs
allow_failure: true
rules:
- exists:
- phpcs.xml.dist
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment